예제 #1
0
        private void BindLeaveBalance()
        {
            LeaveBl objLeaveBl = new LeaveBl();
            var     objResult  =
                objLeaveBl.Leave_Select_ForBalance(Convert.ToInt32(Session[ApplicationSession.USERID].ToString()));

            if (objResult != null)
            {
                if (objResult.resultDT.Rows.Count > 0)
                {
                    gvLeaveBalance.DataSource = objResult.resultDT;
                    gvLeaveBalance.DataBind();
                    txtFromDate.Enabled = true;
                    txtToDate.Enabled   = true;
                    btnApply.Enabled    = true;
                }
                else
                {
                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Leave Template has not created.Please Create Leave Template first.');</script>");
                    txtFromDate.Enabled = false;
                    txtToDate.Enabled   = false;
                    btnApply.Enabled    = false;
                }
            }
        }
예제 #2
0
 protected void cbDeduction_OnCheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (cbDeduction.Checked)
         {
             LeaveBl objLeaveBl = new LeaveBl();
             var     objResult  = objLeaveBl.Leave_Select_ForDeduction(ddlAcademicYear.Text);
             if (objResult.resultDT.Rows.Count > 0)
             {
                 ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp",
                                                    "<script>alert('there is already assign deduction leave. Only one Leave can be deduct.');</script>");
                 ViewState["Deduction"] = "1";
             }
         }
         else
         {
             ViewState["Deduction"] = "0";
         }
     }
     catch (Exception ex)
     {
         logger.Error("Error", ex);
         ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
     }
 }
