public void GetEnginerrDetails()
        {
            String        strConnString = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
            SqlConnection con           = new SqlConnection(strConnString);

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = " select [eng_id],[Name] ,[mobile_no] from [dbo].[Engineer-Details];";
                cmd.Connection  = con;
                con.Open();
                SqlDataAdapter adp   = new SqlDataAdapter(cmd);
                DataTable      dtEng = new DataTable();
                adp.Fill(dtEng);
                if (dtEng != null && dtEng.Rows.Count > 0)
                {
                    GrdEmpList.DataSource = dtEng;
                    GrdEmpList.DataBind();
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
Example #2
0
        public void BindData(string emp_id)
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                DataTable EmpDetail = objmysqldb.GetData("select empid as emp_id,Concat(if(Employee_master.EmpFirstName is null,'',Employee_master.EmpFirstName) , ' ' , if(Employee_master.EmpMiddleName is null,'',Employee_master.EmpMiddleName) , ' ' , if(Employee_master.EmpLastName is null,'',Employee_master.EmpLastName))  AS FullName from  employee_master where employee_master.IsDelete=0 and EmpStatusFlag=0 and employee_master.FP_Id>0 order by  empid");

                string   dt    = lblDate1.Text.ToString();
                DateTime oDate = Convert.ToDateTime(dt.ToString());
                long     Tikcs = oDate.Ticks;

                DataTable dtEmpAttendance = objmysqldb.GetData("SELECT distinct Dateticks,emp_id,Day_id,concat(In_hour,':',In_min)as InMin,concat(out_hour,':',out_min)As outHour,concat(Ext_Early_hour,':',Ext_Early_min)as ExtEarlyHour,concat(Ext_Late_hour,':',Ext_Late_min)as ExtLateHour FROM employee_management.employeewise_punchtime_details_datewise where Dateticks <" + Tikcs + " and emp_id=" + emp_id + "");
                if (dtEmpAttendance != null && dtEmpAttendance.Rows.Count > 0)
                {
                    string InTime   = "";
                    string outTime  = "";
                    string ExtEarly = "";
                    string ExtLate  = "";
                    foreach (DataRow drEmp in dtEmpAttendance.Rows)
                    {
                        InTime   = drEmp["InMin"].ToString();
                        outTime  = drEmp["outHour"].ToString();
                        ExtEarly = drEmp["ExtEarlyHour"].ToString();
                        ExtLate  = drEmp["ExtLateHour"].ToString();
                    }
                    txtinTime.Text       = InTime;
                    txtoutTime.Text      = outTime;
                    txtExtremeEarly.Text = ExtEarly;
                    txtExtremeLate.Text  = ExtLate;
                }
                if (EmpDetail != null && EmpDetail.Rows.Count > 0)
                {
                    GrdEmpList.DataSource = EmpDetail;
                    GrdEmpList.DataBind();
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                //objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }