Esempio n. 1
0
        protected void grd_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                ltrErr.Text = "";
                objmysqldb.ConnectToDatabase();

                int grp_id = 0;
                if (e.CommandName == "Edit")
                {
                    int.TryParse(e.CommandArgument.ToString(), out grp_id);
                    if (grp_id > 0)
                    {
                        Response.Redirect("~/Manage_TimeGroup.aspx?TimegrpId=" + grp_id + "", false);
                    }
                }
                else if (e.CommandName == "del")
                {
                    int.TryParse(e.CommandArgument.ToString(), out grp_id);
                    DateTime  currenttimes     = Logger.getIndiantimeDT();
                    DataTable dttimegrpDetails = objmysqldb.GetData("SELECT emp_id from time_group_assign_emplyee_wise where Group_id=" + grp_id + " and IsDelete=0 ");
                    if (dttimegrpDetails != null && dttimegrpDetails.Rows.Count == 0)
                    {
                        int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                        objmysqldb.OpenSQlConnection();
                        string query = "update group_master set IsDelete=1,modify_datetime=" + currenttimes.Ticks + ",IsUpdate=1,UserID=" + user_id + "  where Group_id=" + grp_id + "";
                        int    res   = objmysqldb.InsertUpdateDeleteData(query);

                        query = "update employee_punchtime_details_datewise set IsDelete=1,modify_datetime=" + currenttimes.Ticks + ",IsUpdate=1,UserID=" + user_id + "  where time_grp_id=" + grp_id + "";
                        res   = objmysqldb.InsertUpdateDeleteData(query);

                        if (res != 1)
                        {
                            ltrErr.Text = "Please Try Again.";
                            Logger.WriteCriticalLog("Time_Group_List 170 Update error.");
                        }
                        else
                        {
                            grd.EditIndex = -1;
                            getBinddata();
                            ltrErr.Text = "Attendance Time Group Deleted Successfully.";
                        }
                    }
                    else
                    {
                        ltrErr.Text = "Employee Assign to select Time Group so you can't delete it.";
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Time_Group_List 188: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ltrErr.Text = "";
                if (!grp_idHidden.Value.ToString().Equals("0") && grp_idHidden.Value != "")
                {
                    update_emp_group();
                    return;
                }
                int grpid = 0;
                objmysqldb.ConnectToDatabase();
                objmysqldb.OpenSQlConnection();
                int.TryParse(grp_idHidden.Value.ToString(), out grpid);
                int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                int emp = 0;
                int.TryParse(ddlemplist.Items[ddlemplist.SelectedIndex].Value.ToString(), out emp);
                int grp = 0;
                int.TryParse(ddlgrouplist.Items[ddlgrouplist.SelectedIndex].Value.ToString(), out grp);
                DateTime  currenttime = Logger.getIndiantimeDT();
                DataTable dtdata      = objmysqldb.GetData("select * from employee_app_module_rights where module_group_id<>" + grp + " and emp_id=" + emp + "");
                DataTable dtdata_emp  = objmysqldb.GetData("select * from employee_app_module_rights where module_group_id=" + grp + " and emp_id=" + emp + "");
                if (ddlgrouplist.SelectedIndex < 1 || ddlemplist.SelectedIndex < 1)
                {
                    ltrErr.Text = "Please Select All Details.";
                }
                else
                {
                    string query = "Insert into  employee_app_module_rights(module_group_id,emp_id,modify_datetime,DOC,IsDelete,IsUpdate,UserID) values (" + grp + "," + emp + "," + currenttime.Ticks + "," + currenttime.Ticks + ",0,1," + user_id + ")";
                    int    res   = objmysqldb.InsertUpdateDeleteData(query);
                    if (res != 1)
                    {
                        ltrErr.Text = "Please Try Again.";

                        Logger.WriteCriticalLog("employeeassigngroup 209 Update error.");
                    }
                    else
                    {
                        Search();
                        bindgroup();
                        bindemployee();
                        ltrErr.Text = "Group Assign to Employee Successfully";
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("employeeassigngroup 224: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 3
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 btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                ltrErr.Text = "";
                if (!txtdesignames.Text.ToString().Equals(""))
                {
                    objmysqldb.ConnectToDatabase();
                    DataTable dtdesigList = objmysqldb.GetData("select designation_id,Designation_Name from designation_master where Designation_Name like '" + txtdesignames.Text.ToString() + "' and IsDelete=0  ;");

                    if (dtdesigList != null && dtdesigList.Rows.Count > 0)
                    {
                        ltrErr.Text = " Designation Is Already Exist.";
                        return;
                    }

                    DateTime currenttime = Logger.getIndiantimeDT();
                    int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                    objmysqldb.AddCommandParameter("designame", txtdesignames.Text.ToString());
                    string query = "Insert into  designation_master (Designation_Name,DOC,UserID,IsDelete,IsUpdate,modify_datetime,IsMasterData) values (?designame," + currenttime.Ticks + "," + user_id + ",0,1," + currenttime.Ticks + ",1) ";
                    objmysqldb.OpenSQlConnection();
                    int res = objmysqldb.InsertUpdateDeleteData(query);
                    if (res != 1)
                    {
                        ltrErr.Text = "Please Try Again.";
                        Logger.WriteCriticalLog("ManageDesignation 111 Update error.");
                    }
                    else
                    {
                        grd.EditIndex = -1;
                        showgrid();
                        ltrErr.Text        = "Designation Save Successfully.";
                        txtdesignames.Text = "";
                    }
                }
                else
                {
                    ltrErr.Text = "Please Enter All Details.";
                    return;
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("ManageDesignation 128: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
        protected void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                ltrErr.Text = "";
                if (!txtschID.Text.ToString().Equals("") && !txtschnames.Text.ToString().Equals(""))
                {
                    objmysqldb.ConnectToDatabase();
                    DataTable dtschList = objmysqldb.GetData("Select * from school_list WHERE IsDelete=0 and (School_Name like '" + txtschnames.Text.ToString() + "' OR School_Id = " + int.Parse(txtschID.Text.ToString()) + ")  ");
                    if (dtschList != null && dtschList.Rows.Count > 0)
                    {
                        ltrErr.Text = " Organization  Is Already Exist";
                        return;
                    }
                    DateTime currenttime = Logger.getIndiantimeDT();
                    int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                    objmysqldb.AddCommandParameter("schanme", txtschnames.Text.ToString());
                    string query = "Insert into  school_list (School_Name,School_Id,DOC,UserID,IsDelete,IsUpdate,modify_datetime) values (?schanme," + int.Parse(txtschID.Text.ToString()) + "," + currenttime.Ticks + "," + user_id + ",0,1," + currenttime.Ticks + ") ";
                    objmysqldb.OpenSQlConnection();
                    int res = objmysqldb.InsertUpdateDeleteData(query);
                    if (res != 1)
                    {
                        ltrErr.Text = "Please Try Again.";

                        Logger.WriteCriticalLog("Manage_Organization 110 Update error.");
                    }
                    else
                    {
                        grd.EditIndex = -1;
                        showgrid();
                        ltrErr.Text      = "Organization Save Successfully";
                        txtschID.Text    = "";
                        txtschnames.Text = "";
                    }
                }
                else
                {
                    ltrErr.Text = "Please Enter All Details.";
                    return;
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Manage_Organization 130: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 6
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                ltrErr.Text = "";
                if (!txtcategorynames.Text.ToString().Equals(""))
                {
                    objmysqldb.ConnectToDatabase();
                    DataTable dtcategory = objmysqldb.GetData("Select * from category_master WHERE (category_name like '" + txtcategorynames.Text.ToString() + "') and  IsDelete=0  ");
                    if (dtcategory != null && dtcategory.Rows.Count > 0)
                    {
                        ltrErr.Text = " Category Is Already Exist";
                        return;
                    }
                    DateTime currenttime = Logger.getIndiantimeDT();
                    int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                    objmysqldb.AddCommandParameter("categoryname", txtcategorynames.Text.ToString());
                    string query = "Insert into  category_master (category_name,UserID,modify_datetime,DOC,IsUpdate,IsMasterData,IsDelete) values (?categoryname," + user_id + "," + currenttime.Ticks + "," + currenttime.Ticks + ",1,1,0) ";
                    objmysqldb.OpenSQlConnection();
                    int res = objmysqldb.InsertUpdateDeleteData(query);
                    if (res != 1)
                    {
                        ltrErr.Text = "Please Try Again.";

                        Logger.WriteCriticalLog("Manage_Category 106 Update error.");
                    }
                    else
                    {
                        grd.EditIndex = -1;
                        showgrid();
                        txtcategorynames.Text = "";
                        ltrErr.Text           = "Category Save Successfully.";
                    }
                }
                else
                {
                    ltrErr.Text = "Please Enter All Details.";
                    return;
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Manage_Category 125: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 7
0
 protected void grd_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         ltrErr.Text = "";
         objmysqldb.ConnectToDatabase();
         int reportgrpid = 0;
         int.TryParse(e.CommandArgument.ToString(), out reportgrpid);
         if (e.CommandName == "Edit")
         {
             if (reportgrpid > 0)
             {
                 Response.Redirect("~/ManageEmployeeGroupReports.aspx?repgrp=" + reportgrpid + "", false);
             }
         }
         else if (e.CommandName == "del")
         {
             int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
             DateTime currenttime = Logger.getIndiantimeDT();
             string   query       = "Update report_group_list set IsDelete=1,modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_id + " where report_grp_id=" + reportgrpid + " ";
             objmysqldb.OpenSQlConnection();
             int res = objmysqldb.InsertUpdateDeleteData(query);
             if (res != 1)
             {
                 ltrErr.Text = "Please Try Again.";
                 Logger.WriteCriticalLog("EmployeeGroupForReports 131 Update error.");
             }
             else
             {
                 ltrErr.Text = "Report Group Delete Successfully";
             }
             grd.EditIndex = -1;
             bindgvdata();
         }
         else if (e.CommandName == "Img")
         {
             if (reportgrpid > 0)
             {
                 Response.Redirect("~/ManageEmployeeGroupReportsHeaderImage.aspx?repgrp=" + reportgrpid + "", false);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.WriteCriticalLog("EmployeeGroupForReports 150:: exception:" + ex.Message + "::::::::" + ex.StackTrace);
     }
     finally
     {
         objmysqldb.CloseSQlConnection();
         objmysqldb.disposeConnectionObj();
     }
 }
Esempio n. 8
0
        protected void btnsaveA4L_Click(object sender, EventArgs e)
        {
            try
            {
                ltrA4L.Text = "";
                ltrLL.Text  = "";
                ltrLP.Text  = "";
                objmysqldb.ConnectToDatabase();
                if (fileA4L.HasFile)
                {
                    string uploadFolderPath = "~/HeaderImages/";
                    string filePath         = HttpContext.Current.Server.MapPath(uploadFolderPath);
                    if (!Directory.Exists(filePath))
                    {
                        Directory.CreateDirectory(filePath);
                    }
                    if (fileA4L.FileName.ToString().ToLower().Equals("HeaderImages.jpg"))
                    {
                    }
                    else
                    {
                        string ext  = System.IO.Path.GetExtension(fileA4L.FileName.ToString());
                        long   mode = Logger.getIndiantimeDT().Ticks;
                        int.TryParse(Request.QueryString["repgrp"].ToString(), out repgrp);
                        string fileName = repgrp.ToString() + "_" + "A4Landscape" + "_" + mode + ext;

                        fileA4L.SaveAs(filePath + "\\" + fileName);
                        string imgPath;
                        imgPath = System.IO.Path.Combine(filePath, fileName);
                        System.Drawing.Image img = System.Drawing.Image.FromFile(imgPath);
                        IMgA4L.ImageUrl = "~/HeaderImages/" + "/" + fileName.ToString();

                        objmysqldb.OpenSQlConnection();
                        objmysqldb.AddCommandParameter("A4L_Img", fileName);
                        int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                        int retval = objmysqldb.InsertUpdateDeleteData("update report_group_list set A4L_Img=?A4L_Img,modify_datetime=" + mode + ",IsUpdate=1,UserID=" + user_id + " where report_grp_id=" + repgrp + " ");
                        if (retval > 0)
                        {
                            ltrA4L.Text = "Header Image Update Successfully";
                        }
                        else
                        {
                            ltrA4L.Text = "Header Image Not Update Successfully";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("ManageEmployeeGroupReportsHeaderImage 169: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
        protected void saveData()
        {
            int val = 0;

            try
            {
                objmysqldb.ConnectToDatabase();
                objmysqldb.OpenSQlConnection();
                DataTable gridTable = (DataTable)grdEmplist.DataSource;
                DataTable dt        = GetDataTable(grdEmplist);
                foreach (GridViewRow row in grdEmplist.Rows)
                {
                    TextBox txtpayscale1 = (TextBox)row.FindControl("txtpayscale");
                    // HtmlInputText txtpayscale1 = (HtmlInputText)row.FindControl("txtpayscale");
                    Label    EmpId       = (Label)grdEmplist.Rows[row.RowIndex].FindControl("lblEmp_id");
                    DateTime currenttime = Logger.getIndiantimeDT();
                    double   salary      = 0;
                    double.TryParse(txtpayscale1.Text.ToString(), out salary);
                    int empidint = int.Parse(EmpId.Text.ToString());
                    if (salary > 0)
                    {
                        int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                        val = objmysqldb.InsertUpdateDeleteData("UPDATE employee_master SET modify_datetime='" + currenttime.Ticks + "',PayScale=" + salary + ",IsUpdate=1,UserID=" + user_id + "  WHERE EmpId=" + empidint + " ");
                    }
                }
                if (val == 1)
                {
                    ltrErr.Text     = "Data  Updated Successfully....";
                    btnsave.Visible = true;
                    int gid = 0;
                    //if(Session.co)
                    if (Session["grpid"] != null)
                    {
                        int.TryParse(Session["grpid"].ToString(), out gid);
                    }
                    BindGrid(gid);
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("SalaryConfiguration 194: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 10
0
        protected void grd_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                objmysqldb.ConnectToDatabase();
                objmysqldb.OpenSQlConnection();
                if (e.CommandName == "Edit")
                {
                    int.TryParse(e.CommandArgument.ToString(), out profileid);
                    if (profileid > 0)
                    {
                        Response.Redirect("~/addnewqueryprofile.aspx?profile=" + profileid + "", false);
                    }
                }
                else if (e.CommandName == "del")
                {
                    int.TryParse(e.CommandArgument.ToString(), out profileid);
                    DateTime curtime = Logger.getIndiantimeDT();
                    int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                    string query = "update employee_query_profile set IsDelete=1,modify_datetime=" + curtime.Ticks + ",IsUpdate=1,,UserID=" + user_id + " where Profile_Id=" + profileid + "";
                    int    res   = objmysqldb.InsertUpdateDeleteData(query);
                    if (res != 1)
                    {
                        ltrErr.Text = "Please Try Again.";

                        Logger.WriteCriticalLog("addeditprofile 129 Update error.");
                    }
                    else
                    {
                        grd.EditIndex = -1;
                        showgrid();
                        ltrErr.Text = "Profile Deleted Successfully.";
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("addeditprofile 142: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 11
0
        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();
            }
        }
Esempio n. 12
0
        public static string saveDefaultSetup(string id, string month, string userid)
        {
            MySQLDB dbc = new MySQLDB();

            try
            {
                int ids = 0;
                int.TryParse(id, out ids);
                string[] months = month.Split('@');
                int      mon    = 0;
                int      year   = 0;
                int.TryParse(months[0], out mon);
                int.TryParse(months[1], out year);

                int LastDate = DateTime.DaysInMonth(year, mon);
                dbc.ConnectToDatabase();
                int user_ids = 0;
                int.TryParse(userid, out user_ids);

                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)
                {
                    string[] Weekoff = dtholiday.Rows[0]["Holiday_day_id"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                    string dates = DateOfGivenDay(Weekoff, mon, year, LastDate);
                    dates = dates.TrimEnd(',');
                    string[] date = dates.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    dbc.OpenSQlConnection();
                    dbc.BeginSQLTransaction();
                    for (int i = 0; i < date.Length; i++)
                    {
                        DateTime currenttime = Logger.getIndiantimeDT();
                        int      retval      = dbc.InsertUpdateDeleteData("update holiday_setup set modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_ids + " where Holiday_Day=" + int.Parse(date[i].ToString()) + " and Holiday_Month=" + mon + " and Holiday_Year=" + year + " and Holiday_Profile_Id=" + id + "  and IsDelete=0 ");
                        if (retval == 0)
                        {
                            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 (" + int.Parse(date[i].ToString()) + "," + mon + "," + year + " ,'Week off',2," + id + "," + currenttime.Ticks + "," + currenttime.Ticks + ",1,0," + user_ids + ")");
                            if (retval != 1)
                            {
                                dbc.RollBackSQLTransaction();
                                Logger.WriteCriticalLog("Holiday_Setup 302 Update error.");
                                return(response);
                            }
                        }
                    }

                    response = dtholiday.Rows[0]["Holiday_day_id"].ToString() + "@@@";
                }
                dbc.EndSQLTransaction();
                response = List_of_Holiday(id, dbc, response);
                response = response.TrimEnd('#');

                return(response);
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Holiday_Setup 321: exception:" + ex.Message + "::::::::" + ex.StackTrace);
                return("");
            }
            finally
            {
                dbc.CloseSQlConnection();
                dbc.disposeConnectionObj();
            }
        }
Esempio n. 13
0
        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();
            }
        }
        private void savedata()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                ltrErr.Text = "";
                int rep_grp = 0;
                int.TryParse(report_grp.Value.ToString(), out rep_grp);
                if (txtgroup.Text.Equals(""))
                {
                    ltrErr.Text = "Please enter Report Group Name";
                    return;
                }
                DataTable dtprevData = objmysqldb.GetData("select report_grp_id from report_group_list where IsDelete=0 and report_grp_name = '" + txtgroup.Text.ToString() + "' ");
                //if (dtprevData != null && dtprevData.Rows.Count > 0)
                //{
                //    ltrErr.Text = "Report Group Name Is Already Exsits";
                //    return;
                //}
                string emp_ids = "";
                foreach (GridViewRow row in GridView1.Rows)
                {
                    CheckBox chkshow = (CheckBox)row.FindControl("cbSelect");
                    if (chkshow.Checked)
                    {
                        int   emp_id = 0;
                        Label emp    = (Label)row.FindControl("lblemp_id");
                        int.TryParse(emp.Text.ToString(), out emp_id);
                        emp_ids += emp_id + ",";
                    }
                }
                if (emp_ids.Equals(""))
                {
                    ltrErr.Text = "Please select atleast one emoloyee";
                    return;
                }
                else
                {
                    emp_ids = emp_ids.TrimEnd(',');
                    DateTime currentTime = Logger.getIndiantimeDT();
                    int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                    objmysqldb.OpenSQlConnection();
                    objmysqldb.AddCommandParameter("report_grp_name", txtgroup.Text.ToString());
                    int retval = objmysqldb.InsertUpdateDeleteData("update report_group_list set modify_datetime=" + currentTime.Ticks + ",IsDelete=0,IsUpdate=1,UserID=" + user_id + ",emp_ids='" + emp_ids + "',Is_Default=0,report_grp_name=?report_grp_name where report_grp_id=" + rep_grp + "  ");

                    if (retval == 0)
                    {
                        long mode = Logger.getIndiantimeDT().Ticks;
                        objmysqldb.AddCommandParameter("report_grp_name", txtgroup.Text.ToString());
                        if (dtprevData != null && dtprevData.Rows.Count > 0)
                        {
                            ltrErr.Text = "Report Group Name Is Already Exsits";
                            return;
                        }
                        retval = objmysqldb.InsertUpdateDeleteData("insert into report_group_list (emp_ids,modify_datetime,DOC,IsDelete,IsUpdate,UserID,report_grp_name,Is_Default) values ('" + emp_ids + "'," + mode + "," + currentTime.Ticks + ",0,1," + user_id + ",?report_grp_name,0) ");

                        if (retval != 1)
                        {
                            ltrErr.Text = "please try again";

                            Logger.WriteCriticalLog("ManageEmployeeGroupReports 204 Update error.");
                            return;
                        }
                        rep_grp = int.Parse(objmysqldb.LastNo("report_group_list", "report_grp_id", mode).ToString());
                        if (rep_grp == 1)
                        {
                            objmysqldb.InsertUpdateDeleteData("update report_group_list set Is_Default=1 where report_grp_id=" + rep_grp + "  ");
                        }
                    }
                    if (chkIsDefault.Checked)
                    {
                        objmysqldb.InsertUpdateDeleteData("update report_group_list set modify_datetime=" + currentTime.Ticks + ",IsDelete=0,IsUpdate=1,UserID=" + user_id + ",Is_Default=0  ");
                        objmysqldb.InsertUpdateDeleteData("update report_group_list set Is_Default=1 where report_grp_id=" + rep_grp + " ");
                    }
                }

                int flg = 0;
                if (chkleft.Checked)
                {
                    flg = 1;
                }
                bindgvdata(rep_grp, flg);
                ltrErr.Text = "Report group Assign to employee Successfully.";
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("ManageEmployeeGroupReports 243: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 15
0
        protected void saveData()
        {
            getLeaveList();
            //   btnsave.Enabled = false;
            try
            {
                objmysqldb.ConnectToDatabase();
                objmysqldb.OpenSQlConnection();
                mid = int.Parse(ddlmonthlist.SelectedIndex.ToString());
                mid = mid + 1;
                yid = int.Parse(ddlyear.SelectedValue.ToString());
                if (mid == 0 || yid == 0)
                {
                    ltrErr.Text = "Select Valid Month And Year...";
                    return;
                }
                int colpos = 2;
                int val    = 0;
                System.Collections.Hashtable hsLeavePos = new System.Collections.Hashtable();
                colpos++;
                hsLeavePos.Add(-4, colpos);
                colpos++;
                hsLeavePos.Add(-1, colpos);
                colpos++;
                DataRow[] ClLeave = leaveList.Select("Is_CL_Leave=0");
                hsLeavePos.Add(int.Parse(ClLeave[0]["Leave_Id"].ToString()), colpos);
                colpos++;
                DataRow[] MlLeave = leaveList.Select("Is_CL_Leave=1");
                hsLeavePos.Add(int.Parse(MlLeave[0]["Leave_Id"].ToString()), colpos);
                foreach (GridViewRow row in grdEmplist.Rows)
                {
                    Label    EmpId       = (Label)grdEmplist.Rows[row.RowIndex].FindControl("lblEmp_id");
                    Label    FP_Id       = (Label)grdEmplist.Rows[row.RowIndex].FindControl("lblFpId");
                    TextBox  txtlcl      = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtlcl");
                    TextBox  txtlwp      = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtlwp");
                    TextBox  txtcl       = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtcl");
                    TextBox  txtml       = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtml");
                    DateTime currenttime = Logger.getIndiantimeDT();
                    int      empidint    = int.Parse(EmpId.Text.ToString());
                    int      FPIdint     = int.Parse(FP_Id.Text.ToString());
                    double   lcl         = 0;
                    double.TryParse(txtlcl.Text.ToString(), out lcl);
                    double lwp = 0;
                    double.TryParse(txtlwp.Text.ToString(), out lwp);
                    double cl = 0;
                    double.TryParse(txtcl.Text.ToString(), out cl);
                    double ml = 0;
                    double.TryParse(txtml.Text.ToString(), out ml);
                    foreach (DictionaryEntry keyId in hsLeavePos)
                    {
                        int    leaveid    = (int)keyId.Key;
                        int    firstindex = (int)keyId.Value;
                        string ColName    = grdEmplist.Columns[firstindex].HeaderText.ToString();

                        double Total_Leave = 0;
                        if (ColName == "LWP")
                        {
                            //int leaveid = 1;
                            Total_Leave = lwp;
                        }
                        if (ColName.ToLower() == "lcl")
                        {
                            Total_Leave = lcl;
                        }
                        if (ColName.ToLower() == "cl")
                        {
                            Total_Leave = cl;
                        }
                        if (ColName.ToLower() == "ml")
                        {
                            Total_Leave = ml;
                        }

                        if (Total_Leave > 0)
                        {
                            val = objmysqldb.InsertUpdateDeleteData("update Leave_History_Monthwise set IsUpdate=1,Total_Leave=" + Total_Leave + ",modify_datetime=" + currenttime.Ticks + ",DOC=" + currenttime.Ticks + " where Emp_Id=" + empidint + " and Leave_Id=" + leaveid + " and Month_Id=" + mid + " and Month_Year=" + yid + " ");
                            if (val == 0)
                            {
                                val = objmysqldb.InsertUpdateDeleteData("INSERT INTO  Leave_History_Monthwise(Emp_Id,Leave_Id,Total_Leave,Month_Id,Month_Year,modify_datetime,DOC,IsUpdate,Isdelete,UserID)values(" + empidint + "," + leaveid + "," + Total_Leave + "," + mid + "," + yid + "," + currenttime.Ticks + "," + currenttime.Ticks + " ,0,0," + user_id + ") ");
                            }
                        }
                    }
                    if (val == 1)
                    {
                        ltrErr.Text     = "Data Updated Successfully..";
                        btnsave.Visible = true;
                        // BindEmpLeave(mid, yid);
                    }

                    //mid = int.Parse(ddlmonthlist.SelectedIndex.ToString());
                    //mid = mid + 1;
                }
                BindEmpLeave(mid, int.Parse(ddlyear.SelectedValue.ToString()), int.Parse(ddlgrouplist.SelectedIndex.ToString()));
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("EmpLeaveConfiguration 399: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 16
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            objmysqldb.ConnectToDatabase();
            objmysqldb.OpenSQlConnection();
            try
            {
                string    Emp_Ids        = "";
                DataTable dtAllDate      = objmysqldb.GetData("SELECT Dateticks,emp_id,Day_id From  employee_management.employeewise_punchtime_details_datewise;");
                DateTime  currentTime    = Logger.getIndiantimeDT();
                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;
                string[]  intime         = txtinTime.Text.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                string[]  outtime        = txtoutTime.Text.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                string[]  Earlytime      = txtExtremeEarly.Text.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                string[]  latetime       = txtExtremeLate.Text.ToString().Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                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;
                }
                //Control ctl = this.FindControlRecursive("btnAccept");
                string str = string.Empty;
                foreach (GridViewRow gvrow in GrdEmpList.Rows)
                {
                    CheckBox chk = (CheckBox)gvrow.FindControl("chkSelect");

                    if (chk.Checked && chk != null)
                    {
                        Label emp = (Label)gvrow.FindControl("lblemp_id");
                        Emp_Ids += emp.Text.ToString() + ",";
                    }
                }
                string dt = "";
                foreach (GridViewRow row in GvMonth.Rows)
                {
                    CheckBox chkdt = (CheckBox)row.FindControl("Select");
                    if (chkdt.Checked && chkdt != null)
                    {
                        Label date1 = (Label)row.FindControl("lblDate");
                        dt += date1.Text.ToString() + ",";
                    }
                }
                dt      = dt.TrimEnd(',');
                Emp_Ids = Emp_Ids.TrimEnd(',');
                string date = lblDate1.Text.ToString();
                //DateTime oDate = Convert.ToDateTime(date.ToString());
                //long Tikcs = oDate.Ticks;
                //DateTime dtNew = new DateTime(Tikcs);
                //int day1 = (int)dtNew.DayOfWeek;
                string[] arrempid = Emp_Ids.Split(',');
                int      dayid    = 0;

                long     Tikcs = 0;
                string[] dates = dt.Split(',');
                dates = dates.Where(s => !String.IsNullOrEmpty(s)).ToArray();
                //string[] dates = !String.IsNullOrEmpty(dt)).ToArray();
                if (dates != null && dates.Length == 0)
                {
                    DateTime oDate = Convert.ToDateTime(date.ToString());
                    Tikcs = oDate.Ticks;
                    //DateTime dtNew = new DateTime(Tikcs);
                    dayid = (int)oDate.DayOfWeek;
                    if (dayid == 0)
                    {
                        dayid = 7;
                    }
                }

                if (arrempid != null && arrempid.Length > 0)
                {
                    int Yes = 0;

                    for (int j = 0; j < arrempid.Length; j++)
                    {
                        string EmpID = arrempid[j].ToString();
                        if (dates != null && dates.Length == 0)
                        {
                            //DataRow[] dr = dtAllDate.Select("emp_id=" + EmpID + " And Day_id=" + dayid + " and Dateticks in('" + Tikcs + "')");
                            DataRow[] dr = dtAllDate.Select("emp_id=" + EmpID + " And Day_id=" + dayid + " and Dateticks=" + Tikcs + "");
                            if (dayid == 0)
                            {
                                dayid = 7;
                            }
                            if (dr.Length > 0)
                            {
                                Yes = objmysqldb.InsertUpdateDeleteData("update employeewise_punchtime_details_datewise set In_hour=" + In_hour + ",In_min=" + In_min + ",out_hour=" + out_hour + ",out_min=" + out_min + " ,Ext_Early_hour=" + Ext_Early_hour + ",Ext_Early_min=" + Ext_Early_min + ",Ext_Late_hour=" + Ext_Late_hour + ",Ext_Late_min=" + Ext_Late_min + ",modify_datetime=" + MySQLDB.GetIndianTime().Ticks.ToString() + ",IsUpdate=1, UserID= " + user_id + "  where emp_id=" + EmpID + " and Day_id=" + dayid);
                            }
                            else
                            {
                                Yes = 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_Late_hour,Ext_Late_min,Ext_Early_min,modify_datetime,IsDelete,DOC,IsUpdate,UserID)Values(" + Tikcs + "," + EmpID + "," + dayid + "," + In_hour + "," + In_min + "," + out_hour + "," + out_min + "," + Ext_Early_hour + "," + Ext_Late_hour + "," + Ext_Late_min + "," + Ext_Early_min + "," + MySQLDB.GetIndianTime().Ticks.ToString() + ",0," + MySQLDB.GetIndianTime().Ticks.ToString() + ",1," + user_id + ")");
                            }
                        }
                        else
                        {
                            for (int dat = 0; dat < dates.Length; dat++)
                            {
                                string   dt1   = dates[dat].ToString();
                                DateTime oDate = Convert.ToDateTime(dt1.ToString());
                                Tikcs = oDate.Ticks;
                                dayid = (int)oDate.DayOfWeek;
                                if (dayid == 0)
                                {
                                    dayid = 7;
                                }
                                //DataRow[] dr = dtAllDate.Select("emp_id=" + EmpID + " And Day_id=" + dayid + " and Dateticks in('" + Tikcs + "')");
                                DataRow[] dr = dtAllDate.Select("emp_id=" + EmpID + " And Day_id=" + dayid + " and Dateticks=" + Tikcs + "");
                                if (dr.Length > 0)
                                {
                                    Yes = objmysqldb.InsertUpdateDeleteData("update employeewise_punchtime_details_datewise set In_hour=" + In_hour + ",In_min=" + In_min + ",out_hour=" + out_hour + ",out_min=" + out_min + " ,Ext_Early_hour=" + Ext_Early_hour + ",Ext_Early_min=" + Ext_Early_min + ",Ext_Late_hour=" + Ext_Late_hour + ",Ext_Late_min=" + Ext_Late_min + ",modify_datetime=" + MySQLDB.GetIndianTime().Ticks.ToString() + ",IsUpdate=1, UserID= " + user_id + "  where emp_id=" + EmpID + " and Day_id=" + dayid);
                                }
                                else
                                {
                                    Yes = 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_Late_hour,Ext_Late_min,Ext_Early_min,modify_datetime,IsDelete,DOC,IsUpdate,UserID)Values(" + Tikcs + "," + EmpID + "," + dayid + "," + In_hour + "," + In_min + "," + out_hour + "," + out_min + "," + Ext_Early_hour + "," + Ext_Late_hour + "," + Ext_Late_min + "," + Ext_Early_min + "," + MySQLDB.GetIndianTime().Ticks.ToString() + ",0," + MySQLDB.GetIndianTime().Ticks.ToString() + ",1," + user_id + ")");
                                }
                            }
                        }
                    }
                    if (Yes == -1)
                    {
                        ltrErr1.Text = "Error While Saving..";
                    }
                    else
                    {
                        ltrErr1.Text = "Time Configuration Saved...";
                    }
                }
                else
                {
                    ltrErr1.Text = "Select Atleast One Employee...";
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("TimeConfigForEmp BenSaveClick(): exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
        protected void btnsave_Click(object sender, EventArgs e)
        {
            ltrErr.Text = "";
            try
            {
                objmysqldb.ConnectToDatabase();
                int fid        = 0;
                int sortnumber = 0;
                //for (int i = 0; i < grd.Rows.Count; i++)
                //{
                //    DataTable dataTable = (DataTable)grd.DataSource;
                //    foreach (DataRow dr in dataTable.Rows)
                //    {
                //        TextBox txtsno = (TextBox)grd.Rows[i].Cells[1].FindControl("txtsortnumber");
                //        if (dr["SortNumber"].ToString() == txtsno.Text)
                //        {
                //            ltrErr.Text = "Sort Number already exist";
                //            break;
                //        }
                //    }
                //}
                objmysqldb.OpenSQlConnection();
                foreach (GridViewRow row in grd.Rows)
                {
                    CheckBox chk1     = (CheckBox)row.FindControl("cbSelect");
                    TextBox  txtfield = new TextBox();
                    Label    lblfid   = new Label();
                    TextBox  txtsort  = new TextBox();
                    txtfield = (TextBox)row.FindControl("txtDisplay_Name");
                    lblfid   = (Label)row.FindControl("lblEmployee_Field_id");
                    txtsort  = (TextBox)row.FindControl("txtsortnumber");
                    string fieldname = txtfield.Text.ToString().Trim();
                    int.TryParse(txtsort.Text.ToString(), out sortnumber);
                    int.TryParse(lblfid.Text.ToString(), out fid);
                    DateTime  currenttime = Logger.getIndiantimeDT();
                    DataTable dtsort      = objmysqldb.GetData("Select * from employee_search_field_config where SortNumber=" + sortnumber + " and Is_Show=1 and Employee_field_id<>" + fid + "");
                    if (chk1.Checked)
                    {
                        if (fieldname == "")
                        {
                            ltrErr.Text = "Please Enter Field Display Name.";
                            return;
                        }
                        else
                        {
                            if (dtsort.Rows.Count > 0 && dtsort != null)
                            {
                                ltrErr.Text = "Please Enter Different Sort Number";
                                return;
                            }
                            else
                            {
                                //objmysqldb.ConnectToDatabase();
                                objmysqldb.AddCommandParameter("fieldname", fieldname);
                                int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                                string query = "update employee_search_field_config set FieldDisplayName=?fieldname,Is_Show=1,modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_id + ", SortNumber=" + sortnumber + " where Employee_Field_id=" + fid + "";

                                int res = objmysqldb.InsertUpdateDeleteData(query);
                                if (res != 1)
                                {
                                    ltrErr.Text = "Please Try Again.";
                                    Logger.WriteCriticalLog("DisplayColumnConfigurationForSearchEmployee 188 Update error.");
                                    return;
                                }
                                else
                                {
                                    grd.EditIndex = -1;
                                    chk1.Checked  = true;
                                    ltrErr.Text   = "Save successfully.";
                                }
                            }
                        }
                    }
                    else
                    {
                        if (fieldname == "")
                        {
                            ltrErr.Text = "Please Enter Field Display Name.";
                            return;
                        }
                        else
                        {
                            // objmysqldb.ConnectToDatabase();
                            objmysqldb.AddCommandParameter("fieldname", fieldname);
                            int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                            string query = "update employee_search_field_config set FieldDisplayName=?fieldname,Is_Show=0,modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_id + " ,SortNumber=" + sortnumber + " where Employee_Field_id=" + fid + "";
                            int    res   = objmysqldb.InsertUpdateDeleteData(query);
                            if (res != 1)
                            {
                                ltrErr.Text = "Please Try Again.";
                                Logger.WriteCriticalLog("DisplayColumnConfigurationForSearchEmployee 218 Update error.");
                                return;
                            }
                            else
                            {
                                grd.EditIndex = -1;
                                chk1.Checked  = false;
                                ltrErr.Text   = "Save successfully.";
                            }
                        }
                    }
                }
                showgrid();
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("DisplayColumnConfigurationForSearchEmployee 234: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
        protected void grd_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                objmysqldb.ConnectToDatabase();
                ltrErr.Text = "";
                if (e.CommandName == "Edit")
                {
                    DataTable dtnew = dt1.Copy();
                    string    arg   = e.CommandArgument.ToString();
                    int.TryParse(e.CommandArgument.ToString(), out groupid);
                    grp_idHidden.Value = groupid.ToString();
                    DataTable dtlist       = objmysqldb.GetData("Select * from employee_app_module_group where module_group_id=" + groupid + "");
                    DataTable dtmodulelist = new DataTable();
                    dtmodulelist = objmysqldb.GetData("select * from employee_module_master where IsDelete=0");
                    dtmodulelist.Columns.Add("Select");
                    dtmodulelist.Columns.Add("sort", typeof(Int32));
                    if (dtmodulelist.Rows.Count > 0)
                    {
                        for (int x = 0; x < dtmodulelist.Rows.Count; x++)
                        {
                            dtmodulelist.Rows[x]["Select"] = 0;
                        }
                    }
                    txtgroup.Text = dtlist.Rows[0]["module_group_name"].ToString();
                    for (int i = 0; i < dtlist.Rows.Count; i++)
                    {
                        string   mids = dtlist.Rows[i]["module_ids"].ToString();
                        string[] ar   = mids.Split(',');
                        //for (int a = 0; a < dtmodulelist.Rows.Count; a++)
                        //{
                        //    if (mids.Contains(dtmodulelist.Rows[a]["module_id"].ToString()))
                        //    {
                        //        dtmodulelist.Rows[a]["Select"] = 1;
                        //    }
                        //    else
                        //    {
                        //        dtmodulelist.Rows[a]["Select"] = 0;
                        //    }
                        //}
                        for (int a = 0; a < ar.Length; a++)
                        {
                            DataRow[] dr = dtmodulelist.Select("module_id = " + int.Parse(ar[a]) + " ");

                            foreach (DataRow drr in dr)
                            {
                                drr["Select"] = 1;
                                drr["sort"]   = a + 1;
                            }
                        }
                    }
                    DataView dv = dtmodulelist.DefaultView;
                    dv.Sort              = "select DESC,sort ASC ,module_id ASC";
                    dtmodulelist         = dv.ToTable();
                    GridView1.DataSource = dtmodulelist;
                    GridView1.DataBind();
                }
                else if (e.CommandName == "del")
                {
                    ltrErr.Text = "";
                    int    mid = 0;
                    string arg = e.CommandArgument.ToString();
                    int.TryParse(e.CommandArgument.ToString(), out groupid);
                    DataTable dt = objmysqldb.GetData("Select * from employee_app_module_rights where module_group_id=" + groupid + "");
                    if (dt.Rows.Count > 0 && dt != null)
                    {
                        ltrErr.Text = "Group is Already assgin to employee,you can't Delete it.";
                    }
                    else
                    {
                        string query = "update employee_app_module_group set IsDelete=1,isupdate=1 where module_group_id=" + groupid + "";
                        objmysqldb.OpenSQlConnection();
                        int res = objmysqldb.InsertUpdateDeleteData(query);
                        if (res != 1)
                        {
                            ltrErr.Text = "Please Try Again.";

                            Logger.WriteCriticalLog("employee_module_group 183 Update error.");
                        }
                        else
                        {
                            Search();
                            txtgroup.Text = "";
                            showgrid();
                            ltrErr.Text = "Group Deleted Successfully";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("employee_module_group 199: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 19
0
        private void Savedata()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                string   date      = txtattDate.Text.ToString();
                int      year      = 0;
                int      month     = 0;
                int      day       = 0;
                string[] arrdob    = date.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                long     dateticks = 0;
                if (arrdob.Length == 3)
                {
                    int.TryParse(arrdob[2].ToString(), out year);
                    int.TryParse(arrdob[1].ToString(), out month);
                    int.TryParse(arrdob[0].ToString(), out day);
                    dateticks = new DateTime(year, month, day).Ticks;
                }
                if (arrdob.Length != 3 && dateticks == 0)
                {
                    ltrErr.Text = "Attendance Date is not in proper format.";
                    return;
                }
                DataTable dtAttendanceData = objmysqldb.GetData("select emp_id,DateTicks,Type,Overlap,Update_Type from employee_attendance_daily where  DateTicks=" + dateticks + " ");

                objmysqldb.OpenSQlConnection();
                objmysqldb.BeginSQLTransaction();
                int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                string emp_ids = "";
                foreach (GridViewRow row in grd.Rows)
                {
                    int   emp_id = 0;
                    int   type   = 0;
                    Label emp    = (Label)row.FindControl("lblEmp_id");
                    //CheckBox chkpresent = (CheckBox)row.FindControl("cbSelectPresent");
                    RadioButton chkpresent  = (RadioButton)row.FindControl("cbSelectPresent");
                    RadioButton chkhalfday  = (RadioButton)row.FindControl("cbSelectHalfday");
                    RadioButton chkabsent   = (RadioButton)row.FindControl("cbSelectabsent");
                    Label       overrideatt = (Label)row.FindControl("lbloverride");
                    int         attUpdate   = 0;
                    int.TryParse(overrideatt.Text.ToString(), out attUpdate);
                    int.TryParse(emp.Text.ToString(), out emp_id);

                    //if (attUpdate == 1)
                    //{
                    //    continue;
                    //}
                    if (chkpresent.Checked)
                    {
                        type = 1;
                    }
                    if (chkhalfday.Checked)
                    {
                        if (type > 0)
                        {
                            ltrErr.Text = "Please enter valid Attendance";
                            objmysqldb.RollBackSQLTransaction();
                            bindGvdata(year, month, day);
                            return;
                        }
                        type = 2;
                    }
                    if (chkabsent.Checked)
                    {
                        if (type > 0)
                        {
                            ltrErr.Text = "Please enter valid Attendance";
                            objmysqldb.RollBackSQLTransaction();
                            bindGvdata(year, month, day);
                            return;
                        }
                        type = 3;
                    }
                    DateTime currenttime = Logger.getIndiantimeDT();
                    if (type > 0)//insert Update
                    {
                        //tye same  old and nw?
                        DataRow[] drdata = dtAttendanceData.Select("emp_id=" + emp_id + "");
                        int       retval = 0;
                        if (drdata.Length > 0)
                        {
                            int oldtype = 0;
                            int.TryParse(drdata[0]["Type"].ToString(), out oldtype);
                            if (type == oldtype)
                            {
                                retval = objmysqldb.InsertUpdateDeleteData(" update employee_attendance_daily set Type=" + type + ",UserID=" + user_id + ",modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,IsDelete=0 where emp_id=" + emp_id + " and DateTicks=" + dateticks + " ");
                            }
                            else
                            {
                                retval = objmysqldb.InsertUpdateDeleteData(" update employee_attendance_daily set Type=" + type + ",Overlap=1,Update_Type=" + oldtype + ",UserID=" + user_id + ",modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,IsDelete=0 where emp_id=" + emp_id + " and DateTicks=" + dateticks + " ");
                            }
                        }
                        if (retval == 0)
                        {
                            retval = objmysqldb.InsertUpdateDeleteData("insert into employee_attendance_daily (emp_id,DateTicks,Type,Overlap,Update_Type,UserID,modify_datetime,DOC,IsUpdate,IsDelete) values (" + emp_id + " ," + dateticks + "," + type + ",0,0," + user_id + "," + currenttime.Ticks + "," + currenttime.Ticks + ",1,0)");

                            if (retval != 1)
                            {
                                ltrErr.Text = "please try again";
                                objmysqldb.RollBackSQLTransaction();
                                Logger.WriteCriticalLog("Employee_Attendance 178 Update error.");
                                return;
                            }
                        }
                        else
                        {
                            emp_ids += emp_id.ToString() + ",";
                        }
                    }
                }
                emp_ids = emp_ids.TrimEnd(',');

                if (!emp_ids.Equals("") && dtAttendanceData != null && dtAttendanceData.Rows.Count > 0)
                {
                    //string[] employees = emp_id.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    DataRow[] drdata = dtAttendanceData.Select("emp_id NOT IN(" + emp_ids + ") ");
                    dtAttendanceData = dtAttendanceData.Clone();
                    if (drdata.Length > 0)
                    {
                        dtAttendanceData = drdata.CopyToDataTable();
                    }
                }
                DateTime currentTimes = Logger.getIndiantimeDT();
                foreach (DataRow dr in dtAttendanceData.Rows)
                {
                    int retval = objmysqldb.InsertUpdateDeleteData(" update employee_attendance_daily set UserID=" + user_id + ",modify_datetime=" + currentTimes.Ticks + ",IsUpdate=1,IsDelete=1 where emp_id=" + int.Parse(dr["emp_id"].ToString()) + " and DateTicks=" + dateticks + " ");
                }

                objmysqldb.EndSQLTransaction();
                bindGvdata(year, month, day);
                ltrErr.Text = "Employee Attendance save Successfully.";
            }
            catch (Exception ex)
            {
                objmysqldb.RollBackSQLTransaction();
                Logger.WriteCriticalLog("Employee_Attendance 215: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
        protected void saveData()
        {
            ltrErr.Text = "";
            int success = 0;

            objmysqldb.ConnectToDatabase();
            try
            {
                int.TryParse(ddlholidaylist.SelectedValue.ToString(), out holid);
                string Emp_Ids = "";
                objmysqldb.OpenSQlConnection();
                objmysqldb.BeginSQLTransaction();
                DataTable dtselectEmp = objmysqldb.GetData("SELECT emp_id FROM assign_holidayprofile_employee where IsDelete=0 and holiday_profile_id=" + holid + " ");
                foreach (GridViewRow row in GridView1.Rows)
                {
                    CheckBox chkAssign = (CheckBox)row.FindControl("cbSelect");

                    if (chkAssign.Checked)
                    {
                        int   emp_id = 0;
                        Label emp    = (Label)row.FindControl("lblemp_id");
                        int.TryParse(emp.Text.ToString(), out emp_id);
                        Emp_Ids += emp.Text.ToString() + ",";
                        DateTime currentTime = Logger.getIndiantimeDT();
                        int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                        //objmysqldb.OpenSQlConnection();
                        success = objmysqldb.InsertUpdateDeleteData("update assign_holidayprofile_employee set  modify_datetime=" + currentTime.Ticks + ",IsUpdate=0,IsDelete=0,UserID=" + user_id + " where holiday_profile_id=" + holid + " and emp_id=" + emp_id + "");
                        if (success == 0)
                        {
                            success = objmysqldb.InsertUpdateDeleteData("INSERT INTO assign_holidayprofile_employee (emp_id,holiday_profile_id, DOC, IsUpdate,IsDelete,modify_datetime,UserID) VALUES (" + emp_id + ", " + holid + "," + currentTime.Ticks + ", '1', '0'," + currentTime.Ticks + "," + user_id + ");");

                            if (success == -1)
                            {
                                ltrErr.Text = "Error While Updating..";
                                objmysqldb.RollBackSQLTransaction();
                                return;
                            }
                        }
                    }
                }
                Emp_Ids = Emp_Ids.TrimEnd(',');
                string[] arrempid = Emp_Ids.Split(',');
                if (!Emp_Ids.Equals("") && dtselectEmp != null && dtselectEmp.Rows.Count > 0)
                {
                    DataRow[] drdata = dtselectEmp.Select("emp_id NOt IN (" + Emp_Ids + ")");
                    dtselectEmp = dtselectEmp.Clone();
                    if (drdata.Length > 0)
                    {
                        dtselectEmp = drdata.CopyToDataTable();
                    }
                }
                foreach (DataRow dr in dtselectEmp.Rows)
                {
                    DateTime currentTime = Logger.getIndiantimeDT();
                    success = objmysqldb.InsertUpdateDeleteData("update assign_holidayprofile_employee set  modify_datetime=" + currentTime.Ticks + ",IsUpdate=1,IsDelete=1,UserID=" + user_id + " where holiday_profile_id=" + holid + " and emp_id=" + +int.Parse(dr["emp_id"].ToString()) + "");
                }
                if (success == 1)
                {
                    ltrErr.Text = "Holiday Profile Assigned Successfully...";
                    objmysqldb.EndSQLTransaction();
                    bindgrid(holid);
                }
            }
            catch (Exception ex)
            {
                objmysqldb.RollBackSQLTransaction();
                Logger.WriteCriticalLog("EmployeeAssignHolidayProfile 264: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 21
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();
            }
        }
        private void Savedata()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                objmysqldb.OpenSQlConnection();
                objmysqldb.BeginSQLTransaction();
                foreach (GridViewRow row in grd.Rows)
                {
                    int    emp_id         = 0;
                    string timegrp        = "";
                    int    late           = 0;
                    int    absent         = 0;
                    int    forgetoutPunch = 0;
                    int    Email          = 0;
                    int    grp_id         = 0;

                    Label emp = (Label)row.FindControl("lblEmp_id");
                    Label grp = (Label)row.FindControl("lblgrp_id");

                    CheckBox   chkleft      = (CheckBox)row.FindControl("cbSelectlate");
                    CheckBox   chkabsent    = (CheckBox)row.FindControl("cbSelectabsent");
                    CheckBox   chkforgetOut = (CheckBox)row.FindControl("cbSelectOutpunch");
                    CheckBox   chkEmail     = (CheckBox)row.FindControl("cbSelectEmail");
                    HtmlSelect ddlgrp       = (HtmlSelect)row.FindControl("ddltime");
                    if (chkleft.Checked)
                    {
                        late = 1;
                    }
                    if (chkabsent.Checked)
                    {
                        absent = 1;
                    }
                    if (chkforgetOut.Checked)
                    {
                        forgetoutPunch = 1;
                    }
                    if (chkEmail.Checked)
                    {
                        Email = 1;
                    }
                    int.TryParse(emp.Text.ToString(), out emp_id);
                    timegrp = ddlgrp.Value.ToString();
                    if (!timegrp.Equals("1000"))
                    {
                        int.TryParse(timegrp.ToString(), out grp_id);
                    }

                    DateTime currenttime = Logger.getIndiantimeDT();


                    if (grp_id > 0)
                    {
                        int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                        int retval = objmysqldb.InsertUpdateDeleteData("update time_group_assign_emplyee_wise set Group_id=" + grp_id + ",OutPuch_SMS=" + forgetoutPunch + ",Absent_Sms=" + absent + ",Late_SMS=" + late + ",Email_Sent=" + Email + ",modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_id + " where IsDelete=0 and emp_id=" + emp_id + " ");
                        if (retval == 0)
                        {
                            retval = objmysqldb.InsertUpdateDeleteData("insert into time_group_assign_emplyee_wise (emp_id,Group_id,OutPuch_SMS,Absent_Sms,Late_SMS,Email_Sent,modify_datetime,DOC,IsDelete,IsUpdate,UserID) values (" + emp_id + " ," + grp_id + "," + forgetoutPunch + "," + absent + "," + late + "," + Email + "," + currenttime.Ticks + "," + currenttime.Ticks + ",0,1," + user_id + ")");

                            if (retval != 1)
                            {
                                ltrErr.Text = "Please Try Again.";

                                Logger.WriteCriticalLog("TimeGroup_AssignToEmployee 345 Update error.");
                                objmysqldb.RollBackSQLTransaction();
                                return;
                            }
                        }
                        DataTable dtgroup = new DataTable();
                        dtgroup = objmysqldb.GetData("select * from group_master where Group_id=" + grp_id + "");
                        DataTable dtgrouptime = new DataTable();
                        dtgrouptime = objmysqldb.GetData("select * from groupwise_time_config where Group_Time_Id=" + grp_id + "");
                        if (dtgrouptime != null && dtgrouptime.Rows.Count > 0)
                        {
                            DateTime currenttimes = Logger.getIndiantimeDT();
                            retval = objmysqldb.InsertUpdateDeleteData("update employeewise_punchtime_details_datewise set IsDelete=1,modify_datetime=" + currenttimes.Ticks + ",IsUpdate=1,UserID=" + user_id + "  where emp_id=" + emp_id + "");

                            long dateticks = 0;
                            long.TryParse(dtgroup.Rows[0]["Changes_Applicable_Date"].ToString(), out dateticks);
                            DateTime dtcur     = MySQLDB.GetIndianTime();
                            DateTime dtcurrent = new DateTime(dtcur.Year, dtcur.Month, dtcur.Day);

                            long curdateticks = 0;

                            long     ticks        = long.Parse(dtgroup.Rows[0]["Changes_Applicable_Date"].ToString());
                            DateTime dt           = new DateTime(ticks);
                            String   myString_new = String.Format("{0:dd/MM/yyyy}", dt);

                            TimeSpan dtDiff      = dt - dtcurrent;
                            DateTime dtstartdate = dtcurrent;
                            if (dtDiff.Days < 0)
                            {
                                dtDiff      = dtcurrent - dt;
                                dtstartdate = dt;
                            }

                            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 = dtgrouptime.Select("Day_id =" + days1 + " ");
                                foreach (DataRow dr in drdaywise1)
                                {
                                    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 + "," + emp_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)");
                                }
                            }
                        }
                    }
                }
                objmysqldb.EndSQLTransaction();
                Search();
                ltrErr.Text = "Time Group Assign Successfully.";
            }
            catch (Exception ex)
            {
                objmysqldb.RollBackSQLTransaction();
                Logger.WriteCriticalLog("Employee_AssignToTimeGroup 360: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }

            finally
            {
                objmysqldb.disposeConnectionObj();
                objmysqldb.CloseSQlConnection();
            }
        }
Esempio n. 23
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ltrErr.Text = "";

                if (txtstartdate.Text == "" && txtenddate.Text == "")
                {
                    ltrErr.Text = "Enter Valid Date..";
                    //ltrErr.Text = "Select Valid Dates..";
                    return;
                }
                else
                {
                    string   academicYear = dlYear.Items[dlYear.SelectedIndex].Text;
                    string[] AcademicYear = academicYear.Split('-');
                    double   totalDays    = CountNoOFDays();
                    char[]   ch           = { '/' };
                    //String myString_new1 = String.Format("{0:MM/dd/yyyy}", enddt);
                    //dtData.Rows[i]["End_Date"] = myString_new1;
                    string[] spltstart = txtstartdate.Text.Split(ch);
                    string[] spltend   = txtenddate.Text.Split(ch);

                    dtStart = new DateTime(int.Parse(spltstart[2]), int.Parse(spltstart[1]), int.Parse(spltstart[0]));
                    dtend   = new DateTime(int.Parse(spltend[2]), int.Parse(spltend[1]), int.Parse(spltend[0]));

                    int startmonth = int.Parse(spltstart[1]);
                    int endmonth   = int.Parse(spltend[1]);

                    int startyr = int.Parse(spltstart[2]);
                    int endyear = int.Parse(spltend[2]);

                    //if ((startyr == Convert.ToInt32(AcademicYear[0])) && (endyear <= Convert.ToInt32(AcademicYear[1])) && (endyear >= Convert.ToInt32(AcademicYear[0])))
                    //if (startyr != Convert.ToInt32(AcademicYear[0]) && (endyear != Convert.ToInt32(AcademicYear[1])))
                    if ((startyr >= Convert.ToInt32(AcademicYear[0])) && (endyear <= Convert.ToInt32(AcademicYear[1])) && (startyr <= endyear))
                    {
                        if (totalDays > 366 || totalDays <= 0)
                        {
                            ltrErr.Text = "Enter Valid Date..";
                            //ltrErr.Text = "Choose VAlid Dates.";
                            return;
                        }
                        else
                        {
                            try
                            {
                                DateTime currenttime = Logger.getIndiantimeDT();
                                int      val         = 0;
                                objmysqldb.ConnectToDatabase();
                                objmysqldb.OpenSQlConnection();

                                int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                                val = objmysqldb.InsertUpdateDeleteData("insert into AcademicYear(Academic_Year,modify_datetime,DOC,Start_Date,End_Date,IsUpdate,IsDelete,UserID)values('" + academicYear + "'," + currenttime.Ticks + "," + currenttime.Ticks + " ," + dtStart.Ticks + ",'" + dtend.Ticks + "',0,0," + user_id + ")");
                                if (val == 1)
                                {
                                    ltrErr.Text       = "Academic Year Saved Suceessfully...";
                                    txtstartdate.Text = "";
                                    txtenddate.Text   = "";
                                    txttotaldays.Text = "";
                                    fillWithData();
                                    bindCombo();
                                }
                            }

                            //}
                            catch (Exception ex)
                            {
                                Logger.WriteCriticalLog("AcademicYearSetUp 280: exception:" + ex.Message + "::::::::" + ex.StackTrace);
                            }
                            finally
                            {
                                objmysqldb.CloseSQlConnection();
                                objmysqldb.disposeConnectionObj();
                            }
                        }
                    }

                    else
                    {
                        ltrErr.Text = "Enter Valid Input..";
                        // ltrErr.Text = "Selected Year MustMatch With year in Seleted Date";
                        //ltrErr.Text = "";
                    }
                }
            }

            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Academic Year SetUp 244: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
        }
        protected void btnsave_Click(object sender, EventArgs e)
        {
            objmysqldb.ConnectToDatabase();
            ltrErr.Text = "";
            try
            {
                int id = 0;
                int.TryParse(ddlmanager.Items[ddlmanager.SelectedIndex].Value.ToString(), out id);

                DataTable dtolddata = objmysqldb.GetData("SELECT employee_assign_to_Reporting_manager_id,emp_id FROM employee_assign_to_reporting_manager where Reporting_manager_id=" + id + " ");

                string emp_id  = "";
                int    emp_ids = 0;

                objmysqldb.OpenSQlConnection();
                objmysqldb.BeginSQLTransaction();
                int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                foreach (GridViewRow row in GridAssign.Rows)
                {
                    Label emp = (Label)row.FindControl("lblEmp_id");
                    int.TryParse(emp.Text.ToString(), out emp_ids);
                    DateTime currentTime = Logger.getIndiantimeDT();
                    int      retval      = objmysqldb.InsertUpdateDeleteData("update employee_assign_to_reporting_manager set modify_datetime=" + currentTime.Ticks + ",IsUpdate=1,UserID=" + user_id + ",IsDelete=0 where emp_id=" + emp_ids + " and Reporting_manager_id=" + id + "  ");
                    if (retval == 0)
                    {
                        retval = objmysqldb.InsertUpdateDeleteData("insert into employee_assign_to_reporting_manager (emp_id,Reporting_manager_id,modify_datetime,DOC,IsUpdate,UserID,IsDelete) values (" + emp_ids + "," + id + "," + currentTime.Ticks + "," + currentTime.Ticks + ",1," + user_id + ",0) ");

                        if (retval != 1)
                        {
                            ltrErr.Text = "please try again";
                            objmysqldb.RollBackSQLTransaction();
                            Logger.WriteCriticalLog("Employee_AssignToReportingManager 357 Update error.");
                            return;
                        }
                    }
                    else
                    {
                        emp_id += emp.Text.ToString() + ",";
                    }
                }

                emp_id = emp_id.TrimEnd(',');

                if (!emp_id.Equals("") && dtolddata != null && dtolddata.Rows.Count > 0)
                {
                    //string[] employees = emp_id.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    DataRow[] drdata = dtolddata.Select("emp_id NOT IN(" + emp_id + ") ");
                    dtolddata = dtolddata.Clone();
                    if (drdata.Length > 0)
                    {
                        dtolddata = drdata.CopyToDataTable();
                    }
                }
                DateTime currentTimes = Logger.getIndiantimeDT();
                foreach (DataRow dr in dtolddata.Rows)
                {
                    int retval = objmysqldb.InsertUpdateDeleteData("update employee_assign_to_reporting_manager set modify_datetime=" + currentTimes.Ticks + ",IsUpdate=1,UserID=" + user_id + ",IsDelete=1 where  emp_id=" + int.Parse(dr["emp_id"].ToString()) + " and Reporting_manager_id=" + id + "  ");
                }

                objmysqldb.EndSQLTransaction();
                dsBindGvData(id);
                ltrErr.Text = "Employee Assign to reporting manager Successfully.";
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Employee_AssignToReportingManager 391: exception:" + ex.Message + "::::::::" + ex.StackTrace);
                objmysqldb.RollBackSQLTransaction();
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 25
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                query_insert_update();
                objmysqldb.ConnectToDatabase();
                objmysqldb.OpenSQlConnection();
                if (allowinsert)
                {
                    int profileid = 0;
                    int.TryParse(profile_idHidden.Value.ToString(), out profileid);
                    if (txtprofile.Text == "" || txtquery.Text == "")
                    {
                        ltrErr.Text = "Please Enter all Data.";
                    }
                    else
                    {
                        DateTime currenttime = Logger.getIndiantimeDT();
                        int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                        DataTable dtdata = objmysqldb.GetData("Select * from employee_query_profile where Profile_Id=" + profileid +
                                                              "");
                        DataTable dtprofile = objmysqldb.GetData("Select * from employee_query_profile  where Profile_Name='" + txtprofile.Text + "' and Profile_Id<>" + profileid + " and IsDelete=0");
                        if (dtdata != null && dtdata.Rows.Count > 0)
                        {
                            if (dtprofile != null && dtprofile.Rows.Count > 0)
                            {
                                ltrErr.Text = "Profile Name Already Exist.";
                                return;
                            }
                            else
                            {
                                objmysqldb.AddCommandParameter("profile", txtprofile.Text.ToString());
                                objmysqldb.AddCommandParameter("query", txtquery.Text.ToString());
                                string updatequery = "update employee_query_profile set Profile_Name=?profile,Profile_Text=?query,modify_datetime=" + currenttime.Ticks + ",UserID=" + user_id + ",IsDelete=0,IsUpdate=1 where Profile_Id=" + profileid + " ";
                                int    resupdate   = objmysqldb.InsertUpdateDeleteData(updatequery);
                                if (resupdate != 1)
                                {
                                    ltrErr.Text = "Please Try Again.";

                                    Logger.WriteCriticalLog("Add New Query Profile 194 Update error.");
                                }
                                else
                                {
                                    long lastp_id = objmysqldb.LastNo("employee_query_profile", "Profile_Id", currenttime.Ticks);
                                    profile_idHidden.Value = lastp_id.ToString();


                                    btnExport.Visible  = true;
                                    ltrErr.Text        = "Query Profile Updated Successfully";
                                    ViewState["p_id="] = profile_idHidden.Value;
                                    ViewState["msg"]   = ltrErr.Text;
                                }
                            }
                        }
                        else
                        {
                            DataTable dtprofiles = objmysqldb.GetData("Select * from employee_query_profile  where Profile_Name='" + txtprofile.Text + "' and IsDelete=0");
                            if (dtprofiles != null && dtprofiles.Rows.Count > 0)
                            {
                                ltrErr.Text = "Profile Name Already Exist.";
                                return;
                            }
                            else
                            {
                                objmysqldb.AddCommandParameter("profile", txtprofile.Text.ToString());
                                objmysqldb.AddCommandParameter("query", txtquery.Text.ToString());
                                string query = "Insert into employee_query_profile(Profile_Name,Profile_Text,modify_datetime,DOC,UserID,IsDelete,IsUpdate)values(?profile,?query," + currenttime.Ticks + "," + currenttime.Ticks + "," + user_id + ",0,1)";
                                int    res   = objmysqldb.InsertUpdateDeleteData(query);
                                if (res != 1)
                                {
                                    ltrErr.Text = "Please Try Again.";

                                    Logger.WriteCriticalLog("Add New Query Profile 227 Update error.");
                                }
                                else
                                {
                                    long lastp_id = objmysqldb.LastNo("employee_query_profile", "Profile_Id", currenttime.Ticks);
                                    profile_idHidden.Value = lastp_id.ToString();
                                    ltrErr.Text            = "Query Profile Save Successfully";

                                    btnExport.Visible  = true;
                                    ViewState["p_id="] = profile_idHidden.Value;
                                    ViewState["msg"]   = ltrErr.Text;
                                }
                            }
                        }
                    }
                }
                else
                {
                    ltrErr.Text = "Query Not Run Successfully.";
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Add New Query Profile 251: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
        private void SaveData()
        {
            objmysqldb.ConnectToDatabase();
            try
            {
                ltrErr.Text = "";
                int grpid = 0;
                int.TryParse(ddlgrouplist.SelectedValue.ToString(), out grpid);
                if (grpid > 0)
                {
                    DataTable dtprevEmp = objmysqldb.GetData("SELECT emp_id FROM employee_app_module_rights where IsDelete=0 and module_group_id=" + grpid + " ");
                    string    emp_ids   = "";
                    objmysqldb.OpenSQlConnection();
                    objmysqldb.BeginSQLTransaction();
                    foreach (GridViewRow row in GridView1.Rows)
                    {
                        CheckBox chkshow = (CheckBox)row.FindControl("cbSelect");
                        if (chkshow.Checked)
                        {
                            int   emp_id = 0;
                            Label emp    = (Label)row.FindControl("lblemp_id");
                            int.TryParse(emp.Text.ToString(), out emp_id);
                            DateTime currentTime = Logger.getIndiantimeDT();
                            int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                            int retval = objmysqldb.InsertUpdateDeleteData("update employee_app_module_rights set modify_datetime=" + currentTime.Ticks + ",IsDelete=0,IsUpdate=1,UserID=" + user_id + " where module_group_id=" + grpid + " and emp_id=" + emp_id + " ");

                            if (retval == 0)
                            {
                                retval = objmysqldb.InsertUpdateDeleteData("insert into employee_app_module_rights (module_group_id,emp_id,modify_datetime,DOC,IsDelete,IsUpdate,UserID) values (" + grpid + "," + emp_id + "," + currentTime.Ticks + "," + currentTime.Ticks + ",0,1," + user_id + ") ");

                                if (retval != 1)
                                {
                                    ltrErr.Text = "please try again";
                                    objmysqldb.RollBackSQLTransaction();
                                    Logger.WriteCriticalLog("ModuleGrp_AssignTo_Employee 216 Update error.");
                                    return;
                                }
                            }
                            else
                            {
                                emp_ids += emp_id + ",";
                            }
                        }
                    }
                    emp_ids = emp_ids.TrimEnd(',');
                    if (!emp_ids.Equals("") && dtprevEmp != null && dtprevEmp.Rows.Count > 0)
                    {
                        DataRow[] drdata = dtprevEmp.Select("emp_id NOt IN (" + emp_ids + ")");
                        dtprevEmp = dtprevEmp.Clone();
                        if (drdata.Length > 0)
                        {
                            dtprevEmp = drdata.CopyToDataTable();
                        }
                    }
                    foreach (DataRow dr in dtprevEmp.Rows)
                    {
                        DateTime currentTime = Logger.getIndiantimeDT();
                        int      retval      = objmysqldb.InsertUpdateDeleteData("update employee_app_module_rights set modify_datetime=" + currentTime.Ticks + ",IsDelete=1,IsUpdate=1,UserID=" + user_id + " where module_group_id=" + grpid + " and emp_id=" + int.Parse(dr["emp_id"].ToString()) + " ");
                    }

                    objmysqldb.EndSQLTransaction();
                    bindgvdata(grpid);
                    ltrErr.Text = "Module group Assign to employee Successfully.";
                }
                else
                {
                    ltrErr.Text = "Please select module group";
                }
            }
            catch (Exception ex)
            {
                objmysqldb.RollBackSQLTransaction();
                Logger.WriteCriticalLog("ModuleGrp_AssignTo_Employee 254: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 27
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                objmysqldb.ConnectToDatabase();
                if (txtleftDate.Text.ToString().Equals(""))
                {
                    ltrErr.Text = "Please enter left date";
                    return;
                }
                else
                {
                    string[] arrlft = txtleftDate.Text.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                    if (arrlft.Length == 3)
                    {
                        string lftdate = ((arrlft[0]).ToString().Length == 1 ? "0" + (arrlft[0]).ToString() : (arrlft[0]).ToString()) + "/" + ((arrlft[1]).ToString().Length == 1 ? "0" + (arrlft[1]).ToString() : (arrlft[1]).ToString()) + "/" + ((arrlft[2]).ToString());
                        txtleftDate.Text = lftdate;
                    }
                    else
                    {
                        ltrErr.Text = "Left Date is not in proper format.";
                        return;
                    }
                }
                int emp_id = 0;
                int.TryParse(Request.QueryString["Emp"].ToString(), out emp_id);
                int user_ids = 0;
                int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_ids);
                DateTime currenttime = Logger.getIndiantimeDT();
                string   query       = "Update employee_master set EmpStatusFlag=1,modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_ids + " where EmpId=" + emp_id + " ";
                objmysqldb.OpenSQlConnection();
                int res = objmysqldb.InsertUpdateDeleteData(query);
                if (res == 1)
                {
                    objmysqldb.AddCommandParameter("Left_Date", txtleftDate.Text.ToString());
                    objmysqldb.AddCommandParameter("Left_Reason", txtreason.Text.ToString());
                    res = objmysqldb.InsertUpdateDeleteData("insert into left_employee (Emp_Id,Left_Date,Left_Reason,UserID,modify_datetime,DOC,IsUpdate,IsDelete) values(" + emp_id + ",?Left_Date,?Left_Reason," + user_ids + " ," + currenttime.Ticks + "," + currenttime.Ticks + ",1,0) ");

                    if (res != 1)
                    {
                        ltrErr.Text = "Please Try Again.";
                        Logger.WriteCriticalLog("LeftEmployee 98 Update error.");
                    }
                    else
                    {
                        ltrErr.Text      = "Status Update Successfully";
                        txtleftDate.Text = "";
                        txtreason.Text   = "";
                    }
                    grd.EditIndex = -1;
                    showgrid();
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("LeftEmployee 113:: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 28
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                this.ltrErr.Text = "";
                objmysqldb.ConnectToDatabase();
                objmysqldb.OpenSQlConnection();
                int yes = 0;
                if (this.ddlEmp.SelectedIndex > 0)
                {
                    string    emp_id = this.ddlEmp.SelectedValue.ToString();
                    DataTable data   = this.objmysqldb.GetData("SELECT 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 FROM employee_management.employeewise_punchtime_details_datewise where emp_id=" + int.Parse(emp_id) + " ");
                    if (data != null && data.Rows.Count > 0)
                    {
                        IEnumerator enumerator = this.grdData.Rows.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                GridViewRow gridViewRow = (GridViewRow)enumerator.Current;
                                Label       lbldate     = (Label)gridViewRow.FindControl("lblDate");
                                Label       dayid       = (Label)gridViewRow.FindControl("lbldayid");
                                TextBox     txtintime   = (TextBox)gridViewRow.FindControl("txtIntime");
                                TextBox     txtouttime  = (TextBox)gridViewRow.FindControl("txtoutTime");
                                TextBox     txtearly    = (TextBox)gridViewRow.FindControl("txtearly");
                                TextBox     txtlate     = (TextBox)gridViewRow.FindControl("txtlate");
                                string[]    arr_        = txtintime.Text.ToString().Split(new char[]
                                {
                                    ':'
                                }, StringSplitOptions.RemoveEmptyEntries);
                                string[] arr_2 = txtouttime.Text.ToString().Split(new char[]
                                {
                                    ':'
                                }, StringSplitOptions.RemoveEmptyEntries);
                                string[] arr_3 = txtearly.Text.ToString().Split(new char[]
                                {
                                    ':'
                                }, StringSplitOptions.RemoveEmptyEntries);
                                string[] arr_4 = txtlate.Text.ToString().Split(new char[]
                                {
                                    ':'
                                }, StringSplitOptions.RemoveEmptyEntries);
                                int day = 0;
                                int.TryParse(dayid.Text.ToString(), out day);
                                if (day == 0)
                                {
                                    day = 7;
                                }
                                int inmin     = 0;
                                int inhour    = 0;
                                int outmin    = 0;
                                int outhour   = 0;
                                int earlymin  = 0;
                                int earlyhour = 0;
                                int latemin   = 0;
                                int latehour  = 0;
                                int.TryParse(arr_[0], out inmin);
                                int.TryParse(arr_[1], out inhour);
                                int.TryParse(arr_2[0], out outmin);
                                int.TryParse(arr_2[1], out outhour);
                                int.TryParse(arr_3[0], out earlymin);
                                int.TryParse(arr_3[1], out earlyhour);
                                int.TryParse(arr_4[0], out latemin);
                                int.TryParse(arr_4[1], out latehour);
                                DateTime indiantimeDT = Logger.getIndiantimeDT();
                                if (inmin > 23 || inhour > 59 || outmin > 23 || outhour > 59 || earlymin > 23 || earlyhour > 59 || latemin > 23 || latehour > 59)
                                {
                                    this.ltrErr.Text = "Please enter valid time ";
                                    return;
                                }
                                DateTime dateTime = Convert.ToDateTime(lbldate.Text.ToString());
                                long     ticks    = dateTime.Ticks;

                                DataRow[] dr = data.Select("emp_id=" + emp_id + "and Day_id=" + day + " and DateTicks in ('" + ticks + "')");
                                if (dr.Length > 0)
                                {
                                    string in_hour    = dr[0]["In_hour"].ToString();
                                    string in_min     = dr[0]["In_min"].ToString();
                                    string out_hour   = dr[0]["out_hour"].ToString();
                                    string out_min    = dr[0]["out_min"].ToString();
                                    string early_hour = dr[0]["Ext_Early_hour"].ToString();
                                    string early_min  = dr[0]["Ext_Early_min"].ToString();
                                    string late_hour  = dr[0]["Ext_Late_hour"].ToString();
                                    string late_min   = dr[0]["Ext_Late_min"].ToString();
                                    if (!in_hour.Equals("inhour") || !in_min.Equals("inmin") || !out_hour.Equals("outhour") || !out_min.Equals("outmin") || !early_hour.Equals("earlyhour") || !early_min.Equals("earlymin") || !late_hour.Equals("latehour") || !late_min.Equals("latemin"))
                                    {
                                        yes = objmysqldb.InsertUpdateDeleteData("update employeewise_punchtime_details_datewise set In_hour=" + inhour + ",In_min=" + inmin + ",out_hour=" + outhour + ",out_min=" + outmin + " ,Ext_Early_hour=" + earlyhour + ",Ext_Early_min=" + earlymin + ",Ext_Late_hour=" + latehour + ",Ext_Late_min=" + latemin + ",modify_datetime=" + MySQLDB.GetIndianTime().Ticks.ToString() + ",IsUpdate=1, UserID= " + user_id + "  where emp_id=" + emp_id + " and Day_id=" + day + " and DateTicks=" + ticks + "");
                                    }
                                }
                                else
                                {
                                    DateTime dateTime2 = new DateTime(ticks);
                                    int      dayOfWeek = (int)dateTime2.DayOfWeek;

                                    yes = 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_Late_hour,Ext_Late_min,Ext_Early_min,modify_datetime,IsDelete,DOC,IsUpdate,UserID)Values(" + ticks + "," + emp_id + "," + dayid + "," + inhour + "," + inmin + "," + outhour + "," + outmin + "," + earlyhour + "," + latehour + "," + latemin + "," + earlymin + "," + MySQLDB.GetIndianTime().Ticks.ToString() + ",0," + MySQLDB.GetIndianTime().Ticks.ToString() + ",1," + user_id + ")");
                                }
                            }
                        }
                        finally
                        {
                            objmysqldb.CloseSQlConnection();
                            objmysqldb.disposeConnectionObj();
                        }
                        if (yes > 0)
                        {
                            this.ltrErr.Text = "Time Detail Saved...";
                        }
                        else
                        {
                            this.ltrErr.Text = "Error...";
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                //Exception exception = varVVJ0;
                Logger.WriteCriticalLog("EmpWiseTimeConfig 307: exception:" + exception.Message + "::::::::" + exception.StackTrace);
            }
        }
Esempio n. 29
0
        protected void grd_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                ltrErr.Text = "";
                if (e.CommandName == "del")
                {
                    string[] arg = e.CommandArgument.ToString().Split(':');
                    if (arg != null && arg.Length == 2)
                    {
                        int relid      = 0;
                        int masterdata = 0;
                        int.TryParse(arg[1], out relid);
                        objmysqldb.ConnectToDatabase();
                        DataTable dtreligion = objmysqldb.GetData("Select EmpReligion from employee_master  WHERE  EmpReligion =" + relid + "  ");
                        DataTable dt         = objmysqldb.GetData("select * from religion_master where religion_id=" + relid + "");
                        if (dtreligion != null && dtreligion.Rows.Count > 0)
                        {
                            ltrErr.Text = "Employee Assign to select Category so can't delete it";
                            return;
                        }
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            int.TryParse(dt.Rows[0]["IsMasterData"].ToString(), out masterdata);

                            if (masterdata == 0)
                            {
                                ltrErr.Text = "Select Religion is Masterdata,So can't delete it";
                                return;
                            }



                            else
                            {
                                int.TryParse(Request.Cookies["LoginCookies"]["UserId"].ToString(), out user_id);
                                DateTime currenttime = Logger.getIndiantimeDT();
                                string   query       = "Update religion_master set IsDelete=1,modify_datetime=" + currenttime.Ticks + ",IsUpdate=1,UserID=" + user_id + " where religion_id=" + int.Parse(arg[0]) + " ";
                                objmysqldb.OpenSQlConnection();
                                int res = objmysqldb.InsertUpdateDeleteData(query);
                                if (res != 1)
                                {
                                    ltrErr.Text = "Please Try Again.";

                                    Logger.WriteCriticalLog("Manage_Religion 140 Update error.");
                                }
                                else
                                {
                                    grd.EditIndex = -1;
                                    showgrid();
                                    ltrErr.Text           = "Religion Delete Successfully";
                                    txtreligionnames.Text = "";
                                }
                            }
                        }
                    }
                    else
                    {
                        showgrid();
                        ltrErr.Text = "Please Try Again.";
                    }
                    grd.EditIndex = -1;
                }
                else if (e.CommandName == "Edit")
                {
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("Manage_Religion 166: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Esempio n. 30
0
        protected void savedata()
        {
            try
            {
                int colpos     = 1;
                int val        = 0;
                int firstindex = 0;
                int dayid      = 0;

                System.Collections.Hashtable hsLeavePos = new System.Collections.Hashtable();
                colpos++;
                hsLeavePos.Add(colpos, 1);
                colpos++;
                hsLeavePos.Add(colpos, 1);
                colpos++;
                hsLeavePos.Add(colpos, 2);
                colpos++;
                hsLeavePos.Add(colpos, 2);
                colpos++;
                hsLeavePos.Add(colpos, 3);
                colpos++;
                hsLeavePos.Add(colpos, 3);
                colpos++;
                hsLeavePos.Add(colpos, 4);
                colpos++;
                hsLeavePos.Add(colpos, 4);
                colpos++;
                hsLeavePos.Add(colpos, 5);
                colpos++;
                hsLeavePos.Add(colpos, 5);
                colpos++;
                hsLeavePos.Add(colpos, 6);
                colpos++;
                hsLeavePos.Add(colpos, 6);
                colpos++;
                hsLeavePos.Add(colpos, 7);
                colpos++;
                hsLeavePos.Add(colpos, 7);
                objmysqldb.ConnectToDatabase();
                objmysqldb.OpenSQlConnection();
                foreach (GridViewRow row in grdEmplist.Rows)
                {
                    Label    EmpId       = (Label)grdEmplist.Rows[row.RowIndex].FindControl("lblEmp_id");
                    Label    Empname     = (Label)grdEmplist.Rows[row.RowIndex].FindControl("lblEmp_Name");
                    TextBox  txtmonhalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtmonhalf");
                    TextBox  txtmonfull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtmonfull");
                    TextBox  txttuehalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txttuehalf");
                    TextBox  txttuefull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txttuefull");
                    TextBox  txtwedhalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtwedhalf");
                    TextBox  txtwedfull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtwedfull");
                    TextBox  txtthuhalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtthuhalf");
                    TextBox  txtthufull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtthufull");
                    TextBox  txtfrihalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtfrihalf");
                    TextBox  txtfrifull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtfrifull");
                    TextBox  txtsathalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtsathalf");
                    TextBox  txtsatfull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtsatfull");
                    TextBox  txtsunhalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtsunhalf");
                    TextBox  txtsunfull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtsunfull");
                    DateTime currenttime = Logger.getIndiantimeDT();
                    int      empidint    = int.Parse(EmpId.Text.ToString());
                    string   monhalf     = txtmonhalf.Text.ToString();
                    string   monfull     = txtmonfull.Text.ToString();
                    string   tuehalf     = txttuehalf.Text.ToString();
                    string   tuefull     = txttuefull.Text.ToString();
                    string   wedhalf     = txtwedhalf.Text.ToString();
                    string   wedfull     = txtwedfull.Text.ToString();
                    string   thuhalf     = txtthuhalf.Text.ToString();
                    string   thufull     = txtthufull.Text.ToString();
                    string   frihalf     = txtfrihalf.Text.ToString();
                    string   frifull     = txtfrifull.Text.ToString();
                    string   sathalf     = txtsathalf.Text.ToString();
                    string   satfull     = txtsatfull.Text.ToString();
                    string   sunhalf     = txtsunhalf.Text.ToString();
                    string   sunfull     = txtsunfull.Text.ToString();
                    string   Total_half  = "";
                    string   Total_full  = "";
                    if (txtmonhalf.Text != "" || txtmonfull.Text != "" || txttuehalf.Text != "" || txttuefull.Text != "" || txtwedhalf.Text != "" || txtwedfull.Text != "" || txtthuhalf.Text != "" || txtthufull.Text != "" || txtfrihalf.Text != "" || txtfrifull.Text != "" || txtsathalf.Text != "" || txtsatfull.Text != "" || txtsunhalf.Text != "" || txtsunfull.Text != "")
                    {
                        foreach (DictionaryEntry KeyId in hsLeavePos)
                        {
                            dayid      = (int)KeyId.Key;
                            firstindex = (int)KeyId.Value;
                            string ColName = grdEmplist.Columns[dayid].HeaderText.ToString();


                            if (ColName == "Mon Half")
                            {
                                Total_half = monhalf;
                            }
                            if (ColName == "Mon Full")
                            {
                                Total_full = monfull;
                            }
                            if (ColName == "Tue Half")
                            {
                                Total_half = tuehalf;
                            }
                            if (ColName == "Tue Full")
                            {
                                Total_full = tuefull;
                            }
                            if (ColName == "Wed Half")
                            {
                                Total_half = wedhalf;
                            }
                            if (ColName == "Wed Full")
                            {
                                Total_full = wedfull;
                            }
                            if (ColName == "Thu Half")
                            {
                                Total_half = thuhalf;
                            }
                            if (ColName == "Thu Full")
                            {
                                Total_full = thufull;
                            }
                            if (ColName == "Fri Half")
                            {
                                Total_half = frihalf;
                            }
                            if (ColName == "Fri Full")
                            {
                                Total_full = frifull;
                            }
                            if (ColName == "Sat Half")
                            {
                                Total_half = sathalf;
                            }
                            if (ColName == "Sat Full")
                            {
                                Total_full = satfull;
                            }
                            if (ColName == "Sun Half")
                            {
                                Total_half = sunhalf;
                            }
                            if (ColName == "Sun Full")
                            {
                                Total_full = sunfull;
                            }
                            if (Total_full != "" || Total_half != "")
                            {
                                val = objmysqldb.InsertUpdateDeleteData("update employee_half_full_day_configuration set empid=" + empidint + ",half_hour='" + Total_half + "',full_hour='" + Total_full + "',modify_datetime=" + currenttime.Ticks + ",IsUpdate=1 where empid=" + empidint + " and dayid=" + firstindex + "");

                                if (val == 0)
                                {
                                    val = objmysqldb.InsertUpdateDeleteData("insert into employee_half_full_day_configuration(empid,dayid,half_hour,full_hour,modify_datetime,DOC,IsUpdate,UserID)values(" + empidint + "," + firstindex + ",'" + Total_half + "','" + Total_full + "'," + currenttime.Ticks + "," + currenttime.Ticks + ",0," + user_id + ")");
                                }
                                if (val == 1)
                                {
                                    ltrErr.Text = "Data Save Successfully..";
                                }
                            }
                        }
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("EmployeeHalfFullDayConfiguration_savedata() 275: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }