コード例 #1
0
        public void FillEmpAuditPlanningDetl()
        {
            objHRdb = new HRInfo();
            DataTable dt = new DataTable();

            gvAuditEmpPlanningDetl.Rows.Clear();

            Int32 iEmpEcode = 0;

            if (cbAuditEmployees.SelectedIndex > -1)
            {
                try
                {
                    if (cbAuditEmployees.SelectedIndex > -1)
                    {
                        iEmpEcode = Convert.ToInt32(((System.Data.DataRowView)(cbAuditEmployees.SelectedItem)).Row.ItemArray[1].ToString().Split('@')[0]);
                    }

                    dt = objHRdb.GetEmpAuditPlanningDetl(iEmpEcode, Convert.ToDateTime(dtpFromdate.Value).ToString("dd/MMM/yyyy"), Convert.ToDateTime(dtpToDate.Value).ToString("dd/MMM/yyyy")).Tables[0];

                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            gvAuditEmpPlanningDetl.Rows.Add();

                            gvAuditEmpPlanningDetl.Rows[i].Cells["SlNO"].Value         = (i + 1).ToString();
                            gvAuditEmpPlanningDetl.Rows[i].Cells["CompCode"].Value     = dt.Rows[i]["CompCode"].ToString();
                            gvAuditEmpPlanningDetl.Rows[i].Cells["LocationCode"].Value = dt.Rows[i]["BranchCode"].ToString();
                            gvAuditEmpPlanningDetl.Rows[i].Cells["BranchType"].Value   = dt.Rows[i]["TrnType"].ToString();
                            gvAuditEmpPlanningDetl.Rows[i].Cells["Date"].Value         = Convert.ToDateTime(dt.Rows[i]["PlanningDate"]).ToString("dd/MMM/yyyy");
                            gvAuditEmpPlanningDetl.Rows[i].Cells["Location"].Value     = dt.Rows[i]["LocationName"].ToString();
                            gvAuditEmpPlanningDetl.Rows[i].Cells["Remarks"].Value      = dt.Rows[i]["Remarks"].ToString();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    objHRdb = null;
                }
            }
        }