예제 #3
0
 private void BindLeaveType()
 {
     try
     {
         LeaveBl           objLeaveBl  = new LeaveBl();
         ApplicationResult objResults  = new ApplicationResult();
         Controls          objControls = new Controls();
         for (int i = 0; i < gvLeave.Rows.Count; i++)
         {
             DropDownList ddlLeaveType = (DropDownList)gvLeave.Rows[i].Cells[3].FindControl("ddlLeaveType");
             objResults = objLeaveBl.Leave_SelectAll_ForApply();
             if (objResults != null)
             {
                 if (objResults.resultDT.Rows.Count > 0)
                 {
                     objControls.BindDropDown_ListBox(objResults.resultDT, ddlLeaveType, "LeaveName", "LeaveID");
                 }
                 ddlLeaveType.Items.Insert(0, new ListItem("-Select-", ""));
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error("Error", ex);
         ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
     }
 }
예제 #4
0
        public void BindLeave()
        {
            ApplicationResult objResult  = new ApplicationResult();
            LeaveBl           objLeavebl = new LeaveBl();

            objResult = objLeavebl.Leave_SelectAll();
            if (objResult.resultDT.Rows.Count > 0)
            {
                gvLeave.DataSource = objResult.resultDT;
                gvLeave.DataBind();
                PanelVisibility(1);
            }
            else
            {
                PanelVisibility(2);
            }
        }
예제 #5
0
        protected void btnGo_OnClick(object sender, EventArgs e)
        {
            LeaveBl objLeaveBl = new LeaveBl();
            var     objResult  =
                objLeaveBl.Leave_Select_ForBalance(Convert.ToInt32(hfEmployeeID.Value));

            if (objResult != null)
            {
                if (objResult.resultDT.Rows.Count > 0)
                {
                    gvLeaveBalance.DataSource = objResult.resultDT;
                    gvLeaveBalance.DataBind();
                    divgrid.Visible = true;
                }
                else
                {
                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Leave Template has not created.Please Create Leave Template first.');</script>");
                    divgrid.Visible = false;
                }
            }
        }
예제 #6
0
        protected void gvRole_OnRowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                ApplicationResult objResult       = new ApplicationResult();
                LeaveApplyBl      objLeaveApplyBl = new LeaveApplyBl();
                if (e.CommandName.ToString() == "Edit1")
                {
                    if (ddlStatus.SelectedValue != "0")
                    {
                        ViewState["LeaveApplyID"] = e.CommandArgument.ToString();
                        objResult =
                            objLeaveApplyBl.LeaveApply_Select_ForApprove(Convert.ToInt32(e.CommandArgument.ToString()));
                        if (objResult != null)
                        {
                            if (objResult.resultDT.Rows.Count > 0)
                            {
                                DataTable dt = new DataTable();
                                dt.Rows.Clear();
                                dt.Columns.Add("NO");
                                for (var i = 1; i <= objResult.resultDT.Rows.Count; i++)
                                {
                                    dt.Rows.Add(this.ToString());
                                }
                                gvLeave.DataSource = dt;
                                gvLeave.DataBind();
                                BindLeaveType();
                                for (var i = 0; i < gvLeave.Rows.Count; i++)
                                {
                                    if (
                                        objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_ISAPPROVED].ToString() ==
                                        "1")
                                    {
                                        ((CheckBox)(gvLeave.Rows[i].Cells[1].FindControl("cbApprove"))).Checked = true;
                                    }
                                    else if (objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_ISAPPROVED].ToString() ==
                                             "2")
                                    {
                                        ((CheckBox)(gvLeave.Rows[i].Cells[1].FindControl("cbApprove"))).Checked = false;
                                    }
                                    ((Label)(gvLeave.Rows[i].Cells[0].FindControl("lblLeaveApprovalID"))).Text =
                                        objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_LEAVEAPPROVALID]
                                        .ToString();
                                    ((TextBox)(gvLeave.Rows[i].Cells[2].FindControl("txtGridDates"))).Text =
                                        objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_APPLYDATE].ToString();
                                    ((DropDownList)(gvLeave.Rows[i].Cells[4].FindControl("ddlLeaveType")))
                                    .SelectedValue =
                                        objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_LEAVEID].ToString();
                                    if (
                                        objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_ISHALFDAY].ToString() ==
                                        "1")
                                    {
                                        ((CheckBox)(gvLeave.Rows[i].Cells[3].FindControl("cbHalfDay"))).Checked = true;
                                    }
                                    else
                                    {
                                        ((CheckBox)(gvLeave.Rows[i].Cells[3].FindControl("cbHalfDay"))).Checked = false;
                                    }
                                    ((TextBox)(gvLeave.Rows[i].Cells[2].FindControl("txtGridDates"))).Enabled      = false;
                                    ((DropDownList)(gvLeave.Rows[i].Cells[4].FindControl("ddlLeaveType"))).Enabled =
                                        false;
                                    ((CheckBox)(gvLeave.Rows[i].Cells[3].FindControl("cbHalfDay"))).Enabled = false;
                                }
                                ViewState["Mode"] = "Edit";
                                PanelVisibility(4);
                            }
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('This leave has not approved yet,You can not edit.');</script>");
                    }
                }
                else if (e.CommandName.ToString() == "Approve1")
                {
                    if (ddlStatus.SelectedValue.ToString() != "1")
                    {
                        #region Bind Leave Balance
                        GridViewRow gvr      = (GridViewRow)((Control)e.CommandSource).NamingContainer;
                        int         rowIndex = gvr.RowIndex;

                        int     empid      = Convert.ToInt32(gvLeaveApprove.Rows[rowIndex].Cells[1].Text);
                        LeaveBl objLeaveBl = new LeaveBl();
                        objResult =
                            objLeaveBl.Leave_Select_ForBalance(empid);//Convert.ToInt32(Session[ApplicationSession.USERID].ToString())  + <%# Eval("EmployeeMID") %>
                        if (objResult != null)
                        {
                            if (objResult.resultDT.Rows.Count > 0)
                            {
                                gvLeaveBalance.DataSource = objResult.resultDT;
                                gvLeaveBalance.DataBind();
                            }
                        }
                        #endregion

                        //objLeaveApprovalBo.EmployeeMID = Convert.ToInt32(e.CommandArgument.ToString());
                        ViewState["LeaveApplyID"] = e.CommandArgument.ToString();
                        objResult =
                            objLeaveApplyBl.LeaveApply_Select_ForApprove(Convert.ToInt32(e.CommandArgument.ToString()));
                        if (objResult != null)
                        {
                            if (objResult.resultDT.Rows.Count > 0)
                            {
                                DataTable dt = new DataTable();
                                dt.Rows.Clear();
                                dt.Columns.Add("NO");
                                for (var i = 1; i <= objResult.resultDT.Rows.Count; i++)
                                {
                                    dt.Rows.Add(this.ToString());
                                }
                                gvLeave.DataSource = dt;
                                gvLeave.DataBind();
                                BindLeaveType();
                                for (var i = 0; i < gvLeave.Rows.Count; i++)
                                {
                                    ((Label)(gvLeave.Rows[i].Cells[0].FindControl("lblLeaveApprovalID"))).Text =
                                        objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_LEAVEAPPROVALID]
                                        .ToString();
                                    ((TextBox)(gvLeave.Rows[i].Cells[2].FindControl("txtGridDates"))).Text =
                                        objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_APPLYDATE].ToString();
                                    ((DropDownList)(gvLeave.Rows[i].Cells[4].FindControl("ddlLeaveType")))
                                    .SelectedValue =
                                        objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_LEAVEID].ToString();
                                    if (
                                        objResult.resultDT.Rows[i][LeaveApprovalBo.LEAVEAPPROVAL_ISHALFDAY].ToString() ==
                                        "1")
                                    {
                                        ((CheckBox)(gvLeave.Rows[i].Cells[3].FindControl("cbHalfDay"))).Checked = true;
                                    }
                                    else
                                    {
                                        ((CheckBox)(gvLeave.Rows[i].Cells[3].FindControl("cbHalfDay"))).Checked = false;
                                    }
                                    ((TextBox)(gvLeave.Rows[i].Cells[2].FindControl("txtGridDates"))).Enabled      = false;
                                    ((DropDownList)(gvLeave.Rows[i].Cells[4].FindControl("ddlLeaveType"))).Enabled =
                                        false;
                                    ((CheckBox)(gvLeave.Rows[i].Cells[3].FindControl("cbHalfDay"))).Enabled = false;
                                }
                                ViewState["Mode"] = "Approve";
                                PanelVisibility(4);
                            }
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('This Leave has already approved.');</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
예제 #7
0
 protected void gvLeave_OnRowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         ApplicationResult objResult  = new ApplicationResult();
         LeaveBl           objLeaveBL = new LeaveBl();
         if (e.CommandName.ToString() == "Edit1")
         {
             ViewState["Mode"]    = "Edit";
             ViewState["LeaveID"] = e.CommandArgument.ToString();
             objResult            = objLeaveBL.Leave_Select(Convert.ToInt32(ViewState["LeaveID"].ToString()));
             if (objResult != null)
             {
                 DataTable dtResult = objResult.resultDT;
                 if (dtResult.Rows.Count > 0)
                 {
                     txtLeaveName.Text    = dtResult.Rows[0][LeaveBo.LEAVE_LEAVENAME].ToString();
                     txtLeaveCode.Text    = dtResult.Rows[0][LeaveBo.LEAVE_LEAVECODE].ToString();
                     ddlAcademicYear.Text = dtResult.Rows[0][LeaveBo.LEAVE_YEAR].ToString();
                     if (dtResult.Rows[0][LeaveBo.LEAVE_IsDeduction].ToString() == "1")
                     {
                         cbDeduction.Checked = true;
                     }
                     else
                     {
                         cbDeduction.Checked = false;
                     }
                     if (dtResult.Rows[0][LeaveBo.LEAVE_ISCARRYFORWARD].ToString() == "1")
                     {
                         cbCarryForward.Checked = true;
                     }
                     else
                     {
                         cbCarryForward.Checked = false;
                     }
                     txtDescription.Text = dtResult.Rows[0][LeaveBo.LEAVE_LEAVEDESCRIPTION].ToString();
                     PanelVisibility(2);
                 }
             }
         }
         else if (e.CommandName.ToString() == "Delete1")
         {
             objResult = objLeaveBL.Leave_Delete(Convert.ToInt32(e.CommandArgument.ToString()), Convert.ToInt32(Session[ApplicationSession.USERID]),
                                                 DateTime.UtcNow.AddHours(5.5).ToString());
             if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
             {
                 ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record deleted successfully.');</script>");
                 PanelVisibility(1);
                 BindLeave();
             }
             else
             {
                 ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('You cannot delete this record because it is in used.');</script>");
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error("Error", ex);
         ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
     }
 }
예제 #8
0
        protected void btnSaveClass_OnClick(object sender, EventArgs e)
        {
            try
            {
                LeaveBo           objLeaveBO = new LeaveBo();
                LeaveBl           objLeaveBL = new LeaveBl();
                ApplicationResult objResult  = new ApplicationResult();
                DataTable         dtResult   = new DataTable();
                int intLeaveID = 0;

                objLeaveBO.TrustMID           = Convert.ToInt32(Session[ApplicationSession.TRUSTID]);
                objLeaveBO.SchoolMID          = Convert.ToInt32(Session[ApplicationSession.SCHOOLID]);
                objLeaveBO.LeaveName          = txtLeaveName.Text.Trim();
                objLeaveBO.LeaveCode          = txtLeaveCode.Text.Trim();
                objLeaveBO.Year               = ddlAcademicYear.Text;
                objLeaveBO.IsDeduction        = Convert.ToInt32(cbDeduction.Checked);
                objLeaveBO.IsCarryForward     = Convert.ToInt32(cbCarryForward.Checked);
                objLeaveBO.LeaveDescription   = txtDescription.Text.Trim();
                objLeaveBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                objLeaveBO.LastModifiedDate   = DateTime.UtcNow.AddHours(5.5).ToString();

                //Code For Validate Leave Name
                if (ViewState["Mode"].ToString() == "Save")
                {
                    intLeaveID = -1;
                }
                else if (ViewState["Mode"].ToString() == "Edit")
                {
                    intLeaveID = Convert.ToInt32(ViewState["LeaveID"].ToString());
                }
                objResult = objLeaveBL.Leave_ValidateName(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), intLeaveID, objLeaveBO.LeaveName, ddlAcademicYear.Text);
                if (objResult != null)
                {
                    dtResult = objResult.resultDT;
                    if (dtResult.Rows.Count > 0)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Leave name already exist.');</script>");
                    }
                    else
                    {
                        if (ViewState["Deduction"].ToString() == "0")
                        {
                            if (ViewState["Mode"].ToString() == "Save")
                            {
                                objLeaveBO.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                                objLeaveBO.CreatedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                                objResult = objLeaveBL.Leave_Insert(objLeaveBO);
                                if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
                                {
                                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp",
                                                                       "<script>alert('Record saved successfully.');</script>");
                                }
                                else
                                {
                                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp",
                                                                       "<script>alert('LeaveName already exist.');</script>");
                                }
                            }
                            else if (ViewState["Mode"].ToString() == "Edit")
                            {
                                objLeaveBO.LeaveID = Convert.ToInt32(ViewState["LeaveID"].ToString());
                                objResult          = objLeaveBL.Leave_Update(objLeaveBO);
                                if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
                                {
                                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record updated successfully.');</script>");
                                }
                                else
                                {
                                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('You can no delete this leave, Because its used in Leave Template.');</script>");
                                }
                            }
                            ClearAll();
                            BindLeave();
                            PanelVisibility(1);
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp",
                                                               "<script>alert('There is already assign deduction leave. Only one Leave can be deduct.');</script>");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }