private void getBinddata()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         DataTable dttimegrpDetails = objmysqldb.GetData("SELECT Group_id,Group_Name,Absent_SMS_After,OutPuch_SMS_After,Changes_Applicable_Date,DATE_FORMAT(DATE_ADD('0001-01-01 00:00:00',INTERVAL Changes_Applicable_Date/10000000 SECOND_MICROSECOND), '%d/%m/%Y')as date FROM group_master where IsDelete=0");
         if (dttimegrpDetails != null)
         {
             grd.DataSource = dttimegrpDetails;
             grd.DataBind();
             btnExport.Visible = true;
         }
         else
         {
             ltrErr.Text       = "No Data Found.";
             btnExport.Visible = false;
             grd.DataSource    = null;
         }
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("Time_Group_List 79: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
     finally
     {
         objmysqldb.disposeConnectionObj();
     }
 }
Exemple #2
0
        public DataTable getAllEmployee()
        {
            DataTable dtEmp = new DataTable();

            try
            {
                objmysqldb.ConnectToDatabase();
                dtEmp = objmysqldb.GetData("select empid,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");
                if (dtEmp != null && dtEmp.Rows.Count > 0)
                {
                    ddlEmp.DataTextField  = "FullName";
                    ddlEmp.DataValueField = "empid";
                    ddlEmp.DataSource     = dtEmp;
                    ddlEmp.DataBind();
                    ddlEmp.Items.Insert(0, new ListItem("Select  Employee", "-1"));
                }
            }
            catch (Exception Ex)
            {
                //Exception exception = varAK0;
                Logger.WriteCriticalLog("getEmployee 90: exception:" + Ex.Message + "::::::::" + Ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
            return(dtEmp);
        }
Exemple #3
0
 protected void showgrid()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         ltrErr.Text = "";
         DataTable dtleftData = objmysqldb.GetData("Select concat(if(EmpFirstName is null,'',EmpFirstName),' ' ,if(EmpLastName is null,'',EmpLastName)) AS EmpFullName,Left_Employee_id,Emp_Id,Left_Date,Left_Reason from left_employee inner join employee_master on left_employee.Emp_Id=employee_master.EmpId  where left_employee.IsDelete=0 order by Left_Employee_id");
         objmysqldb.disposeConnectionObj();
         if (dtleftData != null)
         {
             grd.DataSource = dtleftData;
             grd.DataBind();
             btnExport.Visible = true;
         }
         else
         {
             //ltrErr.Text = "No Data Found.";
             btnExport.Visible = false;
             grd.DataSource    = null;
         }
         //UpdatePanel1.Update();
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("LeftEmployee 148: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
 }
        protected void getprofiledata()
        {
            DataTable dtprofile = new DataTable();

            try
            {
                objmysqldb.ConnectToDatabase();
                int profileid = 0;
                int.TryParse(profile_idHidden.Value.ToString(), out profileid);
                dtprofile = objmysqldb.GetData("select * from employee_query_profile where Profile_Id=" + profileid + " and IsDelete=0;");
                if (dtprofile != null && dtprofile.Rows.Count > 0)
                {
                    txtprofile.Text = dtprofile.Rows[0]["Profile_Name"].ToString();
                    txtquery.Text   = dtprofile.Rows[0]["Profile_Text"].ToString();
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("addnewqueryprofile 97: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.disposeConnectionObj();
            }
        }
        protected void bindgvdata(int grpid, int flg)
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                ltrErr.Text     = "";
                Button1.Visible = false; Button2.Visible = false;
                DataTable dtbindGrp = new DataTable();
                if (flg == 1)
                {
                    dtbindGrp = objmysqldb.GetData("select empid,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,if(1=1,0,1)as selects from  employee_master where employee_master.IsDelete=0  order by  empid");
                }
                else
                {
                    dtbindGrp = objmysqldb.GetData("select empid,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,if(1=1,0,1)as selects from  employee_master where employee_master.IsDelete=0 and EmpStatusFlag=0  order by  empid");
                }

                if (dtbindGrp != null && dtbindGrp.Rows.Count > 0)
                {
                    DataTable dtselectEmp = objmysqldb.GetData("SELECT emp_ids,report_grp_name,Is_Default FROM report_group_list where IsDelete=0 and report_grp_id=" + grpid + " ");
                    if (dtselectEmp != null && dtselectEmp.Rows.Count > 0)
                    {
                        //for (int i = 0; i < dtselectEmp.Rows.Count; i++)
                        //{
                        txtgroup.Text        = dtselectEmp.Rows[0]["report_grp_name"].ToString();
                        chkIsDefault.Checked = false;
                        if (dtselectEmp.Rows[0]["Is_Default"].ToString().Equals("1"))
                        {
                            chkIsDefault.Checked = true;
                        }
                        DataRow[] drselect = dtbindGrp.Select("empid IN(" + dtselectEmp.Rows[0]["emp_ids"].ToString() + ")");
                        foreach (DataRow dr in drselect)
                        {
                            dr["selects"] = "1";
                        }
                        //}
                    }

                    GridView1.DataSource = dtbindGrp;
                    GridView1.DataBind();
                    Button1.Visible = true; Button2.Visible = true;
                }
                else
                {
                    GridView1.DataSource = null;
                    GridView1.DataBind();
                    ltrErr.Text = "Receord does not exsits for selected criteria";
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("ManageEmployeeGroupReports 123: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.disposeConnectionObj();
            }
        }
Exemple #6
0
 private void bindEmpGroup()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         DataTable dtgrplist = objmysqldb.GetData("SELECT * FROM employee_management.report_group_list");
         //dtgrplist.Columns.Add("----Select Group-----");
         ddlgrouplist.DataSource     = dtgrplist;
         ddlgrouplist.DataTextField  = "report_grp_name";
         ddlgrouplist.DataValueField = "report_grp_id";
         ddlgrouplist.DataBind();
         ddlgrouplist.Items.Insert(0, new ListItem("Select All Employee", "-1"));
         ddlmonthlist.Enabled = true;
         ddlyear.Enabled      = true;
         // btnsave.Visible = true;
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("EmpLeaveConfiguration 94: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
     finally
     {
         objmysqldb.disposeConnectionObj();
     }
 }
Exemple #7
0
        private void bindgvdata()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                btnExport.Visible = false;
                DataTable dtdata    = objmysqldb.GetData("SELECT report_grp_id,report_grp_name,emp_ids FROM report_group_list where IsDelete=0");
                DataTable dtempdata = objmysqldb.GetData("SELECT EmpId,EmpFirstName FROM employee_master where IsDelete=0 and EmpStatusFlag=0");

                if (dtdata != null && dtdata.Rows.Count > 0 && dtempdata != null && dtempdata.Rows.Count > 0)
                {
                    dtdata.Columns.Add("emp_name");
                    for (int i = 0; i < dtdata.Rows.Count; i++)
                    {
                        string empids = dtdata.Rows[i]["emp_ids"].ToString();
                        if (!empids.Trim().Equals(""))
                        {
                            DataRow[] drdata   = dtempdata.Select("EmpId IN (" + empids + ")");
                            string    emp_name = "";
                            foreach (DataRow dr in drdata)
                            {
                                emp_name += dr["EmpFirstName"].ToString() + ",";
                            }
                            emp_name = emp_name.TrimEnd(',');
                            dtdata.Rows[i]["emp_name"] = emp_name;
                        }
                    }
                    ViewState["gvdata"] = dtdata;
                    grd.DataSource      = dtdata;
                    grd.DataBind();

                    btnExport.Visible = true;
                }
                else
                {
                    grd.DataSource = null;
                    grd.DataBind();
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("EmployeeGroupForReports 99: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.disposeConnectionObj();
            }
        }
        public static object binDdata(string id)
        {
            try
            {
                MySQLDB dbc             = new MySQLDB();
                var     objectdata      = new List <test>();
                JavaScriptSerializer js = new JavaScriptSerializer();
                dbc.ConnectToDatabase();
                DataTable dt = dbc.GetData("Select religion_id,religion_name,IsMasterData from religion_master where IsDelete=0 order by religion_id");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var model = new test();
                    model.id   = dt.Rows[i]["religion_id"].ToString();
                    model.name = dt.Rows[i]["religion_name"].ToString();
                    objectdata.Add(model);
                }

                string aa = js.Serialize(objectdata);
                return(objectdata);
            }
            catch (Exception aa)
            {
                return("");
            }
        }
Exemple #9
0
        protected void showgrid()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                ltrErr.Text = "";

                DataTable dtempprofile = objmysqldb.GetData("Select * from employee_query_profile where IsDelete=0 order  by Profile_Id");
                if (dtempprofile != null && dtempprofile.Rows.Count > 0)
                {
                    grd.DataSource = dtempprofile;
                    grd.DataBind();
                }
                else
                {
                    ltrErr.Text = "No Data Found.";

                    grd.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("addeditprofile 78: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.disposeConnectionObj();
            }
        }
Exemple #10
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();
            }
        }
        protected void BindSearchCriteria()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                DataTable dtschList = objmysqldb.GetData("Select School_List_ID,School_Name,School_Id from school_list where IsDelete=0 order by School_List_ID");

                ddlschool.DataSource     = dtschList;
                ddlschool.DataTextField  = "School_Name";
                ddlschool.DataValueField = "School_List_ID";
                ddlschool.DataBind();
                ddlschool.Items.Insert(0, new ListItem("Select Organization", "-1"));

                DataTable dtdepartment = objmysqldb.GetData("Select department_id,Department_Name from department_master where IsDelete=0 order by department_id");

                ddldepartment.DataSource     = dtdepartment;
                ddldepartment.DataTextField  = "Department_Name";
                ddldepartment.DataValueField = "department_id";
                ddldepartment.DataBind();
                ddldepartment.Items.Insert(0, new ListItem("Select Department", "1000"));


                DataTable dtdesignation = objmysqldb.GetData("Select designation_id,Designation_Name from designation_master where IsDelete=0 order by designation_id");
                ddlDesignation.DataSource     = dtdesignation;
                ddlDesignation.DataTextField  = "Designation_Name";
                ddlDesignation.DataValueField = "designation_id";
                ddlDesignation.DataBind();

                ddlDesignation.Items.Insert(0, new ListItem("Select Designation", "1000"));

                DataTable dttimegrp = objmysqldb.GetData("Select Group_id,Group_Name from group_master where IsDelete=0 order by Group_id");
                ddltimegrp.DataSource     = dttimegrp;
                ddltimegrp.DataTextField  = "Group_Name";
                ddltimegrp.DataValueField = "Group_id";
                ddltimegrp.DataBind();

                ddltimegrp.Items.Insert(0, new ListItem("Select Time Group", "1000"));

                objmysqldb.disposeConnectionObj();
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Employee_AssignToTimeGroup 101: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
        }
 protected void showgrid()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         ltrErr.Text = "";
         DataTable dtreligion = objmysqldb.GetData("Select religion_id,religion_name,IsMasterData from religion_master where IsDelete=0 order by religion_id");
         objmysqldb.disposeConnectionObj();
         if (dtreligion != null)
         {
             grd.DataSource = dtreligion;
             grd.DataBind();
             btnExport.Visible = true;
         }
         else
         {
             ltrErr.Text       = "No Data Found.";
             btnExport.Visible = false;
             grd.DataSource    = null;
         }
         //UpdatePanel1.Update();
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("Manage_Religion 79: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
 }
 protected void showgrid()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         ltrErr.Text = "";
         DataTable dtcasteList = objmysqldb.GetData("select caste_id,caste_name,IsMasterData from caste_master WHERE IsDelete=0 order by caste_id");
         objmysqldb.disposeConnectionObj();
         if (dtcasteList != null)
         {
             grd.DataSource = dtcasteList;
             grd.DataBind();
             btnExport.Visible = true;
         }
         else
         {
             ltrErr.Text       = "No Data Found.";
             btnExport.Visible = false;
             grd.DataSource    = null;
         }
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("Manage_Caste 79: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
 }
 protected void showgrid()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         ltrErr.Text = "";
         DataTable dtschList = objmysqldb.GetData("Select School_List_ID,School_Name,School_Id from school_list where IsDelete=0 order by School_List_ID");
         objmysqldb.disposeConnectionObj();
         if (dtschList != null)
         {
             string schid = "";
             for (int i = 0; i < dtschList.Rows.Count; i++)
             {
                 schid += dtschList.Rows[i]["School_Id"].ToString() + " - " + dtschList.Rows[i]["School_Name"].ToString() + ",";
             }
             Application["schId"] = schid.TrimEnd(',');
             grd.DataSource       = dtschList;
             grd.DataBind();
             btnExport.Visible = true;
         }
         else
         {
             ltrErr.Text       = "No Data Found.";
             btnExport.Visible = false;
             grd.DataSource    = null;
         }
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("Manage_Organization 84: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
 }
        private static string List_of_Holiday(string id, MySQLDB dbc, string response)
        {
            DataTable dtHolidaydetails = dbc.GetData("SELECT Holiday_Day,Holiday_Month,Holiday_Year,Holiday_Reason,Holiday_For_Id FROM holiday_setup where IsDelete=0 and Holiday_Profile_Id=" + id + " ");

            for (int i = 0; i < dtHolidaydetails.Rows.Count; i++)
            {
                response += dtHolidaydetails.Rows[i]["Holiday_Day"].ToString() + "@" + dtHolidaydetails.Rows[i]["Holiday_Month"].ToString() + "@" + dtHolidaydetails.Rows[i]["Holiday_Year"].ToString() + "@" + dtHolidaydetails.Rows[i]["Holiday_Reason"].ToString() + "@" + dtHolidaydetails.Rows[i]["Holiday_For_Id"].ToString() + "###";
            }
            return(response);
        }
        public void fillWithData()
        {
            objmysqldb.ConnectToDatabase();
            // BindAcademicYear();
            try
            {
                DataTable dtData = objmysqldb.GetData("SELECT year_id,Academic_Year,Start_Date as startdate,End_Date as enddate FROM academicyear where IsDelete=0;");
                if (dtData.Rows.Count > 0 && dtData != null)
                {
                    dtData.Columns.Add("Start_Date");
                    dtData.Columns.Add("End_Date");
                    int c = dtData.Rows.Count;

                    for (int i = 0; i < dtData.Rows.Count; i++)
                    {
                        //string startDate = dtData.Rows[i]["startdate"].ToString();
                        long     startdate = long.Parse(dtData.Rows[i]["startdate"].ToString());
                        DateTime startdt   = new DateTime(startdate);
                        //String myString_new = startdt.ToString().Replace("00:00:00", "");
                        //String myString_new = String.Format("{0:MM/dd/yyyy}", startdt);
                        String myString_new = String.Format("{0:dd/MM/yyyy}", startdt);
                        dtData.Rows[i]["Start_Date"] = myString_new;

                        long     enddate = long.Parse(dtData.Rows[i]["enddate"].ToString());
                        DateTime enddt   = new DateTime(enddate);
                        //String myString_new1 = enddt.ToString().Replace("00:00:00", "");

                        String myString_new1 = String.Format("{0:dd/MM/yyyy}", enddt);
                        dtData.Rows[i]["End_Date"] = myString_new1;
                    }
                    // dtYear.AcceptChanges();
                    //dlYear.DataSource = dtYear;
                    //dlYear.DataBind();
                    //dlYear.Items.Insert(0, new ListItem("Select Year", "-2"));
                    grdyearlist.AutoGenerateColumns = false;
                    grdyearlist.DataSource          = dtData;
                    grdyearlist.DataBind();
                }
                else
                {
                    //BindAcademicYear();
                    grdyearlist.AutoGenerateColumns = false;
                    grdyearlist.DataSource          = dtData.Clone();
                    grdyearlist.DataBind();
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Academic Year Set Up 141: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.disposeConnectionObj();
            }
        }
 protected void bindGrplist()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         DataTable dtbindGrp = objmysqldb.GetData("select module_group_id,module_group_name from employee_app_module_group where IsDelete=0");
         ddlgrouplist.DataSource     = dtbindGrp;
         ddlgrouplist.DataTextField  = "module_group_name";
         ddlgrouplist.DataValueField = "module_group_id";
         ddlgrouplist.DataBind();
         ddlgrouplist.Items.Insert(0, new ListItem("Select Module Group", "0"));
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("ModuleGrp_AssignTo_Employee 74: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
     finally
     {
         objmysqldb.disposeConnectionObj();
     }
 }
        protected void getbindReportingManager()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                DataTable dtReportingMg = objmysqldb.GetData("select Reporting_manager_id,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 reporting_manager_master inner join employee_master on reporting_manager_master.Emp_id =employee_master.empid where reporting_manager_master.IsDelete=0 and employee_master.IsDelete=0 and EmpStatusFlag=0");

                ddlmanager.DataSource     = dtReportingMg;
                ddlmanager.DataTextField  = "FullName";
                ddlmanager.DataValueField = "Reporting_manager_id";
                ddlmanager.DataBind();
                ddlmanager.Items.Insert(0, new ListItem("Select Reporting Manager", "0"));
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Employee_AssignToReportingManager 74: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.disposeConnectionObj();
            }
        }
        private void BindEmployeeList()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                DataTable dtemplist = objmysqldb.GetData("SELECT  EmpId, 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  EmpStatusFlag=0 and employee_master.IsDelete=0");

                ddlemplist.DataSource     = dtemplist;
                ddlemplist.DataTextField  = "FullName";
                ddlemplist.DataValueField = "EmpId";
                ddlemplist.DataBind();
                ddlemplist.Items.Insert(0, new ListItem("Select Reporting Manager", "-1"));
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Employee_Attendance_Override 74: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.disposeConnectionObj();
            }
        }
 private void bindEmpGroup()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         DataTable dtgrplist = objmysqldb.GetData("SELECT * FROM employee_management.report_group_list");
         DataTable EmpList   = new DataTable();
         ddlgrouplist.DataSource     = dtgrplist;
         ddlgrouplist.DataTextField  = "report_grp_name";
         ddlgrouplist.DataValueField = "report_grp_id";
         ddlgrouplist.DataBind();
         ddlgrouplist.Items.Insert(0, new ListItem("Select All Emp", "0"));
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("SalaryConfiguration 77: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
     finally
     {
         objmysqldb.disposeConnectionObj();
     }
 }
