コード例 #1
0
        protected void button_Update_Expense_Details_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                bool l_Expense_Successfully_Updated = false;
                int  p_Expense_Record_Id            = int.Parse(this.Request.QueryString["id"]);

                string exception_During_Process            = "";
                string exception_During_Process_Extra_Data = "";

                int p_User_Id     = base.Authenticated_User_ID;
                int p_Supplier_Id = int.Parse(this.dropdown_Supplier.SelectedValue);

                DateTime?p_Expense_Invoice_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                    this.textbox_Expense_Invoice_DateTime,
                    this.dropdown_Invoice_Time_Hours,
                    this.dropdown_Invoice_Time_Minutes,
                    this.dropdown_Invoice_Time_Seconds);

                byte    p_Currency_Id       = byte.Parse(this.dropdown_Currency.SelectedValue);
                decimal p_Total_Amount      = decimal.Parse(this.textbox_Total_Amount.Text);
                decimal p_Vat_Percentage    = decimal.Parse(this.textbox_Vat_Percentage.Text);
                decimal p_Total_Without_Vat = decimal.Parse(this.textbox_Total_Without_Vat.Text);
                decimal p_Total_Vat         = decimal.Parse(this.textbox_Total_Vat.Text);

                int?p_Invoiced_Client_On_User_Location_Id = new int?();

                string p_Invoiced_Client_To_CompanyName   = this.textbox_Invoiced_Client_To_CompanyName.Text;
                string p_Invoiced_Client_To_Tax_Reference = this.textbox_Invoiced_Client_To_Tax_Reference.Text;
                string p_Invoiced_Client_To_PersonName    = this.textbox_Invoiced_Client_To_PersonName.Text;
                string p_Invoiced_Client_To_PhoneNumber   = this.textbox_Invoiced_Client_To_PhoneNumber.Text;

                short?p_Invoiced_Client_To_Country_Id = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Invoiced_Client_To_Country.SelectedValue))
                {
                    p_Invoiced_Client_To_Country_Id = short.Parse(this.dropdown_Invoiced_Client_To_Country.SelectedValue);
                }
                short?p_Invoiced_Client_To_State_Id = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Invoiced_Client_To_State.SelectedValue))
                {
                    p_Invoiced_Client_To_State_Id = short.Parse(this.dropdown_Invoiced_Client_To_State.SelectedValue);
                }

                string p_Invoiced_Client_To_City         = this.textbox_Invoiced_Client_To_City.Text;
                string p_Invoiced_Client_To_Address      = this.textbox_Invoiced_Client_To_Address.Text;
                string p_Invoiced_Client_To_Zip          = this.textbox_Invoiced_Client_To_Zip.Text;
                string p_Invoiced_Client_To_EmailAddress = this.textbox_Invoiced_Client_To_EmailAddress.Text;

                byte   p_Expense_Type_Id          = byte.Parse(this.dropdown_Expense_Type.SelectedValue);
                string p_Invoice_Number           = this.textbox_Invoice_Number.Text;
                string p_Invoice_Reference_Number = this.textbox_Invoice_Reference_Number.Text;

                string p_Invoice_Supplier_Company_Details = this.textbox_Invoice_Supplier_Company_Details.Text;
                string p_Invoice_Supplier_Tax_Reference   = this.textbox_Invoice_Supplier_Tax_Reference.Text;

                short?p_Invoice_Supplier_Country_Id = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Invoice_Supplier_Country.SelectedValue))
                {
                    p_Invoice_Supplier_Country_Id = short.Parse(this.dropdown_Invoice_Supplier_Country.SelectedValue);
                }
                short?p_Invoice_Supplier_State_Id = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Invoice_Supplier_State.SelectedValue))
                {
                    p_Invoice_Supplier_State_Id = short.Parse(this.dropdown_Invoice_Supplier_State.SelectedValue);
                }

                string p_Invoice_Supplier_City = this.textbox_Invoice_Supplier_City.Text;
                string p_Invoice_Supplier_Address_Description = this.textbox_Invoice_Supplier_Address_Description.Text;
                string p_Invoice_Supplier_ZipCode             = this.textbox_Invoice_Supplier_ZipCode.Text;
                string p_Invoice_Supplier_WebAddress          = this.textbox_Invoice_Supplier_WebAddress.Text;

                string p_Invoice_Supplier_Phone_Number     = this.textbox_Invoice_Supplier_Phone_Number.Text;
                string p_Invoice_Supplier_Contact_FullName = this.textbox_Invoice_Supplier_Contact_FullName.Text;

                string p_Invoice_Content_Long_Description = this.textbox_Invoice_Content_Long_Description.Text;
                string p_User_Description = this.textbox_User_Description.Text;
                string p_User_Comments    = this.textbox_User_Description.Text;

                bool p_Is_Active = this.checkbox_Is_Active.Checked;

                bool p_Is_Visible_To_Anonymous_Users = this.checkbox_Is_Visible_To_Anonymous_Users.Checked;
                bool p_Is_Available_For_Download_For_Anonymous_Users = this.checkbox_Is_Available_For_Download_For_Anonymous_Users.Checked;
                bool p_Is_Visible_To_Followers_Users = this.checkbox_Is_Visible_To_Followers_Users.Checked;
                bool p_Is_Available_For_Download_For_Followers_Users = this.checkbox_Is_Available_For_Download_For_Followers_Users.Checked;

                int    p_User_Id_Expense_Owner         = int.Parse(this.hidden_User_Id_Expense_Owner.Value);
                string p_Original_File_Name            = "";
                byte[] p_File_Content_To_Save_In_Azure = new byte[0];
                if (this.fileUpload_Expense_File.HasFile)
                {
                    p_Original_File_Name            = this.fileUpload_Expense_File.FileName;
                    p_File_Content_To_Save_In_Azure = this.fileUpload_Expense_File.FileBytes;
                }

                try
                {
                    l_Expense_Successfully_Updated = Business_Logic_Layer_Facade.Instance.Expenses_Update_Expense_Details(
                        p_Expense_Record_Id, p_Supplier_Id, p_Expense_Invoice_DateTime, p_Currency_Id, p_Total_Amount, p_Vat_Percentage,
                        p_Total_Without_Vat, p_Total_Vat, p_Invoiced_Client_On_User_Location_Id, p_Invoiced_Client_To_CompanyName,
                        p_Invoiced_Client_To_Tax_Reference, p_Invoiced_Client_To_PersonName, p_Invoiced_Client_To_PhoneNumber, p_Invoiced_Client_To_Country_Id,
                        p_Invoiced_Client_To_State_Id, p_Invoiced_Client_To_City, p_Invoiced_Client_To_Address, p_Invoiced_Client_To_Zip,
                        p_Invoiced_Client_To_EmailAddress, p_Expense_Type_Id, p_Invoice_Number, p_Invoice_Reference_Number,
                        p_Invoice_Supplier_Company_Details, p_Invoice_Supplier_Tax_Reference, p_Invoice_Supplier_Country_Id,
                        p_Invoice_Supplier_State_Id, p_Invoice_Supplier_City, p_Invoice_Supplier_Address_Description,
                        p_Invoice_Supplier_ZipCode, p_Invoice_Supplier_WebAddress, p_Invoice_Supplier_Phone_Number,
                        p_Invoice_Supplier_Contact_FullName, p_Invoice_Content_Long_Description, p_User_Description,
                        p_User_Comments,
                        p_User_Id_Expense_Owner, p_Original_File_Name, p_File_Content_To_Save_In_Azure,
                        p_Is_Visible_To_Anonymous_Users, p_Is_Available_For_Download_For_Anonymous_Users,
                        p_Is_Visible_To_Followers_Users, p_Is_Available_For_Download_For_Followers_Users,
                        p_User_Id, base.Authenticated_Permission_Type, p_Is_Active
                        );
                }
                catch (Exception exc)
                {
                    exception_During_Process = exc.Message;
                    if (exc.InnerException != null)
                    {
                        exception_During_Process_Extra_Data = exc.InnerException.Message;
                    }
                }

                if (l_Expense_Successfully_Updated)
                {
                    // The client details were successfully updated.
                    // redirect the user to view read only mode
                    Response.Redirect("manage_Expense.aspx?id=" + Request.QueryString["id"] + "&mode=view");
                }
                else
                {
                    // show error message to the user for the failed process
                    this.lbl_Insert_Process_Error_Result.Text = exception_During_Process;
                    if (!string.IsNullOrEmpty(exception_During_Process_Extra_Data))
                    {
                        this.lbl_Insert_Process_Error_Result.Text += " (" + exception_During_Process_Extra_Data + ")";
                    }
                }
            }
        }
