Requesting confirmation on action in BLL RRS feed

  • Question

  • Hi all,

    We have a requirement that regularly pops up and that is how to request user confirmation from the BLL? For example, if a user is submitting a document through an application's UI and the BLL finds that the file exists it needs to prompt the user to decide whether or not to overwrite the existing file or rename the new file. What is the best way of achieving this? I was thinking either through an event to which the UI subscribes or an Exception that details the options. The event seems the most logical, but could be tricky to implement in Web UIs.

    Any ideas?


    Monday, November 16, 2009 10:14 AM

All replies

  • Greetings,


    Suppose the user sent a file from the UI to BLL. Normally the file is stored in the database. When the file reaches the BLL , you need to check from the BLL whether the file is present in the database or not. For Example sample piece of code.

    •  First thing that you need to check from the database whether the file exists or not.
    •   In the case , if the file exists sent , sent a bool value ie false back to the UI , the showing the file already  exists.   When the user clicks ok button , the XmlDocument is over written to the database.
    •   Ensure that you are accessing the BLL through DAL layer. All the database functionality is handled in the DAL   layer.

    public bool WritetoDataBLL(XmlDocument xDoc , int Rename)

       // Sample code structure.

           bool bStatus = false;
           // here you are comparing xmldocument exist or not. You are using method defined inside the DAL.  The  integer value indicates that the user has decided to overwrite the file which is already present in the database.

            if(CompareFileDAL(XmlDocument) && Rename == 1)
                  bStatus = OverWrite(xDoc);

           // here you renamaing the XmlDocument which is already present in the database. You are using method defined inside the DAL. You are using the integer value here is because the user decides to rename the file present in the database.

            else if(RenameFile(XmlDocument) && Rename == 2)
                 bStatus =  BoolReWrite(xDoc);

          // the esle block write to the database when no file is present in the database.
                   bStatus     = WriteToDatabase(XmlDocument);   

        return bStatus;

    public bool OverWirte(XmlDocument xDoc)
            // this method overwrite to the database. call the DAL layer.

    public bool BoolReWrite(XmlDocument xDoc)
          //this method  rename the file database.

    public bool WriteToDatabase(XmlDocument xDoc)
        // writing to database.

    Hope this helps

    Take Care

    Helping People To Solve Technical Problems
    Monday, November 16, 2009 10:51 AM