Exemple #21
0
 private void BindImg(int repgrp)
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         DataTable dtdata = objmysqldb.GetData("SELECT A4L_Img,LegelP_Img,LegelL_Img FROM report_group_list where report_grp_id=" + repgrp + " ");
         string    test   = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port;
         IMgA4L.ImageUrl    = test + "//HeaderImages.jpg";
         imglegelP.ImageUrl = test + "//HeaderImages.jpg";
         ImgLegelL.ImageUrl = test + "//HeaderImages.jpg";
         string uploadFolderPath = "~/HeaderImages/";
         if (dtdata != null && dtdata.Rows.Count > 0)
         {
             if (!dtdata.Rows[0]["A4L_Img"].ToString().Equals(""))//A4
             {
                 string pathSign = HttpContext.Current.Server.MapPath(uploadFolderPath) + "\\" + dtdata.Rows[0]["A4L_Img"].ToString();
                 if (File.Exists(pathSign))
                 {
                     test            = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + "//HeaderImages";
                     IMgA4L.ImageUrl = test + "//" + dtdata.Rows[0]["A4L_Img"].ToString();
                 }
             }
             if (!dtdata.Rows[0]["LegelP_Img"].ToString().Equals(""))  //Legel port
             {
                 string pathSign = HttpContext.Current.Server.MapPath(uploadFolderPath) + "\\" + dtdata.Rows[0]["LegelP_Img"].ToString();
                 if (File.Exists(pathSign))
                 {
                     test = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + "//HeaderImages";
                     imglegelP.ImageUrl = test + "//" + dtdata.Rows[0]["LegelP_Img"].ToString();
                 }
             }
             if (!dtdata.Rows[0]["LegelL_Img"].ToString().Equals("")) //Legel Lan
             {
                 string pathSign = HttpContext.Current.Server.MapPath(uploadFolderPath) + "\\" + dtdata.Rows[0]["LegelL_Img"].ToString();
                 if (File.Exists(pathSign))
                 {
                     test = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + "//HeaderImages";
                     ImgLegelL.ImageUrl = test + "//" + dtdata.Rows[0]["LegelL_Img"].ToString();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("ManageEmployeeGroupReportsHeaderImage 111: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
     finally
     {
         objmysqldb.disposeConnectionObj();
     }
 }
Exemple #22
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            ltrErr.Text = "";
            DataTable dtSearch = new DataTable();

            try
            {
                if (!txtdept.Text.ToString().Equals(""))
                {
                    //objmysqldb.ConnectToDatabase();
                    //ConfigurationManager cm=
                    dtSearch = objmysqldb.GetData("Select * from cities WHERE IsDelete=0 and (Department_Name like '" + txtdept.Text.ToString() + "') ");


                    if (dtSearch != null && dtSearch.Rows.Count > 0)
                    {
                        ltrErr.Text = " Department Is Already Exist.";
                        return;
                    }
                    DateTime currenttime = Logger.getIndiantimeDT();
                    int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                    objmysqldb.AddCommandParameter("deptnm", txtdept.Text.ToString());

                    string query = "Insert into   department_master (Department_Name,modify_datetime,DOC,UserID,IsDelete,IsUpdate,IsMasterData) values (?deptnm," + currenttime.Ticks + "," + currenttime.Ticks + "," + user_id + ",0,1,1) ";

                    objmysqldb.OpenSQlConnection();
                    int res = objmysqldb.InsertUpdateDeleteData(query);
                    if (res != 1)
                    {
                        ltrErr.Text = "Please Try Again.";

                        Logger.WriteCriticalLog("Manage_Department 128 Update error.");
                    }
                    else
                    {
                        grd.EditIndex = -1;
                        showgrid();
                        ltrErr.Text  = "Department Save Successfully.";
                        txtdept.Text = "";
                    }
                }
                else
                {
                    ltrErr.Text = "Please Enter All Details.";
                    return;
                }
            }

            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Manage_Department 149: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
        }
 protected void showgrid()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         DataTable dtfieldlist = objmysqldb.GetData("Select Employee_Field_id,FieldName,FieldDisplayName,Is_Show,SortNumber from employee_search_field_config order by Employee_Field_id");
         objmysqldb.disposeConnectionObj();
         if (dtfieldlist != null)
         {
             grd.DataSource = dtfieldlist;
             grd.DataBind();
         }
         else
         {
             ltrErr.Text = "No Data Found.";
             //btnExport.Visible = false;
             grd.DataSource = null;
         }
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("DisplayColumnConfigurationForSearchEmployee 80: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
 }
 private void bindholidayprofile()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         DataTable dtHolidayProfile = objmysqldb.GetData("SELECT Holiday_Profile_Id,Holiday_Profile_Name FROM holiday_profile_master ");
         ddlholiday.DataSource     = dtHolidayProfile;
         ddlholiday.DataTextField  = "Holiday_Profile_Name";
         ddlholiday.DataValueField = "Holiday_Profile_Id";
         ddlholiday.DataBind();
         ddlholiday.Items.Insert(0, new ListItem("Select Holiday Profile", "-1"));
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("Holiday_Setup 83: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
     finally
     {
         objmysqldb.disposeConnectionObj();
     }
 }
        public static string getHolidayList(string id)
        {
            MySQLDB dbc = new MySQLDB();

            try
            {
                int ids = 0;
                int.TryParse(id, out ids);

                dbc.ConnectToDatabase();


                DataTable dtholiday = dbc.GetData("SELECT Holiday_day_id FROM employee_management.holiday_profile_master  where  Holiday_Profile_Id=" + id + " ");
                string    response  = "";
                if (dtholiday != null && dtholiday.Rows.Count > 0)
                {
                    response = dtholiday.Rows[0]["Holiday_day_id"].ToString() + "@@@";
                }
                //DataTable dtHolidaydetails = dbc.GetData("SELECT Holiday_Day,Holiday_Month,Holiday_Year,Holiday_Reason,Holiday_For_Id FROM holiday_setup where IsDelete=0 and Holiday_Profile_Id=" + id + " ");
                //for (int i = 0; i < dtHolidaydetails.Rows.Count; i++)
                //{
                //    response += dtHolidaydetails.Rows[i]["Holiday_Day"].ToString() + "@" + dtHolidaydetails.Rows[i]["Holiday_Month"].ToString() + "@" + dtHolidaydetails.Rows[i]["Holiday_Year"].ToString() + "@" + dtHolidaydetails.Rows[i]["Holiday_Reason"].ToString() + "@" + dtHolidaydetails.Rows[i]["Holiday_For_Id"].ToString() + "###";
                //}


                response = List_of_Holiday(id, dbc, response);
                response = response.TrimEnd('#');
                return(response);
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Holiday_Setup 249: exception:" + ex.Message + "::::::::" + ex.StackTrace);
                return("");
            }
            finally
            {
                dbc.CloseSQlConnection();
                dbc.disposeConnectionObj();
            }
        }
 protected void holidayProfile()
 {
     objmysqldb.ConnectToDatabase();
     try
     {
         DataTable dtbindholiday = objmysqldb.GetData("SELECT * FROM  holiday_profile_master;");
         ddlholidaylist.DataSource     = dtbindholiday;
         ddlholidaylist.DataTextField  = "Holiday_Profile_Name";
         ddlholidaylist.DataValueField = "Holiday_Profile_Id";
         ddlholidaylist.DataBind();
         ddlholidaylist.Items.Insert(0, new ListItem("Select Holiday Profile", "0"));
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("EmployeeAssignHolidayProfile 74: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
     finally
     {
         objmysqldb.disposeConnectionObj();
     }
 }
        protected void BindSearchCriteria()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                DataTable dtprofile = objmysqldb.GetData("Select Profile_Id,Profile_Name,Profile_Text from employee_query_profile where IsDelete=0 order by Profile_Id");

                ddlprofile.DataSource     = dtprofile;
                ddlprofile.DataTextField  = "Profile_Name";
                ddlprofile.DataValueField = "Profile_Id";
                ddlprofile.DataBind();
                ddlprofile.Items.Insert(0, new ListItem("Select Profile", "-1"));

                DataTable dtyear = new DataTable();
                //dtyear.Columns.Add("Year_id", typeof(int));
                dtyear.Columns.Add("Year", typeof(int));
                DataTable dtdoj = objmysqldb.GetData("select distinct EmpDOJ from employee_master where EmpDOJ !=null or EmpDOJ!='';");
                dtdoj.Columns.Add("year");
                for (int i = 0; i < dtdoj.Rows.Count; i++)
                {
                    string doj = dtdoj.Rows[i]["EmpDOJ"].ToString();
                    if (doj != null && doj != "")
                    {
                        string[] doj1 = doj.Split('/');
                        dtdoj.Rows[i]["year"] = doj1[2].ToString();
                    }
                }
                dtyear = dtdoj.DefaultView.ToTable(true, "year");

                DataView dv = dtyear.DefaultView;
                dv.Sort = "year";

                ddlyear.DataSource    = dtyear;
                ddlyear.DataTextField = "Year";
                ddlyear.DataBind();
                ddlyear.Items.Insert(0, new ListItem("Select Year", "-1"));

                DataTable dtschList = objmysqldb.GetData("Select School_List_ID,School_Name,School_Id from school_list where IsDelete=0 order by School_List_ID");

                ddlschList.DataSource     = dtschList;
                ddlschList.DataTextField  = "School_Name";
                ddlschList.DataValueField = "School_List_ID";
                ddlschList.DataBind();
                ddlschList.Items.Insert(0, new ListItem("Select Organization", "-1"));

                DataTable dtdepartment = objmysqldb.GetData("Select department_id,Department_Name from department_master where IsDelete=0 order by department_id");

                ddldepart.DataSource     = dtdepartment;
                ddldepart.DataTextField  = "Department_Name";
                ddldepart.DataValueField = "department_id";
                ddldepart.DataBind();
                ddldepart.Items.Insert(0, new ListItem("Select Department", "1000"));


                DataTable dtdesignation = objmysqldb.GetData("Select designation_id,Designation_Name from designation_master where IsDelete=0 order by designation_id");
                ddldesig.DataSource     = dtdesignation;
                ddldesig.DataTextField  = "Designation_Name";
                ddldesig.DataValueField = "designation_id";
                ddldesig.DataBind();

                ddldesig.Items.Insert(0, new ListItem("Select Designation", "1000"));
                objmysqldb.disposeConnectionObj();


                DataTable dtstatus = new DataTable();
                dtstatus.Columns.Add("Status_id");
                dtstatus.Columns.Add("Status");
                ddlStatus.DataSource     = dtstatus;
                ddlStatus.DataTextField  = "Status";
                ddlStatus.DataValueField = "Status_id";
                ddlStatus.DataBind();
                ddlStatus.Items.Insert(0, new ListItem("Select Status", "-1"));
                ddlStatus.Items.Insert(1, new ListItem("Working", "0"));
                ddlStatus.Items.Insert(2, new ListItem("Left", "1"));

                DataTable dtcolList = new DataTable();
                dtcolList.Columns.Add("col_id");
                dtcolList.Columns.Add("col_name");
                ddlColumnList.DataSource     = dtcolList;
                ddlColumnList.DataTextField  = "col_id";
                ddlColumnList.DataValueField = "col_name";
                ddlColumnList.DataBind();

                ddlColumnList.Items.Insert(0, new ListItem("Select Filter", "0"));
                ddlColumnList.Items.Insert(1, new ListItem("Employee Name", "1"));
                ddlColumnList.Items.Insert(2, new ListItem("Employee DOJ", "2"));
                ddlColumnList.Items.Insert(3, new ListItem("Employee DOB", "3"));
                ddlColumnList.Items.Insert(4, new ListItem("Employee Gender", "5"));
                ddlColumnList.Items.Insert(5, new ListItem("Employee Phone", "6"));

                DataTable dtAssignStatus = new DataTable();
                dtAssignStatus.Columns.Add("Status_id");
                dtAssignStatus.Columns.Add("Status");
                ddlstatusAssign.DataSource     = dtAssignStatus;
                ddlstatusAssign.DataTextField  = "Status";
                ddlstatusAssign.DataValueField = "Status_id";
                ddlstatusAssign.DataBind();
                ddlstatusAssign.Items.Insert(0, new ListItem("All Employee", "-1"));
                ddlstatusAssign.Items.Insert(1, new ListItem("Assign Employee", "0"));
                ddlstatusAssign.Items.Insert(2, new ListItem("Un Assign Employee", "1"));
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Search_Employee 165: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
        }
Exemple #28
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                ltrErr.Text = "";
                int grp_id = 0;
                int.TryParse(time_grp.Value.ToString(), out grp_id);
                if (txtgroup.Text.Equals("") || SMSintime.Value.ToString().Equals("") || smsout.Value.ToString().Equals(""))
                {
                    ltrErr.Text = "Please enter all details";
                    return;
                }
                long dateticks = 0;
                try
                {
                    string[] arrchangeDate = date.Text.Split('/');

                    dateticks = new DateTime(int.Parse(arrchangeDate[2]), int.Parse(arrchangeDate[1]), int.Parse(arrchangeDate[0])).Ticks;
                }
                catch (Exception aa)
                {
                }
                if (dateticks == 0)
                {
                    ltrErr.Text = "Please Enter valid  Applicable change date";
                    return;
                }
                DataTable dtPreviousTimeConfig = objmysqldb.GetData("select GroupWise_Time_Id,Group_Time_Id,Day_id,In_hour,In_min,out_hour,out_min,Ext_Early_hour,Ext_Early_min,Ext_Late_hour,Ext_Late_min from groupwise_time_config where Group_Time_Id=" + grp_id + " ");

                DataTable dtPreviousgrpdata = objmysqldb.GetData("select Group_id,Group_Name,Absent_SMS_After,OutPuch_SMS_After,Changes_Applicable_Date from group_master");

                if (dtPreviousTimeConfig != null && dtPreviousgrpdata != null)
                {
                    DataRow[] drgrp = dtPreviousgrpdata.Select("Group_Name ='" + txtgroup.Text.ToString() + "' and  Group_id <> " + grp_id + " ");
                    if (drgrp.Length > 0)
                    {
                        ltrErr.Text = "Group name already exists";
                        return;
                    }
                    DataTable dtdata = new DataTable();
                    dtdata.Columns.Add("Day_id", typeof(Int32));
                    dtdata.Columns.Add("In_hour", typeof(Int32));
                    dtdata.Columns.Add("In_min", typeof(Int32));
                    dtdata.Columns.Add("out_hour", typeof(Int32));
                    dtdata.Columns.Add("out_min", typeof(Int32));
                    dtdata.Columns.Add("Ext_Early_hour", typeof(Int32));
                    dtdata.Columns.Add("Ext_Early_min", typeof(Int32));
                    dtdata.Columns.Add("Ext_Late_hour", typeof(Int32));
                    dtdata.Columns.Add("Ext_Late_min", typeof(Int32));
                    #region time check
                    foreach (GridViewRow row in grd.Rows)
                    {
                        Label   dayid    = (Label)row.FindControl("lbldayid");
                        TextBox txtIn    = (TextBox)row.FindControl("txtIntime");
                        TextBox txtOut   = (TextBox)row.FindControl("txtoutTime");
                        TextBox txtEarly = (TextBox)row.FindControl("txtearly");
                        TextBox txtLate  = (TextBox)row.FindControl("txtlate");
                        if (txtIn.Text.ToString().Equals("") || txtOut.Text.ToString().Equals("") || txtEarly.Text.ToString().Equals("") || txtLate.Text.ToString().Equals(""))
                        {
                            ltrErr.Text = "Please enter all time slot";
                            return;
                        }
                        string[] intime    = txtIn.Text.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                        string[] outtime   = txtOut.Text.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                        string[] Earlytime = txtEarly.Text.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                        string[] latetime  = txtLate.Text.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

                        if (intime.Length != 2 || outtime.Length != 2 || Earlytime.Length != 2 || latetime.Length != 2)
                        {
                            ltrErr.Text = "Please enter valid time ";
                            return;
                        }
                        int day = 0;
                        int.TryParse(dayid.Text.ToString(), out day);
                        int In_hour        = 0;
                        int In_min         = 0;
                        int out_hour       = 0;
                        int out_min        = 0;
                        int Ext_Early_hour = 0;
                        int Ext_Early_min  = 0;
                        int Ext_Late_hour  = 0;
                        int Ext_Late_min   = 0;
                        int.TryParse(intime[0], out In_hour);
                        int.TryParse(intime[1], out In_min);
                        int.TryParse(outtime[0], out out_hour);
                        int.TryParse(outtime[1], out out_min);
                        int.TryParse(Earlytime[0], out Ext_Early_hour);
                        int.TryParse(Earlytime[1], out Ext_Early_min);
                        int.TryParse(latetime[0], out Ext_Late_hour);
                        int.TryParse(latetime[1], out Ext_Late_min);
                        if (In_hour > 23 || In_min > 59 || out_hour > 23 || out_min > 59 || Ext_Early_hour > 23 || Ext_Early_min > 59 || Ext_Late_hour > 23 || Ext_Late_min > 59)
                        {
                            ltrErr.Text = "Please enter valid time ";
                            return;
                        }
                        dtdata.Rows.Add(day, In_hour, In_min, out_hour, out_min, Ext_Early_hour, Ext_Early_min, Ext_Late_hour, Ext_Late_min);
                    }
                    #endregion

                    objmysqldb.OpenSQlConnection();
                    objmysqldb.BeginSQLTransaction();


                    int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                    objmysqldb.AddCommandParameter("Group_Name", txtgroup.Text.ToString());
                    int absent   = 0;
                    int outpunch = 0;
                    int.TryParse(SMSintime.Value.ToString(), out absent);
                    int.TryParse(smsout.Value.ToString(), out outpunch);
                    DateTime currenttime = Logger.getIndiantimeDT();
                    if (grp_id > 0)
                    {
                        objmysqldb.InsertUpdateDeleteData("update group_master set Group_Name=?Group_Name,Absent_SMS_After=" + absent + ",OutPuch_SMS_After=" + outpunch + ",Changes_Applicable_Date=" + dateticks + ",modify_datetime=" + currenttime.Ticks + ", IsUpdate=1, UserID=" + user_id + " where  Group_id = " + grp_id + "");
                    }
                    else
                    {
                        long mode = currenttime.Ticks;
                        int  res  = objmysqldb.InsertUpdateDeleteData("insert into group_master (Group_Name,Absent_SMS_After,OutPuch_SMS_After,Changes_Applicable_Date,modify_datetime,DOC,IsUpdate,UserID,IsDelete) values (?Group_Name," + absent + "," + outpunch + "," + dateticks + "," + mode + "," + mode + ",1," + user_id + ",0) ");
                        if (res != 1)
                        {
                            ltrErr.Text = "Please Try Again.";
                            objmysqldb.RollBackSQLTransaction();
                            Logger.WriteCriticalLog("Manage_TimeGroup 205 Update error.");
                            return;
                        }
                        else
                        {
                            long lastgrpid = objmysqldb.LastNo("group_master", "Group_id", mode);
                            ViewState["TimegrpId"] = lastgrpid.ToString();
                            time_grp.Value         = (string)ViewState["TimegrpId"];
                            int.TryParse(time_grp.Value.ToString(), out grp_id);
                            //Emp_idHidden.Value = lastEmpid.ToString();
                            //Response.Redirect("~/ManageEmployee.aspx?Emp=" + Emp_idHidden.Value.ToString() + "", false);
                        }
                    }

                    foreach (DataRow dr in dtdata.Rows)
                    {
                        int retval = objmysqldb.InsertUpdateDeleteData("update groupwise_time_config set In_hour=" + int.Parse(dr["In_hour"].ToString()) + ",In_min=" + int.Parse(dr["In_min"].ToString()) + ",out_hour=" + int.Parse(dr["out_hour"].ToString()) + ",out_min=" + int.Parse(dr["out_min"].ToString()) + ",Ext_Early_hour=" + int.Parse(dr["Ext_Early_hour"].ToString()) + ",Ext_Early_min=" + int.Parse(dr["Ext_Early_min"].ToString()) + ",Ext_Late_hour=" + int.Parse(dr["Ext_Late_hour"].ToString()) + ",Ext_Late_min=" + int.Parse(dr["Ext_Late_min"].ToString()) + ",modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_id + " where Group_Time_Id=" + grp_id + " and Day_id=" + int.Parse(dr["Day_id"].ToString()) + " ");

                        if (retval == 0)
                        {
                            retval = objmysqldb.InsertUpdateDeleteData("insert into groupwise_time_config (Group_Time_Id,Day_id,In_hour,In_min,out_hour,out_min,Ext_Early_hour,Ext_Early_min,Ext_Late_hour,Ext_Late_min,modify_datetime,DOC,IsUpdate,UserID) values (" + grp_id + "," + int.Parse(dr["Day_id"].ToString()) + "," + int.Parse(dr["In_hour"].ToString()) + "," + int.Parse(dr["In_min"].ToString()) + "," + int.Parse(dr["out_hour"].ToString()) + "," + int.Parse(dr["out_min"].ToString()) + "," + int.Parse(dr["Ext_Early_hour"].ToString()) + "," + int.Parse(dr["Ext_Early_min"].ToString()) + "," + int.Parse(dr["Ext_Late_hour"].ToString()) + "," + int.Parse(dr["Ext_Late_min"].ToString()) + "," + currenttime.Ticks + "," + currenttime.Ticks + ",1," + user_id + ")");
                        }
                    }
                    // Applicable Date change
                    string[] arrdob = date.Text.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                    DateTime dtcur  = MySQLDB.GetIndianTime();
                    if (arrdob.Length == 3)
                    {
                        DateTime dtchangeDate = new DateTime(int.Parse(arrdob[2]), int.Parse(arrdob[1]), int.Parse(arrdob[0]));

                        DateTime dtcurrent   = new DateTime(dtcur.Year, dtcur.Month, dtcur.Day);
                        TimeSpan dtDiff      = dtchangeDate - dtcurrent;
                        DateTime dtstartdate = dtcurrent;
                        if (dtDiff.Days < 0)
                        {
                            dtDiff      = dtcurrent - dtchangeDate;
                            dtstartdate = dtchangeDate;
                        }

                        #region  datewise entry
                        DateTime currenttimes = Logger.getIndiantimeDT();
                        for (int d = 0; d <= dtDiff.Days; d++)
                        {
                            DateTime dtt = dtstartdate.AddDays(d);
                            //foreach (DataRow dr in dtdata.Rows)
                            int days = (int)dtt.DayOfWeek;
                            if (days == 0)
                            {
                                days = 7;
                            }
                            DataRow[] drdaywise = dtdata.Select("Day_id =" + days + " ");
                            foreach (DataRow dr in drdaywise)
                            {
                                int retval = objmysqldb.InsertUpdateDeleteData("update employee_punchtime_details_datewise set In_hour=" + int.Parse(dr["In_hour"].ToString()) + ",In_min=" + int.Parse(dr["In_min"].ToString()) + ",out_hour=" + int.Parse(dr["out_hour"].ToString()) + ",out_min=" + int.Parse(dr["out_min"].ToString()) + ",Ext_Early_hour=" + int.Parse(dr["Ext_Early_hour"].ToString()) + ",Ext_Early_min=" + int.Parse(dr["Ext_Early_min"].ToString()) + ",Ext_Late_hour=" + int.Parse(dr["Ext_Late_hour"].ToString()) + ",Ext_Late_min=" + int.Parse(dr["Ext_Late_min"].ToString()) + ",modify_datetime=" + currenttimes.Ticks + ",IsUpdate=1,UserID=" + user_id + " where time_grp_id=" + grp_id + " and Day_id=" + int.Parse(dr["Day_id"].ToString()) + " and Dateticks=" + dtt.Ticks + " ");

                                if (retval == 0)
                                {
                                    retval = objmysqldb.InsertUpdateDeleteData("insert into employee_punchtime_details_datewise (Dateticks,time_grp_id,Day_id,In_hour,In_min,out_hour,out_min,Ext_Early_hour,Ext_Early_min,Ext_Late_hour,Ext_Late_min,modify_datetime,DOC,IsUpdate,UserID,IsDelete) values (" + dtt.Ticks + "," + grp_id + "," + int.Parse(dr["Day_id"].ToString()) + "," + int.Parse(dr["In_hour"].ToString()) + "," + int.Parse(dr["In_min"].ToString()) + "," + int.Parse(dr["out_hour"].ToString()) + "," + int.Parse(dr["out_min"].ToString()) + "," + int.Parse(dr["Ext_Early_hour"].ToString()) + "," + int.Parse(dr["Ext_Early_min"].ToString()) + "," + int.Parse(dr["Ext_Late_hour"].ToString()) + "," + int.Parse(dr["Ext_Late_min"].ToString()) + "," + currenttimes.Ticks + "," + currenttimes.Ticks + ",1," + user_id + ",0)");
                                }
                            }
                        }
                        DataTable dtgroupdata = new DataTable();
                        dtgroupdata = objmysqldb.GetData("select * from employee_management.time_group_assign_emplyee_wise where Group_id=" + grp_id + "");
                        if (dtgroupdata.Rows.Count > 0 && dtgroupdata != null)
                        {
                            for (int d1 = 0; d1 <= dtDiff.Days; d1++)
                            {
                                DateTime dtt1 = dtstartdate.AddDays(d1);
                                //foreach (DataRow dr in dtdata.Rows)
                                int days1 = (int)dtt1.DayOfWeek;
                                if (days1 == 0)
                                {
                                    days1 = 7;
                                }
                                DataRow[] drdaywise1 = dtdata.Select("Day_id =" + days1 + " ");
                                for (int emp = 0; emp < dtgroupdata.Rows.Count; emp++)
                                {
                                    foreach (DataRow dr in drdaywise1)
                                    {
                                        int retval = objmysqldb.InsertUpdateDeleteData("update employeewise_punchtime_details_datewise set In_hour=" + int.Parse(dr["In_hour"].ToString()) + ",In_min=" + int.Parse(dr["In_min"].ToString()) + ",out_hour=" + int.Parse(dr["out_hour"].ToString()) + ",out_min=" + int.Parse(dr["out_min"].ToString()) + ",Ext_Early_hour=" + int.Parse(dr["Ext_Early_hour"].ToString()) + ",Ext_Early_min=" + int.Parse(dr["Ext_Early_min"].ToString()) + ",Ext_Late_hour=" + int.Parse(dr["Ext_Late_hour"].ToString()) + ",Ext_Late_min=" + int.Parse(dr["Ext_Late_min"].ToString()) + ",modify_datetime=" + currenttimes.Ticks + ",IsUpdate=1,UserID=" + user_id + " where emp_id=" + int.Parse(dtgroupdata.Rows[emp]["emp_id"].ToString()) + " and Day_id=" + int.Parse(dr["Day_id"].ToString()) + " and Dateticks=" + dtt1.Ticks + " ");
                                        if (retval == 0)
                                        {
                                            retval = objmysqldb.InsertUpdateDeleteData("insert into employeewise_punchtime_details_datewise (Dateticks,emp_id,Day_id,In_hour,In_min,out_hour,out_min,Ext_Early_hour,Ext_Early_min,Ext_Late_hour,Ext_Late_min,modify_datetime,DOC,IsUpdate,UserID,IsDelete) values (" + dtt1.Ticks + "," + int.Parse(dtgroupdata.Rows[emp]["emp_id"].ToString()) + "," + int.Parse(dr["Day_id"].ToString()) + "," + int.Parse(dr["In_hour"].ToString()) + "," + int.Parse(dr["In_min"].ToString()) + "," + int.Parse(dr["out_hour"].ToString()) + "," + int.Parse(dr["out_min"].ToString()) + "," + int.Parse(dr["Ext_Early_hour"].ToString()) + "," + int.Parse(dr["Ext_Early_min"].ToString()) + "," + int.Parse(dr["Ext_Late_hour"].ToString()) + "," + int.Parse(dr["Ext_Late_min"].ToString()) + "," + currenttimes.Ticks + "," + currenttimes.Ticks + ",1," + user_id + ",0)");
                                        }
                                    }
                                }
                            }
                        }

                        #endregion

                        ltrErr.Text = "Time Group Details Save Successfully";
                        objmysqldb.EndSQLTransaction();
                    }
                    else
                    {
                        ltrErr.Text = "Please Enter valid  Applicable change date";
                        objmysqldb.RollBackSQLTransaction();
                    }
                }
                else
                {
                    ltrErr.Text = "Please try again";
                    return;
                }
            }
            catch (Exception ex)
            {
                objmysqldb.RollBackSQLTransaction();
                Logger.WriteCriticalLog("Manage_TimeGroup 288: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
        public static string saveHolidayProfile(string id, string Name, string userid, string holiday_day)
        {
            MySQLDB dbc = new MySQLDB();

            try
            {
                string msg = "";
                int    ids = 0;
                int.TryParse(id, out ids);

                dbc.ConnectToDatabase();
                DataTable dtHolidayProfile = dbc.GetData("SELECT Holiday_Profile_Id,Holiday_Profile_Name,Holiday_day_id FROM holiday_profile_master ");

                string    response = "";
                DataRow[] drdata   = dtHolidayProfile.Select("Holiday_Profile_Name ='" + Name + "' and  Holiday_Profile_Id <> " + id + " ");
                dbc.OpenSQlConnection();
                dbc.BeginSQLTransaction();
                if (drdata.Length == 0)
                {
                    holiday_day = holiday_day.TrimEnd(',');

                    DateTime currenttime = Logger.getIndiantimeDT();
                    int      user_ids    = 0;
                    int.TryParse(userid, out user_ids);
                    int retval = dbc.InsertUpdateDeleteData("update holiday_profile_master set Holiday_Profile_Name='" + Name + "',modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_ids + ",Holiday_day_id='" + holiday_day + "' where Holiday_Profile_Id=" + id + " ");
                    if (retval == 0)
                    {
                        retval = dbc.InsertUpdateDeleteData("insert into holiday_profile_master (Holiday_Profile_Name,modify_datetime,DOC,IsUpdate,UserID,Holiday_day_id) values ('" + Name + "'," + currenttime.Ticks + "," + currenttime.Ticks + ",1," + user_ids + ",'" + holiday_day + "')");
                        if (retval != 1)
                        {
                            msg = "please try again";
                            Logger.WriteCriticalLog("Holiday_Setup 123 Update error.");
                        }
                        else
                        {
                            msg = "Save sucessfully";
                        }
                    }
                    else
                    {
                        //Holiday setup code
                        DataRow[] drdatas = dtHolidayProfile.Select("Holiday_Profile_Id = " + id + " ");
                        if (drdatas.Length > 0)
                        {
                            string[] old_Weekoff = drdatas[0]["Holiday_day_id"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            string[] New_Weekoff = holiday_day.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            if (old_Weekoff.Length > 0)
                            {
                                string weekoff = "";
                                for (int k = 0; k < old_Weekoff.Length; k++)
                                {
                                    if (!New_Weekoff.Contains(old_Weekoff[k]))
                                    {
                                        weekoff += old_Weekoff[k] + ",";
                                    }
                                }

                                string[] Weekoffday = weekoff.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                if (Weekoffday.Length > 0)
                                {
                                    DataTable dtholidaySetup = dbc.GetData("select distinct Holiday_Month,Holiday_Year from holiday_setup where Holiday_For_Id=2 and Holiday_Profile_Id=" + id + " and IsDelete=0;");
                                    if (dtholidaySetup != null && dtholidaySetup.Rows.Count > 0)
                                    {
                                        int mon  = 0;
                                        int year = 0;
                                        for (int mo = 0; mo < dtholidaySetup.Rows.Count; mo++)
                                        {
                                            int.TryParse(dtholidaySetup.Rows[mo]["Holiday_Month"].ToString(), out mon);
                                            int.TryParse(dtholidaySetup.Rows[mo]["Holiday_Year"].ToString(), out year);
                                            int    LastDate = DateTime.DaysInMonth(year, mon);
                                            string dates    = DateOfGivenDay(Weekoffday, mon, year, LastDate);
                                            dates = dates.TrimEnd(',');
                                            if (!dates.Equals(""))
                                            {
                                                DateTime currenttimes = Logger.getIndiantimeDT();
                                                retval = dbc.InsertUpdateDeleteData("update holiday_setup set modify_datetime=" + currenttimes.Ticks + ",IsUpdate=1,UserID=" + user_ids + ",IsDelete=1 where Holiday_Day IN(" + dates + ") and Holiday_Month=" + mon + " and Holiday_Year=" + year + " and Holiday_Profile_Id=" + id + "  and Holiday_For_Id=2");
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        msg = "Save sucessfully";
                    }

                    dtHolidayProfile = dbc.GetData("SELECT Holiday_Profile_Id,Holiday_Profile_Name FROM holiday_profile_master ");
                    for (int i = 0; i < dtHolidayProfile.Rows.Count; i++)
                    {
                        if (i == 0)
                        {
                            response = response + "-1,";
                            response = response + "Select Holiday Profile ###";
                        }
                        response = response + dtHolidayProfile.Rows[i]["Holiday_Profile_Id"].ToString() + ",";
                        response = response + dtHolidayProfile.Rows[i]["Holiday_Profile_Name"].ToString() + "###";
                    }
                    response = response.TrimEnd('#');
                    response = response + "@@@" + msg;
                }
                else
                {
                    msg      = "Holiday profile name is already exists";
                    response = "@@@" + msg;
                }
                dbc.EndSQLTransaction();
                return(response);
            }
            catch (Exception ex)
            {
                dbc.RollBackSQLTransaction();
                Logger.WriteCriticalLog("Holiday_Setup 206: exception:" + ex.Message + "::::::::" + ex.StackTrace);
                return("@@@please try again");
            }
            finally
            {
                dbc.CloseSQlConnection();
                dbc.disposeConnectionObj();
            }
        }
        public static string MangeHolidays(string id, string type, string date, string reason, string range, string flag, string userid)
        {
            MySQLDB dbc = new MySQLDB();

            try
            {
                int ids = 0;
                int.TryParse(id, out ids);
                int typ = 0;
                int.TryParse(type, out typ);

                int fla = 0;
                int.TryParse(flag, out fla);
                string   msg   = "";
                string[] dates = date.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                int      day   = 0;
                int      mon   = 0;
                int      yea   = 0;
                dbc.ConnectToDatabase();
                int user_ids = 0;
                int.TryParse(userid, out user_ids);
                if (dates.Length == 3)
                {
                    dbc.OpenSQlConnection();
                    int.TryParse(dates[0], out day);
                    int.TryParse(dates[1], out mon);
                    int.TryParse(dates[2], out yea);
                    if (fla == 1) //delete
                    {
                        DateTime currenttime = Logger.getIndiantimeDT();
                        int      retval      = dbc.InsertUpdateDeleteData("update holiday_setup set modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_ids + ",IsDelete=1 where Holiday_Day=" + day + " and Holiday_Month=" + mon + " and Holiday_Year=" + yea + " and Holiday_Profile_Id=" + ids + " ");

                        msg = "Holiday remove Successfully";
                    }
                    else
                    {
                        string[] rangedates = range.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
                        int      start      = 0;
                        int      end        = 0;
                        if (rangedates.Length == 2)
                        {
                            int.TryParse(rangedates[0], out start);
                            int.TryParse(rangedates[1], out end);
                        }
                        int diff = end - start;
                        for (int i = 0; i <= diff; i++)
                        {
                            DateTime currenttime = Logger.getIndiantimeDT();

                            dbc.AddCommandParameter("Holiday_Reason", reason);
                            int retval = dbc.InsertUpdateDeleteData("update holiday_setup set modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_ids + ",Holiday_For_Id=" + typ + ",Holiday_Reason=?Holiday_Reason where Holiday_Day=" + day + " and Holiday_Month=" + mon + " and Holiday_Year=" + yea + " and Holiday_Profile_Id=" + id + "  and IsDelete=0 ");
                            if (retval == 0)
                            {
                                dbc.AddCommandParameter("Holiday_Reason", reason);
                                retval = dbc.InsertUpdateDeleteData("insert into holiday_setup (Holiday_Day,Holiday_Month,Holiday_Year,Holiday_Reason,Holiday_For_Id,Holiday_Profile_Id,modify_datetime,DOC,IsUpdate,IsDelete,UserID) values (" + day + "," + mon + "," + yea + " ,?Holiday_Reason," + typ + "," + id + "," + currenttime.Ticks + "," + currenttime.Ticks + ",1,0," + user_ids + ")");
                                if (retval != 1)
                                {
                                    msg = "Please try again";
                                    Logger.WriteCriticalLog("Holiday_Setup 433 Update error.");
                                    break;
                                }
                            }
                            day++;
                        }
                        if (msg.Equals(""))
                        {
                            msg = "Holiday save Successfully";
                        }
                    }
                }
                else
                {
                    msg = "Please Select Valid Date";
                }


                DataTable dtholiday = dbc.GetData("SELECT Holiday_day_id FROM employee_management.holiday_profile_master where  Holiday_Profile_Id=" + id + " ");
                string    response  = "";

                if (dtholiday != null && dtholiday.Rows.Count > 0)
                {
                    response = dtholiday.Rows[0]["Holiday_day_id"].ToString() + "@@@";
                }
                response = List_of_Holiday(id, dbc, response);
                response = response.TrimEnd('#');
                response = response + "@@##" + msg;
                return(response);
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Holiday_Setup 468: exception:" + ex.Message + "::::::::" + ex.StackTrace);
                return("");
            }
            finally
            {
                dbc.CloseSQlConnection();
                dbc.disposeConnectionObj();
            }
        }