コード例 #2
0
        protected void button_Create_Expense_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                bool l_Expense_Successfully_Created = false;
                int  l_New_Expense_Id = 0;

                string exception_During_Process            = "";
                string exception_During_Process_Extra_Data = "";

                int p_User_Id     = int.Parse(this.dropdown_User_Selection.SelectedValue);
                int p_Supplier_Id = int.Parse(this.dropdown_Supplier.SelectedValue);

                DateTime?p_Expense_Invoice_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                    this.textbox_Expense_Invoice_DateTime,
                    this.dropdown_Invoice_Time_Hours,
                    this.dropdown_Invoice_Time_Minutes,
                    this.dropdown_Invoice_Time_Seconds);

                byte    p_Currency_Id       = byte.Parse(this.dropdown_Currency.SelectedValue);
                decimal p_Total_Amount      = decimal.Parse(this.textbox_Total_Amount.Text);
                decimal p_Vat_Percentage    = decimal.Parse(this.textbox_Vat_Percentage.Text);
                decimal p_Total_Without_Vat = decimal.Parse(this.textbox_Total_Without_Vat.Text);
                decimal p_Total_Vat         = decimal.Parse(this.textbox_Total_Vat.Text);

                int?p_Invoiced_Client_On_User_Location_Id = new int?();

                string p_Invoiced_Client_To_CompanyName   = this.textbox_Invoiced_To_CompanyName.Text;
                string p_Invoiced_Client_To_Tax_Reference = this.textbox_Invoiced_Client_To_Tax_Reference.Text;
                string p_Invoiced_Client_To_PersonName    = this.textbox_Invoiced_To_PersonName.Text;
                string p_Invoiced_Client_To_PhoneNumber   = this.textbox_Invoiced_Client_To_PhoneNumber.Text;

                short?p_Invoiced_Client_To_Country_Id = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Invoiced_Client_To_Country.SelectedValue))
                {
                    p_Invoiced_Client_To_Country_Id = short.Parse(this.dropdown_Invoiced_Client_To_Country.SelectedValue);
                }
                short?p_Invoiced_Client_To_State_Id = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Invoiced_Client_To_State.SelectedValue))
                {
                    p_Invoiced_Client_To_State_Id = short.Parse(this.dropdown_Invoiced_Client_To_State.SelectedValue);
                }

                string p_Invoiced_Client_To_City         = this.textbox_Invoiced_Client_To_City.Text;
                string p_Invoiced_Client_To_Address      = this.textbox_Invoiced_Client_To_Address.Text;
                string p_Invoiced_Client_To_Zip          = this.textbox_Invoiced_Client_To_Zip.Text;
                string p_Invoiced_Client_To_EmailAddress = this.textbox_Invoiced_Client_To_EmailAddress.Text;

                byte   p_Expense_Type_Id          = byte.Parse(this.dropdown_Expense_Type.SelectedValue);
                string p_Invoice_Number           = this.textbox_Invoice_Number.Text;
                string p_Invoice_Reference_Number = this.textbox_Invoice_Reference_Number.Text;

                string p_Invoice_Supplier_Company_Details = this.textbox_Invoice_Supplier_Company_Details.Text;
                string p_Invoice_Supplier_Tax_Reference   = this.textbox_Invoice_Supplier_Tax_Reference.Text;

                short?p_Invoice_Supplier_Country_Id = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Invoiced_Client_To_Country.SelectedValue))
                {
                    p_Invoice_Supplier_Country_Id = short.Parse(this.dropdown_Invoice_Supplier_Country.SelectedValue);
                }
                short?p_Invoice_Supplier_State_Id = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Invoice_Supplier_State.SelectedValue))
                {
                    p_Invoice_Supplier_State_Id = short.Parse(this.dropdown_Invoice_Supplier_State.SelectedValue);
                }

                string p_Invoice_Supplier_City = this.textbox_Invoice_Supplier_City.Text;
                string p_Invoice_Supplier_Address_Description = this.textbox_Invoice_Supplier_Address_Description.Text;
                string p_Invoice_Supplier_ZipCode             = this.textbox_Invoice_Supplier_ZipCode.Text;
                string p_Invoice_Supplier_WebAddress          = this.textbox_Invoice_Supplier_WebAddress.Text;

                string p_Invoice_Supplier_Phone_Number     = this.textbox_Invoice_Supplier_Phone_Number.Text;
                string p_Invoice_Supplier_Contact_FullName = this.textbox_Invoice_Supplier_Contact_FullName.Text;

                string p_Invoice_Content_Long_Description = this.textbox_Invoice_Content_Long_Description.Text;
                string p_User_Description = this.textbox_User_Description.Text;
                string p_User_Comments    = this.textbox_User_Description.Text;

                string p_Original_File_Name            = "";
                byte[] p_File_Content_To_Save_In_Azure = new byte[0];
                if (this.fileUpload_Expense_File.HasFile)
                {
                    p_Original_File_Name            = this.fileUpload_Expense_File.FileName;
                    p_File_Content_To_Save_In_Azure = this.fileUpload_Expense_File.FileBytes;
                }

                bool p_Is_Visible_To_Anonymous_Users = this.checkbox_Is_Visible_To_Anonymous_Users.Checked;
                bool p_Is_Available_For_Download_For_Anonymous_Users = this.checkbox_Is_Available_For_Download_For_Anonymous_Users.Checked;
                bool p_Is_Visible_To_Followers_Users = this.checkbox_Is_Visible_To_Followers_Users.Checked;
                bool p_Is_Available_For_Download_For_Followers_Users = this.checkbox_Is_Available_For_Download_For_Followers_Users.Checked;

                int      p_Record_Created_By_User_Id        = base.Authenticated_User_ID;
                DateTime p_Record_Creation_DateTime_UTC     = DateTime.UtcNow;
                int      p_Record_Last_Updated_By_User_Id   = base.Authenticated_User_ID;
                DateTime p_Record_Last_Updated_DateTime_UTC = DateTime.UtcNow;
                bool     p_Is_Active = this.checkbox_Is_Active.Checked;

                TimeLineDashboard.Shared.Models.Expenses new_Expense_Details = null;

                try
                {
                    new_Expense_Details = Business_Logic_Layer_Facade.Instance.Expenses_Insert_New_Expense(
                        p_User_Id, p_Supplier_Id, p_Expense_Invoice_DateTime, p_Currency_Id, p_Total_Amount, p_Vat_Percentage,
                        p_Total_Without_Vat, p_Total_Vat, p_Invoiced_Client_On_User_Location_Id, p_Invoiced_Client_To_CompanyName,
                        p_Invoiced_Client_To_Tax_Reference, p_Invoiced_Client_To_PersonName, p_Invoiced_Client_To_PhoneNumber, p_Invoiced_Client_To_Country_Id,
                        p_Invoiced_Client_To_State_Id, p_Invoiced_Client_To_City, p_Invoiced_Client_To_Address, p_Invoiced_Client_To_Zip,
                        p_Invoiced_Client_To_EmailAddress, p_Expense_Type_Id, p_Invoice_Number, p_Invoice_Reference_Number,
                        p_Invoice_Supplier_Company_Details, p_Invoice_Supplier_Tax_Reference, p_Invoice_Supplier_Country_Id,
                        p_Invoice_Supplier_State_Id, p_Invoice_Supplier_City, p_Invoice_Supplier_Address_Description,
                        p_Invoice_Supplier_ZipCode, p_Invoice_Supplier_WebAddress, p_Invoice_Supplier_Phone_Number,
                        p_Invoice_Supplier_Contact_FullName, p_Invoice_Content_Long_Description, p_User_Description,
                        p_User_Comments, p_Original_File_Name, p_File_Content_To_Save_In_Azure,
                        p_Is_Visible_To_Anonymous_Users, p_Is_Available_For_Download_For_Anonymous_Users,
                        p_Is_Visible_To_Followers_Users, p_Is_Available_For_Download_For_Followers_Users,
                        p_Record_Created_By_User_Id, base.Authenticated_Permission_Type,
                        p_Is_Active
                        );

                    l_New_Expense_Id = new_Expense_Details.Expense_Record_Id;
                    l_Expense_Successfully_Created = true;
                }
                catch (Exception exc)
                {
                    exception_During_Process = exc.Message;
                    if (exc.InnerException != null)
                    {
                        exception_During_Process_Extra_Data = exc.InnerException.Message;
                    }
                }

                if (l_Expense_Successfully_Created && l_New_Expense_Id > 0)
                {
                    // The user details was successfully created..
                    // Show success message and redirect the user to view page or back to users page (depends on where the user came from)
                    Response.Redirect("list_Expenses.aspx");
                }
                else
                {
                    // show error message to the user for the failed process
                    this.lbl_Insert_Process_Error_Result.Text = exception_During_Process;
                    if (!string.IsNullOrEmpty(exception_During_Process_Extra_Data))
                    {
                        this.lbl_Insert_Process_Error_Result.Text += " (" + exception_During_Process_Extra_Data + ")";
                    }
                }
            }
        }
コード例 #3
0
        protected void button_Update_User_Details_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                bool l_User_Successfully_Updated = false;

                string exception_During_Process            = "";
                string exception_During_Process_Extra_Data = "";

                int p_User_Id = int.Parse(this.Request.QueryString["id"]);

                string p_Username    = this.textbox_Username.Text;
                string p_First_Name  = this.textbox_First_Name.Text;
                string p_Middle_Name = this.textbox_Middle_Name.Text;
                string p_Last_Name   = this.textbox_Last_Name.Text;

                string p_Email = this.textbox_Email.Text;

                short p_Country_Id = short.Parse(this.dropdown_Country.SelectedValue);
                short?p_State_Id   = new short?();
                if (this.dropdown_State.Items.Count > 0)
                {
                    p_State_Id = short.Parse(this.dropdown_State.SelectedValue);
                }

                string p_City    = this.textbox_City.Text;
                string p_Address = this.textbox_Address.Text;
                string p_ZipCode = this.textbox_Zipcode.Text;

                byte?p_Default_Currency_Id = new byte?();
                if (!string.IsNullOrEmpty(this.dropdown_Currency.SelectedValue))
                {
                    p_Default_Currency_Id = byte.Parse(this.dropdown_Currency.SelectedValue);
                }

                string p_Mobile_Phone            = this.textbox_Mobile_Phone.Text;
                string p_Additional_Phone_Number = this.textbox_Additional_Phone_Number.Text;

                DateTime?p_Birth_Date = new DateTime?();
                if (!string.IsNullOrEmpty(this.textbox_Birth_Date.Text))
                {
                    p_Birth_Date = Common_Tools.Try_Parse_DateTime_By_Current_Culture(this.textbox_Birth_Date.Text);
                }

                byte?p_Gender = new byte?();
                if (!string.IsNullOrWhiteSpace(this.dropdown_Gender.SelectedValue))
                {
                    p_Gender = byte.Parse(this.dropdown_Gender.SelectedValue);
                }

                DateTime?p_Registration_Date = new DateTime?();
                if (!string.IsNullOrEmpty(this.textbox_Registration_DateTime.Text))
                {
                    p_Registration_Date = Common_Tools.Get_DateTime_From_ComboBoxes(
                        this.textbox_Registration_DateTime,
                        this.dropdown_Registration_Time_Hours,
                        this.dropdown_Registration_Time_Minutes,
                        this.dropdown_Registration_Time_Seconds);
                }

                string p_Azure_Container_Ref           = this.textbox_Azure_Container_Ref.Text;
                string p_Heard_About_Application_From  = this.textbox_Heard_About_Application_From.Text;
                string p_Our_Administrative_Side_Notes = this.textbox_Our_Administrative_Side_Notes.Text;

                bool p_Is_Active             = this.checkbox_Is_Active.Checked;
                int  p_Authenticated_User_ID = base.Authenticated_User_ID;

                try
                {
                    l_User_Successfully_Updated = Business_Logic_Layer_Facade.Instance.Users_Update_User_Details(
                        p_User_Id,
                        p_Username,
                        p_First_Name,
                        p_Middle_Name,
                        p_Last_Name,
                        p_Email,
                        p_Country_Id,
                        p_State_Id,
                        p_City,
                        p_Address,
                        p_ZipCode,
                        p_Default_Currency_Id,
                        p_Mobile_Phone,
                        p_Additional_Phone_Number,
                        p_Birth_Date,
                        p_Gender,
                        p_Registration_Date,
                        p_Azure_Container_Ref,
                        p_Heard_About_Application_From,
                        p_Our_Administrative_Side_Notes,
                        p_Is_Active,
                        p_Authenticated_User_ID,
                        this.Authenticated_Permission_Type);
                }
                catch (Exception exc)
                {
                    exception_During_Process = exc.Message;
                    if (exc.InnerException != null)
                    {
                        exception_During_Process_Extra_Data = exc.InnerException.Message;
                    }
                }

                if (l_User_Successfully_Updated)
                {
                    // The user details were successfully updated.
                    // redirect the user to view read only mode
                    Response.Redirect("manage_User.aspx?id=" + Request.QueryString["id"] + "&mode=view");
                }
                else
                {
                    // show error message to the user for the failed process
                    this.lbl_Insert_Process_Error_Result.Text = exception_During_Process;
                    if (!string.IsNullOrEmpty(exception_During_Process_Extra_Data))
                    {
                        this.lbl_Insert_Process_Error_Result.Text += " (" + exception_During_Process_Extra_Data + ")";
                    }
                }
            }
        }
コード例 #4
0
        protected void button_Create_Document_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                bool l_Document_Successfully_Created = false;
                int  l_New_Document_Id = 0;

                string exception_During_Process            = "";
                string exception_During_Process_Extra_Data = "";

                int   p_User_Id = int.Parse(this.dropdown_User_Selection.SelectedValue);
                short p_General_Document_Type_Id = short.Parse(this.dropdown_General_Document_Type.SelectedValue);

                DateTime?p_Document_Creation_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                    this.textbox_Document_Creation_Date,
                    this.dropdown_Document_Creation_Time_Hours,
                    this.dropdown_Document_Creation_Time_Minutes,
                    this.dropdown_Document_Creation_Time_Seconds);

                string p_Title       = this.textbox_Title.Text;
                string p_Description = this.textbox_Description.Text;

                string p_Sent_By_Entity_Name       = this.textbox_Sent_By_Entity_Name.Text;
                short? p_Sent_By_Entity_Country_Id = new short?();
                short? p_Sent_By_Entity_State_Id   = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Sent_By_Entity_Country.SelectedValue))
                {
                    p_Sent_By_Entity_Country_Id = short.Parse(this.dropdown_Sent_By_Entity_Country.SelectedValue);
                    if (!string.IsNullOrEmpty(this.dropdown_Sent_By_Entity_State.SelectedValue))
                    {
                        p_Sent_By_Entity_State_Id = short.Parse(this.dropdown_Sent_By_Entity_State.SelectedValue);
                    }
                }

                string   p_Sent_By_Entity_City     = this.textbox_Sent_By_Entity_City.Text;
                string   p_Sent_By_Entity_Address  = this.textbox_Sent_By_Entity_Address.Text;
                string   p_Sent_By_Entity_ZipCode  = this.textbox_Sent_By_Entity_ZipCode.Text;
                DateTime?p_Sent_By_Entity_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                    this.textbox_Sent_By_Entity_DateTime,
                    this.dropdown_Sent_By_Entity_Time_Hours,
                    this.dropdown_Sent_By_Entity_Time_Minutes,
                    this.dropdown_Sent_By_Entity_Time_Seconds);

                string p_Sent_By_Entity_Email_Address = this.textbox_Sent_By_Entity_Email_Address.Text;

                string p_Sent_To_Entity_Name       = this.textbox_Sent_To_Entity_Name.Text;
                short? p_Sent_To_Entity_Country_Id = new short?();
                short? p_Sent_To_Entity_State_Id   = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Sent_To_Entity_Country.SelectedValue))
                {
                    p_Sent_To_Entity_Country_Id = short.Parse(this.dropdown_Sent_To_Entity_Country.SelectedValue);
                    if (!string.IsNullOrEmpty(this.dropdown_Sent_By_Entity_State.SelectedValue))
                    {
                        p_Sent_To_Entity_State_Id = short.Parse(this.dropdown_Sent_By_Entity_State.SelectedValue);
                    }
                }

                string p_Sent_To_Entity_City          = this.textbox_Sent_To_Entity_City.Text;
                string p_Sent_To_Entity_Address       = this.textbox_Sent_To_Entity_Address.Text;
                string p_Sent_To_Entity_ZipCode       = this.textbox_Sent_To_Entity_ZipCode.Text;
                string p_Sent_To_Entity_Email_Address = this.textbox_Sent_To_Entity_Email_Address.Text;

                DateTime?p_Recieved_Document_DateTime = new DateTime?();
                p_Recieved_Document_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                    this.textbox_Recieved_Document_DateTime,
                    this.dropdown_Recieved_Document_Time_Hours,
                    this.dropdown_Recieved_Document_Time_Minutes,
                    this.dropdown_Recieved_Document_Time_Seconds);


                short?p_Recieved_In_Country_Id = new short?();
                short?p_Recieved_In_State_Id   = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Recieved_In_Country.SelectedValue))
                {
                    p_Recieved_In_Country_Id = short.Parse(this.dropdown_Recieved_In_Country.SelectedValue);
                    if (!string.IsNullOrEmpty(this.dropdown_Recieved_In_State.SelectedValue))
                    {
                        p_Recieved_In_State_Id = short.Parse(this.dropdown_Recieved_In_State.SelectedValue);
                    }
                }

                string p_Recieved_In_City          = this.textbox_Recieved_In_City.Text;
                string p_Recieved_In_Address       = this.textbox_Recieved_In_Address.Text;
                string p_Recieved_In_ZipCode       = this.textbox_Recieved_In_ZipCode.Text;
                string p_Recieved_In_Email_Address = this.textbox_Recieved_In_Email_Address.Text;

                string p_User_Comments       = this.textbox_User_Comments.Text;
                int?   p_Recieved_By_User_Id = new int?();
                if (!string.IsNullOrEmpty(this.dropdown_Recieved_By_User.SelectedValue))
                {
                    p_Recieved_By_User_Id = int.Parse(this.dropdown_Recieved_By_User.SelectedValue);
                }
                DateTime?p_Recieved_DateTime = new DateTime?();
                if (!string.IsNullOrEmpty(this.textbox_Recieved_DateTime.Text))
                {
                    p_Recieved_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                        this.textbox_Recieved_DateTime,
                        this.dropdown_Recieved_Time_Hours,
                        this.dropdown_Recieved_Time_Minutes,
                        this.dropdown_Recieved_Time_Seconds);
                }

                string p_Original_File_Name         = this.textbox_Original_File_Name.Text;
                string p_Azure_Block_Blob_Reference = "N/A";

                bool p_Is_Visible_To_Anonymous_Users = this.checkbox_Is_Visible_To_Anonymous_Users.Checked;
                bool p_Is_Available_For_Download_For_Anonymous_Users = this.checkbox_Is_Available_For_Download_For_Anonymous_Users.Checked;
                bool p_Is_Visible_To_Followers_Users = this.checkbox_Is_Visible_To_Followers_Users.Checked;
                bool p_Is_Available_For_Download_For_Followers_Users = this.checkbox_Is_Available_For_Download_For_Followers_Users.Checked;

                int      p_Record_Created_By_User_Id        = base.Authenticated_User_ID;
                DateTime p_Record_Creation_DateTime_UTC     = DateTime.UtcNow;
                int      p_Record_Last_Updated_By_User_Id   = base.Authenticated_User_ID;
                DateTime p_Record_Last_Updated_DateTime_UTC = DateTime.UtcNow;
                bool     p_Is_Active = this.checkbox_Is_Active.Checked;

                TimeLineDashboard.Shared.Models.General_Documents new_General_Document_Details = null;

                try
                {
                    new_General_Document_Details = Business_Logic_Layer_Facade.Instance.GeneralDocuments_Insert_New_General_Document_Details(
                        p_User_Id, p_General_Document_Type_Id, p_Title,
                        p_Description, p_Document_Creation_DateTime,

                        p_Sent_By_Entity_Name, p_Sent_By_Entity_Country_Id,
                        p_Sent_By_Entity_State_Id, p_Sent_By_Entity_City,
                        p_Sent_By_Entity_Address, p_Sent_By_Entity_ZipCode,
                        p_Sent_By_Entity_DateTime, p_Sent_By_Entity_Email_Address,

                        p_Sent_To_Entity_Name, p_Sent_To_Entity_Country_Id,
                        p_Sent_To_Entity_State_Id, p_Sent_To_Entity_City,
                        p_Sent_To_Entity_Address, p_Sent_To_Entity_ZipCode,
                        p_Sent_To_Entity_Email_Address,

                        p_Recieved_Document_DateTime,
                        p_Recieved_In_Country_Id, p_Recieved_In_State_Id,
                        p_Recieved_In_City, p_Recieved_In_Address,
                        p_Recieved_In_ZipCode, p_Recieved_In_Email_Address,

                        p_User_Comments, p_Recieved_By_User_Id, p_Recieved_DateTime,
                        p_Original_File_Name, p_Azure_Block_Blob_Reference,
                        p_Is_Visible_To_Anonymous_Users, p_Is_Available_For_Download_For_Anonymous_Users,
                        p_Is_Visible_To_Followers_Users, p_Is_Available_For_Download_For_Followers_Users,
                        p_Record_Created_By_User_Id, p_Record_Creation_DateTime_UTC,
                        p_Record_Last_Updated_By_User_Id, p_Record_Last_Updated_DateTime_UTC,
                        p_Is_Active
                        );

                    l_New_Document_Id = new_General_Document_Details.General_Document_Id;
                    l_Document_Successfully_Created = true;
                }
                catch (Exception exc)
                {
                    exception_During_Process = exc.Message;
                    if (exc.InnerException != null)
                    {
                        exception_During_Process_Extra_Data = exc.InnerException.Message;
                    }
                }

                if (l_Document_Successfully_Created && l_New_Document_Id > 0)
                {
                    // The user details was successfully created..
                    // Show success message and redirect the user to view page or back to users page (depends on where the user came from)
                    Response.Redirect("list_Documents.aspx");
                }
                else
                {
                    // show error message to the user for the failed process
                    this.lbl_Insert_Process_Error_Result.Text = exception_During_Process;
                    if (!string.IsNullOrEmpty(exception_During_Process_Extra_Data))
                    {
                        this.lbl_Insert_Process_Error_Result.Text += " (" + exception_During_Process_Extra_Data + ")";
                    }
                }
            }
        }
コード例 #5
0
        protected void button_Update_Document_Details_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                bool l_Document_Successfully_Updated = false;

                string exception_During_Process            = "";
                string exception_During_Process_Extra_Data = "";

                int   p_General_Document_Id      = int.Parse(this.Request.QueryString["id"]);
                short p_General_Document_Type_Id = short.Parse(this.dropdown_General_Document_Type.SelectedValue);

                DateTime?p_Document_Creation_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                    this.textbox_Document_Creation_Date,
                    this.dropdown_Document_Creation_Time_Hours,
                    this.dropdown_Document_Creation_Time_Minutes,
                    this.dropdown_Document_Creation_Time_Seconds);

                string p_Title       = this.textbox_Title.Text;
                string p_Description = this.textbox_Description.Text;

                string p_Sent_By_Entity_Name       = this.textbox_Sent_By_Entity_Name.Text;
                short? p_Sent_By_Entity_Country_Id = new short?();
                short? p_Sent_By_Entity_State_Id   = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Sent_By_Entity_Country.SelectedValue))
                {
                    p_Sent_By_Entity_Country_Id = short.Parse(this.dropdown_Sent_By_Entity_Country.SelectedValue);
                    if (!string.IsNullOrEmpty(this.dropdown_Sent_By_Entity_State.SelectedValue))
                    {
                        p_Sent_By_Entity_State_Id = short.Parse(this.dropdown_Sent_By_Entity_State.SelectedValue);
                    }
                }

                string   p_Sent_By_Entity_City     = this.textbox_Sent_By_Entity_City.Text;
                string   p_Sent_By_Entity_Address  = this.textbox_Sent_By_Entity_Address.Text;
                string   p_Sent_By_Entity_ZipCode  = this.textbox_Sent_By_Entity_ZipCode.Text;
                DateTime?p_Sent_By_Entity_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                    this.textbox_Sent_By_Entity_DateTime,
                    this.dropdown_Sent_By_Entity_Time_Hours,
                    this.dropdown_Sent_By_Entity_Time_Minutes,
                    this.dropdown_Sent_By_Entity_Time_Seconds);

                string p_Sent_By_Entity_Email_Address = this.textbox_Sent_By_Entity_Email_Address.Text;

                string p_Sent_To_Entity_Name       = this.textbox_Sent_To_Entity_Name.Text;
                short? p_Sent_To_Entity_Country_Id = new short?();
                short? p_Sent_To_Entity_State_Id   = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Sent_To_Entity_Country.SelectedValue))
                {
                    p_Sent_To_Entity_Country_Id = short.Parse(this.dropdown_Sent_To_Entity_Country.SelectedValue);
                    if (!string.IsNullOrEmpty(this.dropdown_Sent_By_Entity_State.SelectedValue))
                    {
                        p_Sent_To_Entity_State_Id = short.Parse(this.dropdown_Sent_By_Entity_State.SelectedValue);
                    }
                }

                string p_Sent_To_Entity_City          = this.textbox_Sent_To_Entity_City.Text;
                string p_Sent_To_Entity_Address       = this.textbox_Sent_To_Entity_Address.Text;
                string p_Sent_To_Entity_ZipCode       = this.textbox_Sent_To_Entity_ZipCode.Text;
                string p_Sent_To_Entity_Email_Address = this.textbox_Sent_To_Entity_Email_Address.Text;

                DateTime?p_Recieved_Document_DateTime = new DateTime?();
                p_Recieved_Document_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                    this.textbox_Recieved_Document_DateTime,
                    this.dropdown_Recieved_Document_Time_Hours,
                    this.dropdown_Recieved_Document_Time_Minutes,
                    this.dropdown_Recieved_Document_Time_Seconds);


                short?p_Recieved_In_Country_Id = new short?();
                short?p_Recieved_In_State_Id   = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Recieved_In_Country.SelectedValue))
                {
                    p_Recieved_In_Country_Id = short.Parse(this.dropdown_Recieved_In_Country.SelectedValue);
                    if (!string.IsNullOrEmpty(this.dropdown_Recieved_In_State.SelectedValue))
                    {
                        p_Recieved_In_State_Id = short.Parse(this.dropdown_Recieved_In_State.SelectedValue);
                    }
                }

                string p_Recieved_In_City          = this.textbox_Recieved_In_City.Text;
                string p_Recieved_In_Address       = this.textbox_Recieved_In_Address.Text;
                string p_Recieved_In_ZipCode       = this.textbox_Recieved_In_ZipCode.Text;
                string p_Recieved_In_Email_Address = this.textbox_Recieved_In_Email_Address.Text;

                string p_User_Comments       = this.textbox_User_Comments.Text;
                int?   p_Recieved_By_User_Id = new int?();
                if (!string.IsNullOrEmpty(this.dropdown_Recieved_By_User.SelectedValue))
                {
                    p_Recieved_By_User_Id = int.Parse(this.dropdown_Recieved_By_User.SelectedValue);
                }
                DateTime?p_Recieved_DateTime = new DateTime?();
                if (!string.IsNullOrEmpty(this.textbox_Recieved_DateTime.Text))
                {
                    p_Recieved_DateTime = Common_Tools.Get_DateTime_From_ComboBoxes(
                        this.textbox_Recieved_DateTime,
                        this.dropdown_Recieved_Time_Hours,
                        this.dropdown_Recieved_Time_Minutes,
                        this.dropdown_Recieved_Time_Seconds);
                }

                bool p_Is_Visible_To_Anonymous_Users = this.checkbox_Is_Visible_To_Anonymous_Users.Checked;
                bool p_Is_Available_For_Download_For_Anonymous_Users = this.checkbox_Is_Available_For_Download_For_Anonymous_Users.Checked;
                bool p_Is_Visible_To_Followers_Users = this.checkbox_Is_Visible_To_Followers_Users.Checked;
                bool p_Is_Available_For_Download_For_Followers_Users = this.checkbox_Is_Available_For_Download_For_Followers_Users.Checked;


                bool p_Is_Active        = this.checkbox_Is_Active.Checked;
                int  p_Updating_User_Id = base.Authenticated_User_ID;

                try
                {
                    l_Document_Successfully_Updated = Business_Logic_Layer_Facade.Instance.GeneralDocuments_Update_Document_Details(
                        p_General_Document_Id, p_General_Document_Type_Id, p_Title,
                        p_Description, p_Document_Creation_DateTime,

                        p_Sent_By_Entity_Name, p_Sent_By_Entity_Country_Id,
                        p_Sent_By_Entity_State_Id, p_Sent_By_Entity_City,
                        p_Sent_By_Entity_Address, p_Sent_By_Entity_ZipCode,
                        p_Sent_By_Entity_DateTime, p_Sent_By_Entity_Email_Address,

                        p_Sent_To_Entity_Name, p_Sent_To_Entity_Country_Id,
                        p_Sent_To_Entity_State_Id, p_Sent_To_Entity_City,
                        p_Sent_To_Entity_Address, p_Sent_To_Entity_ZipCode,
                        p_Sent_To_Entity_Email_Address,

                        p_Recieved_Document_DateTime,
                        p_Recieved_In_Country_Id, p_Recieved_In_State_Id,
                        p_Recieved_In_City, p_Recieved_In_Address,
                        p_Recieved_In_ZipCode, p_Recieved_In_Email_Address,

                        p_User_Comments, p_Recieved_By_User_Id, p_Recieved_DateTime,

                        p_Is_Visible_To_Anonymous_Users, p_Is_Available_For_Download_For_Anonymous_Users,
                        p_Is_Visible_To_Followers_Users, p_Is_Available_For_Download_For_Followers_Users,

                        p_Is_Active, p_Updating_User_Id);
                }
                catch (Exception exc)
                {
                    l_Document_Successfully_Updated = false;
                    exception_During_Process        = exc.Message;
                    if (exc.InnerException != null)
                    {
                        exception_During_Process_Extra_Data = exc.InnerException.Message;
                    }
                }

                if (l_Document_Successfully_Updated)
                {
                    // The client details were successfully updated.
                    // redirect the user to view read only mode
                    Response.Redirect("manage_Document.aspx?id=" + Request.QueryString["id"] + "&mode=view");
                }
                else
                {
                    // show error message to the user for the failed process
                    this.lbl_Insert_Process_Error_Result.Text = exception_During_Process;
                    if (!string.IsNullOrEmpty(exception_During_Process_Extra_Data))
                    {
                        this.lbl_Insert_Process_Error_Result.Text += " (" + exception_During_Process_Extra_Data + ")";
                    }
                }
            }
        }