Example #1
0
        private void UpdateEmployee(SCViewEmployee epl, int flag)
        {
            ContractEmployee ce = new ContractEmployee();

            ce.SmanId = epl.SmanId;
            ce.Name   = epl.Name;
            ce.Phone  = epl.Phone;
            ce.Email  = epl.Email;

            if (flag == 1)//Contract responsible person
            {
                this.headerControl1.txtEmployeeID1.Text    = epl.SmanId.ToString();
                this.headerControl1.txtEmployeeName1.Text  = epl.Name;
                this.headerControl1.txtEmployeePhone1.Text = epl.Phone;
                this.headerControl1.txtEmployeeEmail1.Text = epl.Email;

                ContractFrm.objContract.RespSmanId = ce;
            }
            if (flag == 2)//Contract care taking person
            {
                this.headerControl1.txtEmployeeID2.Text    = epl.SmanId.ToString();
                this.headerControl1.txtEmployeeName2.Text  = epl.Name;
                this.headerControl1.txtEmployeePhone2.Text = epl.Phone;
                this.headerControl1.txtEmployeeEmail2.Text = epl.Email;
                ContractFrm.objContract.CareSmanId         = ce;
            }
        }
        private DataTable searchEmployee(string key)
        {
            DataTable             dt     = new DataTable();
            List <SCViewEmployee> result = new List <SCViewEmployee>();

            result = SCViewEmployee.seach(key);
            dt     = ObjectUtils.ConvertToDataTable(result);
            return(dt);
        }
        private SCViewEmployee datatableRowToEmployee(DataRow r)
        {
            SCViewEmployee epl = new SCViewEmployee();

            epl._OID   = (int)r["_OID"];
            epl.SmanId = r["SmanId"].ToString();
            epl.Name   = r["Name"].ToString();
            epl.Phone  = r["Phone"].ToString();
            epl.Email  = r["Email"].ToString();

            return(epl);
        }
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.DataSource != null && e.RowIndex > -1)
     {
         DataTable dt  = (DataTable)this.dataGridView1.DataSource;
         int       oid = -1;
         oid = (int)this.dataGridView1.Rows[e.RowIndex].Cells[0].Value;
         DataRow[] rows = dt.Select("_OID = " + oid);
         if (rows != null && rows.Count() > 0)
         {
             SCViewEmployee epl = this.datatableRowToEmployee(rows[0]);
             ContractFrm.updateEmployee(epl, this.flag);
             this.Close();
         }
     }
 }