Пример #1
0
        //private void reset()
        //{
        //    txtbxFromDate.Text = DateTime.Today.ToShortDateString();
        //    txtbxToDate.Text = DateTime.Today.ToShortDateString();

        //    txtDateFrom.Text = DateTime.Today.ToShortDateString();
        //    txtDateTo.Text = DateTime.Today.ToShortDateString();
        //    //ddlShiftCode.ClearSelection();
        //    lblMessage.Text = "";
        //    txtOTFrom.Text = DateTime.Today.ToShortDateString();
        //    txtOTTo.Text = DateTime.Today.ToShortDateString();
        //}

        protected void btnUpdateStatus_Click(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToDateTime(txtDateFrom.Text) > DateTime.Now || Convert.ToDateTime(txtDateTo.Text) > DateTime.Now)
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Date can not be greater than current date!')", true);
                    return;
                }
                //lblMessage.Text = "Proccessing data...";
                //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Proccessing data...Please wait')", true);
                string   OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                DateTime EDIT_DATE = DateTime.Now;
                Guid     userId    = ((SessionUser)Session["SessionUser"]).UserId;

                var result = objAtt_BLL.UpdateAttStatus_ByShift(Convert.ToDateTime(txtDateFrom.Text), Convert.ToDateTime(txtDateTo.Text), ddlShiftCode.Text);
                objAtt_BLL.Insert_AbsentLeaveStatus_ByShift(Convert.ToDateTime(txtDateFrom.Text), Convert.ToDateTime(txtDateTo.Text), ddlShiftCode.Text, OCODE, EDIT_DATE, userId);
                if (result == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Employee Attendance Status Processed Successfully')", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Status Processing Failure!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Пример #2
0
        // attendnace status process all/shiftwise

        protected void btnUpdateStatus_Click(object sender, EventArgs e)
        {
            try
            {
                //if (Convert.ToDateTime(txtDateFrom.Text) > DateTime.Now || Convert.ToDateTime(txtDateTo.Text) > DateTime.Now)
                //{
                //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Date cant be greater than current date!')", true);
                //    return;
                //}

                string   OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                DateTime EDIT_DATE = DateTime.Now;
                Guid     userId    = ((SessionUser)Session["SessionUser"]).UserId;

                if (ddlShiftCode.SelectedItem.Text == "All")
                {
                    var result = aAttendance_RPT_Bll.UpdateAll_AttStatus_ByDate(Convert.ToDateTime(txtDateFrom.Text), Convert.ToDateTime(txtDateFrom.Text));

                    aAttendance_RPT_Bll.Insert_AllAbsentLeaveStatus_ByDate(Convert.ToDateTime(txtDateFrom.Text), Convert.ToDateTime(txtDateFrom.Text), OCODE, EDIT_DATE, userId);
                    if (result == 1)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Employee Attendance Status Proccessed Successfully')", true);
                        //txtDateFrom.Text = DateTime.Today.ToShortDateString();
                        //txtDateTo.Text = DateTime.Today.ToShortDateString();
                        ddlShiftCode.ClearSelection();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Status Proccessing Failure!')", true);
                    }
                }

                else
                {
                    var result = objAtt_BLL.UpdateAttStatus_ByShift(Convert.ToDateTime(txtDateFrom.Text), Convert.ToDateTime(txtDateFrom.Text), ddlShiftCode.Text);
                    objAtt_BLL.Insert_AbsentLeaveStatus_ByShift(Convert.ToDateTime(txtDateFrom.Text), Convert.ToDateTime(txtDateFrom.Text), ddlShiftCode.Text, OCODE, EDIT_DATE, userId);
                    if (result == 1)
                    {
                        //lblMessage.Text = "Employee Attendance Status Updated successfully!";
                        //lblMessage.ForeColor = System.Drawing.Color.Green;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Employee Attendance Status Proccessed Successfully')", true);
                        //BindGridEmployeeAttendance();
                    }
                    else
                    {
                        //lblMessage.Text = "Status Update Failure!";
                        //lblMessage.ForeColor = System.Drawing.Color.Red;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Status Proccessing Failure!')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }