internal Bank_Accounts Get_Bank_Account_Details_By_Bank_Account_Id(int p_Bank_Account_Id, int p_User_Id_Bank_Account_Owner)
        {
            Bank_Accounts Bank_Account_To_Return = new Bank_Accounts();

            SqlParameter spBank_Account_Id = new SqlParameter("@Bank_Account_Id", SqlDbType.Int);
            SqlParameter spUser_Id         = new SqlParameter("@User_Id", SqlDbType.Int);

            spBank_Account_Id.Value = p_Bank_Account_Id;
            spUser_Id.Value         = p_User_Id_Bank_Account_Owner;

            var dataSet = SQLHelper.SelectUsingStoredProcedure_WithDefaultAppConfigConnectionString("p_TLBoard_Get_Bank_Account_Details",
                                                                                                    new List <SqlParameter>()
            {
                spBank_Account_Id, spUser_Id
            });

            if (dataSet != null && dataSet.Tables[0].Rows.Count > 0)
            {
                Bank_Account_To_Return = Create_Bank_Account_Details_From_Data_Row(dataSet.Tables[0].Rows[0]);
            }

            return(Bank_Account_To_Return);
        }
Esempio n. 2
0
        protected void button_Create_Bank_Account_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                bool l_Bank_Account_Successfully_Created = false;
                int  l_New_Bank_Account_Id = 0;

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

                int    p_User_Id       = base.Authenticated_User_ID;
                string p_Bank_Name     = this.textbox_Bank_Name.Text;
                string p_Bank_Number   = this.textbox_Bank_Number.Text;
                string p_Branch_Name   = this.textbox_Branch_Name.Text;
                string p_Branch_Number = this.textbox_Branch_Number.Text;

                string p_Account_Number = this.textbox_Account_Number.Text;
                string p_Account_Name   = this.textbox_Account_Name.Text;
                string p_IBAN           = this.textbox_IBAN.Text;

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

                DateTime?p_Opened_Account_DateTime = new DateTime?();
                if (!string.IsNullOrEmpty(this.textbox_Opened_Account_DateTime.Text))
                {
                    bool     parsed_Successfully = false;
                    DateTime date_Parsed         = new DateTime();
                    try
                    {
                        parsed_Successfully = DateTime.TryParseExact(this.textbox_Opened_Account_DateTime.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out date_Parsed);
                    }
                    catch
                    {
                        parsed_Successfully = false;
                    }

                    if (parsed_Successfully)
                    {
                        p_Opened_Account_DateTime = date_Parsed;
                    }
                }

                short?p_Branch_Country_Id = new short?();
                short?p_Branch_State_Id   = new short?();
                if (!string.IsNullOrEmpty(this.dropdown_Branch_Country.SelectedValue))
                {
                    p_Branch_Country_Id = short.Parse(this.dropdown_Branch_Country.SelectedValue);
                    if (!string.IsNullOrEmpty(this.dropdown_Branch_State.SelectedValue))
                    {
                        p_Branch_State_Id = short.Parse(this.dropdown_Branch_State.SelectedValue);
                    }
                }

                string p_Branch_City = this.textbox_Branch_City.Text;
                string p_Branch_Address_Description = this.textbox_Branch_Address.Text;
                string p_Branch_ZipCode             = this.textbox_Branch_Address.Text;
                string p_Branch_Phone = this.textbox_Branch_Phone.Text;
                string p_Branch_Main_Email_Address = this.textbox_Branch_Main_Email_Address.Text;
                string p_Branch_Main_Contact       = this.textbox_Branch_Main_Contact.Text;
                string p_Main_Contact_Phone_Number = this.textbox_Main_Contact_Phone_Number.Text;

                DateTime?p_Account_Active_From_Date = new DateTime?();
                if (!string.IsNullOrEmpty(this.textbox_Account_Active_From_Date.Text))
                {
                    bool     parsed_Successfully = false;
                    DateTime date_Parsed         = new DateTime();
                    try
                    {
                        parsed_Successfully = DateTime.TryParseExact(this.textbox_Account_Active_From_Date.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out date_Parsed);
                    }
                    catch
                    {
                        parsed_Successfully = false;
                    }

                    if (parsed_Successfully)
                    {
                        p_Account_Active_From_Date = date_Parsed;
                    }
                }

                DateTime?p_Account_Active_To_Date = new DateTime?();
                if (!string.IsNullOrEmpty(this.textbox_Account_Active_To_Date.Text))
                {
                    bool     parsed_Successfully = false;
                    DateTime date_Parsed         = new DateTime();
                    try
                    {
                        parsed_Successfully = DateTime.TryParseExact(this.textbox_Account_Active_To_Date.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out date_Parsed);
                    }
                    catch
                    {
                        parsed_Successfully = false;
                    }

                    if (parsed_Successfully)
                    {
                        p_Account_Active_To_Date = date_Parsed;
                    }
                }

                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;

                Bank_Accounts new_Bank_Account_Details = null;

                try
                {
                    new_Bank_Account_Details = Business_Logic_Layer_Facade.Instance.BankAccounts_Insert_New_Bank_Account_Details(
                        p_Bank_Name, p_Bank_Number, p_Branch_Name,
                        p_Branch_Number, p_Account_Number, p_Account_Name,
                        p_IBAN, p_Currency_Id, p_Opened_Account_DateTime,
                        p_Branch_Country_Id, p_Branch_State_Id, p_Branch_City,
                        p_Branch_Address_Description, p_Branch_ZipCode, p_Branch_Phone,
                        p_Branch_Main_Email_Address, p_Branch_Main_Contact, p_Main_Contact_Phone_Number,
                        p_Account_Active_From_Date, p_Account_Active_To_Date,
                        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_User_Id
                        );

                    l_New_Bank_Account_Id = new_Bank_Account_Details.Bank_Account_Id;
                    l_Bank_Account_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_Bank_Account_Successfully_Created && l_New_Bank_Account_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_BankAccounts.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 + ")";
                    }
                }
            }
        }
        private void Set_Page_FormControls_Values()
        {
            int Bank_Account_Id           = int.Parse(this.Request.QueryString["id"]);
            int user_Id_BankAccount_Owner = base.Authenticated_User_ID;

            Bank_Accounts BankAccountDetails = Business_Logic_Layer_Facade.Instance.BankAccounts_Get_Bank_Account_Details(
                Bank_Account_Id, user_Id_BankAccount_Owner);

            if (BankAccountDetails != null)
            {
                this.textbox_Bank_Name.Text = BankAccountDetails.Bank_Name;
                this.label_Bank_Name.Text   = BankAccountDetails.Bank_Name;

                this.textbox_Bank_Number.Text = BankAccountDetails.Bank_Number;
                this.label_Bank_Number.Text   = BankAccountDetails.Bank_Number;

                this.textbox_Branch_Name.Text = BankAccountDetails.Branch_Name;
                this.label_Branch_Name.Text   = BankAccountDetails.Branch_Name;

                this.textbox_Branch_Number.Text = BankAccountDetails.Branch_Number;
                this.label_Branch_Number.Text   = BankAccountDetails.Branch_Number;

                this.textbox_Account_Number.Text = BankAccountDetails.Account_Number;
                this.label_Account_Number.Text   = BankAccountDetails.Account_Number;

                this.textbox_Account_Name.Text = BankAccountDetails.Account_Name;
                this.label_Account_Name.Text   = BankAccountDetails.Account_Name;

                this.textbox_IBAN.Text = BankAccountDetails.IBAN;
                this.label_IBAN.Text   = BankAccountDetails.IBAN;

                this.textbox_IBAN.Text   = BankAccountDetails.IBAN;
                this.label_Currency.Text = BankAccountDetails.IBAN;

                Common_Tools.Set_ComboBox_Selected_Value_And_Label_Text(
                    BankAccountDetails.Currency_Id.ToString(),
                    this.dropdown_Currency,
                    this.label_Currency);

                Common_Tools.Set_DateTime_To_TextBox_And_Label(
                    BankAccountDetails.Opened_Account_DateTime,
                    this.textbox_Opened_Account_DateTime,
                    this.label_Opened_Account_DateTime);

                Common_Tools.Set_ComboBox_Selected_Value_And_Label_Text(
                    BankAccountDetails.Branch_Country_Id.ToString(),
                    this.dropdown_Branch_Country,
                    this.label_Branch_Country);

                this.Bind_States_ComboBox();
                if (BankAccountDetails.Branch_State_Id.HasValue)
                {
                    Common_Tools.Set_ComboBox_Selected_Value_And_Label_Text(
                        BankAccountDetails.Branch_State_Id.ToString(),
                        this.dropdown_Branch_State,
                        this.label_Branch_State);
                }

                this.textbox_Branch_City.Text = BankAccountDetails.Branch_City;
                this.label_Branch_City.Text   = BankAccountDetails.Branch_City;

                this.textbox_Branch_Address.Text = BankAccountDetails.Branch_Address;
                this.label_Branch_Address.Text   = BankAccountDetails.Branch_Address;

                this.textbox_Branch_Zipcode.Text = BankAccountDetails.Branch_Zipcode;
                this.label_Branch_Zipcode.Text   = BankAccountDetails.Branch_Zipcode;

                this.textbox_Branch_Zipcode.Text = BankAccountDetails.Branch_Zipcode;
                this.label_Branch_Zipcode.Text   = BankAccountDetails.Branch_Zipcode;

                this.textbox_Branch_Phone.Text = BankAccountDetails.Branch_Phone;
                this.label_Branch_Phone.Text   = BankAccountDetails.Branch_Phone;

                this.textbox_Branch_Main_Email_Address.Text = BankAccountDetails.Branch_Main_Email_Address;
                this.label_Branch_Main_Email_Address.Text   = BankAccountDetails.Branch_Main_Email_Address;

                this.textbox_Branch_Main_Contact.Text = BankAccountDetails.Branch_Main_Contact;
                this.label_Branch_Main_Contact.Text   = BankAccountDetails.Branch_Main_Contact;

                this.textbox_Main_Contact_Phone_Number.Text = BankAccountDetails.Main_Contact_Phone_Number;
                this.label_Main_Contact_Phone_Number.Text   = BankAccountDetails.Main_Contact_Phone_Number;

                Common_Tools.Set_DateTime_To_TextBox_And_Label(
                    BankAccountDetails.Account_Active_From_Date,
                    this.textbox_Account_Active_From_Date,
                    this.label_Account_Active_From_Date);

                Common_Tools.Set_DateTime_To_TextBox_And_Label(
                    BankAccountDetails.Account_Active_To_Date,
                    this.textbox_Account_Active_To_Date,
                    this.label_Account_Active_To_Date);

                this.checkbox_Is_Visible_To_Anonymous_Users.Checked = BankAccountDetails.Is_Visible_To_Anonymous_Users;
                this.label_Is_Visible_To_Anonymous_Users.Text       = BankAccountDetails.Is_Visible_To_Anonymous_Users ? "Yes" : "No";

                this.checkbox_Is_Available_For_Download_For_Anonymous_Users.Checked = BankAccountDetails.Is_Available_For_Download_For_Anonymous_Users;
                this.label_Is_Available_For_Download_For_Anonymous_Users.Text       = BankAccountDetails.Is_Available_For_Download_For_Anonymous_Users ? "Yes" : "No";

                this.checkbox_Is_Visible_To_Followers_Users.Checked = BankAccountDetails.Is_Visible_To_Followers_Users;
                this.label_Is_Visible_To_Followers_Users.Text       = BankAccountDetails.Is_Visible_To_Followers_Users ? "Yes" : "No";

                this.checkbox_Is_Available_For_Download_For_Followers_Users.Checked = BankAccountDetails.Is_Available_For_Download_For_Followers_Users;
                this.label_Is_Available_For_Download_For_Followers_Users.Text       = BankAccountDetails.Is_Available_For_Download_For_Followers_Users ? "Yes" : "No";

                this.checkbox_Is_Active.Checked = BankAccountDetails.Is_Active;
                this.label_Is_Active.Text       = BankAccountDetails.Is_Active ? "Yes" : "No";

                this.label_Record_Created_By_User.Text           = BankAccountDetails.Record_Created_By_User_Details.FullName_With_Email;
                this.label_Record_Creation_DateTime_UTC.Text     = BankAccountDetails.Record_Creation_DateTime_UTC.ToString("dd/MM/yyyy HH:mm:ss UTC");
                this.label_Record_Last_Updated_By_User.Text      = BankAccountDetails.Record_Last_Updated_By_User_Details.FullName_With_Email.ToString();
                this.label_Record_Last_Updated_DateTime_UTC.Text = BankAccountDetails.Record_Last_Updated_DateTime_UTC.ToString("dd/MM/yyyy HH:mm:ss UTC");
            }
        }
        internal Bank_Accounts Insert_New_Bank_Account_Details(
            string p_Bank_Name, string p_Bank_Number,
            string p_Branch_Name, string p_Branch_Number,
            string p_Account_Number, string p_Account_Name,
            string p_IBAN, byte?p_Currency_Id,
            DateTime?p_Opened_Account_DateTime, short?p_Branch_Country_Id,
            short?p_Branch_State_Id, string p_Branch_City,
            string p_Branch_Address_Description, string p_Branch_ZipCode,
            string p_Branch_Phone, string p_Branch_Main_Email_Address,
            string p_Branch_Main_Contact, string p_Main_Contact_Phone_Number,
            DateTime?p_Account_Active_From_Date, DateTime?p_Account_Active_To_Date,
            bool p_Is_Visible_To_Anonymous_Users, bool p_Is_Available_For_Download_For_Anonymous_Users,
            bool p_Is_Visible_To_Followers_Users, bool p_Is_Available_For_Download_For_Followers_Users,
            bool p_Is_Active,
            int p_Creating_User_Id)
        {
            Bank_Accounts new_Registered_Bank_Account_To_Return = null;

            SqlParameter spBank_Name                     = new SqlParameter("@Bank_Name", SqlDbType.NVarChar, 40);
            SqlParameter spBank_Number                   = new SqlParameter("@Bank_Number", SqlDbType.NVarChar, 10);
            SqlParameter spBranch_Name                   = new SqlParameter("@Branch_Name", SqlDbType.NVarChar, 40);
            SqlParameter spBranch_Number                 = new SqlParameter("@Branch_Number", SqlDbType.NVarChar, 50);
            SqlParameter spAccount_Number                = new SqlParameter("@Account_Number", SqlDbType.NVarChar, 50);
            SqlParameter spAccount_Name                  = new SqlParameter("@Account_Name", SqlDbType.NVarChar, 50);
            SqlParameter spIBAN                          = new SqlParameter("@IBAN", SqlDbType.NVarChar, 50);
            SqlParameter spCurrency_Id                   = new SqlParameter("@Currency_Id", SqlDbType.TinyInt);
            SqlParameter spOpened_Account_DateTime       = new SqlParameter("@Opened_Account_DateTime", SqlDbType.DateTime);
            SqlParameter spBranch_Country_Id             = new SqlParameter("@Branch_Country_Id", SqlDbType.SmallInt);
            SqlParameter spBranch_State_Id               = new SqlParameter("@Branch_State_Id", SqlDbType.SmallInt);
            SqlParameter spBranch_City                   = new SqlParameter("@Branch_City", SqlDbType.NVarChar, 100);
            SqlParameter spBranch_Address_Description    = new SqlParameter("@Branch_Address_Description", SqlDbType.NVarChar, 255);
            SqlParameter spBranch_ZipCode                = new SqlParameter("@Branch_ZipCode", SqlDbType.NVarChar, 20);
            SqlParameter spBranch_Phone                  = new SqlParameter("@Branch_Phone", SqlDbType.NVarChar, 50);
            SqlParameter spBranch_Main_Email_Address     = new SqlParameter("@Branch_Main_Email_Address", SqlDbType.NVarChar, 100);
            SqlParameter spBranch_Main_Contact           = new SqlParameter("@Branch_Main_Contact", SqlDbType.NVarChar, 100);
            SqlParameter spMain_Contact_Phone_Number     = new SqlParameter("@Main_Contact_Phone_Number", SqlDbType.NVarChar, 50);
            SqlParameter spAccount_Active_From_Date      = new SqlParameter("@Account_Active_From_Date", SqlDbType.DateTime);
            SqlParameter spAccount_Active_To_Date        = new SqlParameter("@Account_Active_To_Date", SqlDbType.DateTime);
            SqlParameter spIs_Visible_To_Anonymous_Users = new SqlParameter("@Is_Visible_To_Anonymous_Users", SqlDbType.Bit);
            SqlParameter spIs_Available_For_Download_For_Anonymous_Users = new SqlParameter("@Is_Available_For_Download_For_Anonymous_Users", SqlDbType.Bit);
            SqlParameter spIs_Visible_To_Followers_Users = new SqlParameter("@Is_Visible_To_Followers_Users", SqlDbType.Bit);
            SqlParameter spIs_Available_For_Download_For_Followers_Users = new SqlParameter("@Is_Available_For_Download_For_Followers_Users", SqlDbType.Bit);
            SqlParameter spIs_Active        = new SqlParameter("@Is_Active", SqlDbType.Bit);
            SqlParameter spCreating_User_Id = new SqlParameter("@Creating_User_Id", SqlDbType.Int);

            spBank_Name.Value      = p_Bank_Name;
            spBank_Number.Value    = p_Bank_Number;
            spBranch_Name.Value    = p_Branch_Name;
            spBranch_Number.Value  = p_Branch_Number;
            spAccount_Number.Value = p_Account_Number;
            spAccount_Name.Value   = p_Account_Name;
            spIBAN.Value           = p_IBAN;

            if (p_Currency_Id.HasValue)
            {
                spCurrency_Id.Value = p_Currency_Id;
            }
            else
            {
                spCurrency_Id.Value = DBNull.Value;
            }

            if (p_Opened_Account_DateTime.HasValue)
            {
                spOpened_Account_DateTime.Value = p_Opened_Account_DateTime.Value;
            }
            else
            {
                spOpened_Account_DateTime.Value = DBNull.Value;
            }

            if (p_Branch_Country_Id.HasValue)
            {
                spBranch_Country_Id.Value = p_Branch_Country_Id;
            }
            else
            {
                spBranch_Country_Id.Value = DBNull.Value;
            }

            if (p_Branch_State_Id.HasValue)
            {
                spBranch_State_Id.Value = p_Branch_State_Id.Value;
            }
            else
            {
                spBranch_State_Id.Value = DBNull.Value;
            }

            spBranch_City.Value = p_Branch_City;
            spBranch_Address_Description.Value = p_Branch_Address_Description;
            spBranch_ZipCode.Value             = p_Branch_ZipCode;
            spBranch_Phone.Value = p_Branch_Phone;
            spBranch_Main_Email_Address.Value = p_Branch_Main_Email_Address;
            spBranch_Main_Contact.Value       = p_Branch_Main_Contact;
            spMain_Contact_Phone_Number.Value = p_Main_Contact_Phone_Number;

            if (p_Account_Active_From_Date.HasValue)
            {
                spAccount_Active_From_Date.Value = p_Account_Active_From_Date;
            }
            else
            {
                spAccount_Active_From_Date.Value = DBNull.Value;
            }

            if (p_Account_Active_To_Date.HasValue)
            {
                spAccount_Active_To_Date.Value = p_Account_Active_To_Date;
            }
            else
            {
                spAccount_Active_To_Date.Value = DBNull.Value;
            }

            spIs_Visible_To_Anonymous_Users.Value = p_Is_Visible_To_Anonymous_Users;
            spIs_Available_For_Download_For_Anonymous_Users.Value = p_Is_Available_For_Download_For_Anonymous_Users;
            spIs_Visible_To_Followers_Users.Value = p_Is_Visible_To_Followers_Users;
            spIs_Available_For_Download_For_Followers_Users.Value = p_Is_Available_For_Download_For_Followers_Users;

            spIs_Active.Value        = p_Is_Active;
            spCreating_User_Id.Value = p_Creating_User_Id;

            object new_Bank_Account_Id = SQLHelper.ExecuteStoredProcedure_ReturnDataObjectResult("p_TLBoard_Insert_Bank_Account_Details",
                                                                                                 new List <SqlParameter>()
            {
                spBank_Name,
                spBank_Number,
                spBranch_Name,
                spBranch_Number,
                spAccount_Number,
                spAccount_Name,
                spIBAN,
                spCurrency_Id,
                spOpened_Account_DateTime,
                spBranch_Country_Id,
                spBranch_State_Id,
                spBranch_City,
                spBranch_Address_Description,
                spBranch_ZipCode,
                spBranch_Phone,
                spBranch_Main_Email_Address,
                spBranch_Main_Contact,
                spMain_Contact_Phone_Number,
                spAccount_Active_From_Date,
                spAccount_Active_To_Date,
                spIs_Visible_To_Anonymous_Users,
                spIs_Available_For_Download_For_Anonymous_Users,
                spIs_Visible_To_Followers_Users,
                spIs_Available_For_Download_For_Followers_Users,
                spIs_Active,
                spCreating_User_Id
            });

            if (new_Bank_Account_Id != null)
            {
                int Bank_Account_Id_Registered = Convert.ToInt32(new_Bank_Account_Id);
                if (Bank_Account_Id_Registered > 0)
                {
                    new_Registered_Bank_Account_To_Return = Get_Bank_Account_Details_By_Bank_Account_Id(Bank_Account_Id_Registered, p_Creating_User_Id);
                }
            }

            return(new_Registered_Bank_Account_To_Return);
        }
        private Bank_Accounts Create_Bank_Account_Details_From_Data_Row(DataRow dbRow)
        {
            Bank_Accounts Bank_Account_To_Return = new Bank_Accounts();

            Bank_Account_To_Return.Bank_Account_Id = Convert.ToInt32(dbRow["Bank_Account_Id"]);
            Bank_Account_To_Return.User_Id         = Convert.ToInt32(dbRow["User_Id"]);
            Bank_Account_To_Return.Bank_Name       = dbRow["Bank_Name"].ToString();
            Bank_Account_To_Return.Bank_Number     = dbRow["Bank_Number"].ToString();

            Bank_Account_To_Return.Branch_Name   = dbRow["Branch_Name"].ToString();
            Bank_Account_To_Return.Branch_Number = dbRow["Branch_Number"].ToString();

            Bank_Account_To_Return.Account_Number = dbRow["Account_Number"].ToString();
            Bank_Account_To_Return.Account_Name   = dbRow["Account_Name"].ToString();

            Bank_Account_To_Return.IBAN = dbRow["IBAN"].ToString();

            if (dbRow["Currency_Id"] != DBNull.Value)
            {
                Bank_Account_To_Return.Currency_Id = (byte)dbRow["Currency_Id"];

                if (dbRow.Table.Columns.IndexOf("Currency_Symbol") > -1)
                {
                    Bank_Account_To_Return.Currency_Symbol = dbRow["Currency_Symbol"].ToString();
                }
            }

            if (dbRow.Table.Columns.IndexOf("Latest_Transaction_Actual_DateTime") > -1 &&
                dbRow["Latest_Transaction_Actual_DateTime"] != DBNull.Value)
            {
                Bank_Account_To_Return.Latest_Transaction_Actual_DateTime = (DateTime)dbRow["Latest_Transaction_Actual_DateTime"];
                if (dbRow["Latest_Transaction_Account_Balance"] != DBNull.Value)
                {
                    Bank_Account_To_Return.Latest_Transaction_Account_Balance = (decimal)dbRow["Latest_Transaction_Account_Balance"];
                }
            }

            if (dbRow["Opened_Account_DateTime"] != DBNull.Value)
            {
                Bank_Account_To_Return.Opened_Account_DateTime = (DateTime)dbRow["Opened_Account_DateTime"];
            }

            if (dbRow["Branch_Country_Id"] != DBNull.Value)
            {
                Bank_Account_To_Return.Branch_Country_Id = (short)dbRow["Branch_Country_Id"];
                if (dbRow.Table.Columns.IndexOf("Branch_Country_Name") > -1)
                {
                    Bank_Account_To_Return.Branch_Country_Name = dbRow["Branch_Country_Name"].ToString();
                }

                if (dbRow["Branch_State_Id"] != DBNull.Value)
                {
                    Bank_Account_To_Return.Branch_State_Id = (short)dbRow["Branch_State_Id"];
                }
            }

            Bank_Account_To_Return.Branch_City = dbRow["Branch_City"].ToString();
            if (dbRow.Table.Columns.IndexOf("Branch_Address_Description") > -1)
            {
                Bank_Account_To_Return.Branch_Address = dbRow["Branch_Address_Description"].ToString();
                Bank_Account_To_Return.Branch_Zipcode = dbRow["Branch_ZipCode"].ToString();
            }

            if (dbRow.Table.Columns.IndexOf("Branch_Phone") > -1)
            {
                Bank_Account_To_Return.Branch_Phone = dbRow["Branch_Phone"].ToString();
            }

            if (dbRow.Table.Columns.IndexOf("Branch_Main_Email_Address") > -1)
            {
                Bank_Account_To_Return.Branch_Main_Email_Address = dbRow["Branch_Main_Email_Address"].ToString();
            }

            if (dbRow.Table.Columns.IndexOf("Branch_Main_Contact") > -1)
            {
                Bank_Account_To_Return.Branch_Main_Contact = dbRow["Branch_Main_Contact"].ToString();
            }

            if (dbRow.Table.Columns.IndexOf("Main_Contact_Phone_Number") > -1)
            {
                Bank_Account_To_Return.Main_Contact_Phone_Number = dbRow["Main_Contact_Phone_Number"].ToString();
            }

            if (dbRow.Table.Columns.IndexOf("Account_Active_From_Date") > -1)
            {
                if (dbRow["Account_Active_From_Date"] != DBNull.Value)
                {
                    Bank_Account_To_Return.Account_Active_From_Date = (DateTime)dbRow["Account_Active_From_Date"];
                }

                if (dbRow["Account_Active_To_Date"] != DBNull.Value)
                {
                    Bank_Account_To_Return.Account_Active_To_Date = (DateTime)dbRow["Account_Active_To_Date"];
                }
            }

            Bank_Account_To_Return.Is_Visible_To_Anonymous_Users = (bool)dbRow["Is_Visible_To_Anonymous_Users"];
            Bank_Account_To_Return.Is_Available_For_Download_For_Anonymous_Users = (bool)dbRow["Is_Available_For_Download_For_Anonymous_Users"];
            Bank_Account_To_Return.Is_Visible_To_Followers_Users = (bool)dbRow["Is_Visible_To_Followers_Users"];
            Bank_Account_To_Return.Is_Available_For_Download_For_Followers_Users = (bool)dbRow["Is_Available_For_Download_For_Followers_Users"];

            if (dbRow.Table.Columns.IndexOf("Record_Creation_DateTime_UTC") > -1)
            {
                Bank_Account_To_Return.Record_Created_By_User_Id              = Convert.ToInt32(dbRow["Record_Created_By_User_Id"]);
                Bank_Account_To_Return.Record_Created_By_User_Details         = new Users();
                Bank_Account_To_Return.Record_Created_By_User_Details.User_Id = Bank_Account_To_Return.Record_Created_By_User_Id;
                if (dbRow.Table.Columns.IndexOf("Created_By_First_Name") > -1)
                {
                    Bank_Account_To_Return.Record_Created_By_User_Details.First_Name = dbRow["Created_By_First_Name"].ToString();
                    Bank_Account_To_Return.Record_Created_By_User_Details.Last_Name  = dbRow["Created_By_Last_Name"].ToString();
                }
                Bank_Account_To_Return.Record_Creation_DateTime_UTC = (DateTime)dbRow["Record_Creation_DateTime_UTC"];

                Bank_Account_To_Return.Record_Last_Updated_By_User_Id              = Convert.ToInt32(dbRow["Record_Last_Updated_By_User_Id"]);
                Bank_Account_To_Return.Record_Last_Updated_By_User_Details         = new Users();
                Bank_Account_To_Return.Record_Last_Updated_By_User_Details.User_Id = Bank_Account_To_Return.Record_Last_Updated_By_User_Id;
                if (dbRow.Table.Columns.IndexOf("Last_Updated_By_First_Name") > -1)
                {
                    Bank_Account_To_Return.Record_Last_Updated_By_User_Details.First_Name = dbRow["Last_Updated_By_First_Name"].ToString();
                    Bank_Account_To_Return.Record_Last_Updated_By_User_Details.Last_Name  = dbRow["Last_Updated_By_Last_Name"].ToString();
                }
                Bank_Account_To_Return.Record_Last_Updated_DateTime_UTC = (DateTime)dbRow["Record_Last_Updated_DateTime_UTC"];
            }

            Bank_Account_To_Return.Is_Active  = (bool)dbRow["Is_Active"];
            Bank_Account_To_Return.Is_Deleted = (bool)dbRow["Is_Deleted"];

            return(Bank_Account_To_Return);
        }