Ejemplo n.º 1
0
        private void LoadDataAndBindIntoControls()
        {
            DbSQLServer dbSQLServer = new DbSQLServer(AppSetting.ConnectionString());
            DataTable   dataTabe    = dbSQLServer.GetDataList("usp_EmployeesGetEmployeesDetailsById", new DbParameter
            {
                Parameter = "@EmployeeId",
                Value     = this.EmployeeId
            });

            DataRow dtRow = dataTabe.Rows[0];

            EmployeeIDTextBox.Text           = dtRow["EmployeeId"].ToString();
            FullNameTextBox.Text             = dtRow["FullName"].ToString();
            dateTimePicker1.Value            = Convert.ToDateTime(dtRow["DateOfBirth"]);
            NICTextBox.Text                  = dtRow["NICNumber"].ToString();
            EmailTextBox.Text                = dtRow["EmailAddress"].ToString();
            TelephoneTextBox.Text            = dtRow["Telephone"].ToString();
            MobileETextBox.Text              = dtRow["Mobile"].ToString();
            dateTimePicker2.Value            = Convert.ToDateTime(dtRow["EmploymentDate"]);
            AddressLineTextBox.Text          = dtRow["AddressLine"].ToString();
            PostCodeBox.Text                 = dtRow["PostCode"].ToString();
            CurrentSalaryTextBox.Text        = dtRow["CurrentSalary"].ToString();
            StartingSalaryTextBox.Text       = dtRow["StartingSalary"].ToString();
            CommentsTextBox.Text             = dtRow["Comments"].ToString();
            pictureBox1.Image                = (dtRow["Photo"] is DBNull) ? null : ImageManipulations.PutPhoto((byte[])dtRow["Photo"]);
            CityComboBox.SelectedValue       = dtRow["CityId"];
            DistrictComboBox.SelectedValue   = dtRow["DistrictId"];
            GenderComboBox.SelectedValue     = dtRow["GenderId"];
            BranchComboBox.SelectedValue     = dtRow["BranchId"];
            JobTitleComboBox.SelectedValue   = dtRow["JobTitleId"];
            HasLeftComboBox.Text             = (Convert.ToBoolean(dtRow["HasLeft"]) == true) ? "Yes" : "No";
            ReasonLeftComboBox.SelectedValue = dtRow["ReasonLeftId"];
            DateLeftDateTimePicker.Value     = Convert.ToDateTime(dtRow["DateLeft"]);
            CommentsTextBox.Text             = dtRow["Comments"].ToString();
        }
Ejemplo n.º 2
0
        private void LoadDataAndBindToControlIfUpdate()
        {
            if (this.IsUpdate)
            {
                DbSQLServer dbSQLServer = new DbSQLServer(AppSetting.ConnectionString());
                //DbParameter dbPara = new DbParameter();
                //dbPara.Parameter = "@BranchId";
                //dbPara.Value = this.BranchId;
                DataTable dtBranchTable = dbSQLServer.GetDataList("usp_BranchesGetBrancheDetailByBranchId", new DbParameter {
                    Parameter = "@BranchId", Value = this.BranchId
                });
                DataRow row = dtBranchTable.Rows[0];

                BranchNameTextBox.Text          = row["BranchName"].ToString();
                EmailTextBox.Text               = row["Email"].ToString();
                MobileTextBox.Text              = row["Mobile"].ToString();
                WebAddressTextBox.Text          = row["Website"].ToString();
                LogoPictureBox.Image            = (row["branchImage"] is DBNull)? null : ImageManipulations.PutPhoto((byte[])row["branchImage"]);
                AddressLineTextBox.Text         = row["AddressLine"].ToString();
                CityComboBox1.SelectedValue     = row["CityId"];
                DistrictComboBox2.SelectedValue = row["DistrictId"];
                PostCodeTextBox.Text            = row["PostCode"].ToString();
            }
        }