コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strParams = Request.QueryString["params"];
                if (string.IsNullOrEmpty(strParams) == false)
                {
                    strVal = null;
                    char[] splitter = { ',' };
                    strVal = Common.str_split(strParams, splitter);

                    strStartDate = DateTime.Now.Year.ToString();
                    strEndDate   = Convert.ToString(Convert.ToInt32(strStartDate));

                    strStartDate = strStartDate + "-" + "01" + "-" + "01";
                    strEndDate   = strEndDate + "-" + "12" + "-" + "31";

                    this.CreateTable();
                    personTable.Rows.Add(strVal[1], strVal[0], strVal[2], strStartDate, strEndDate);
                    ViewState["dt"] = personTable;
                    //Leave Information
                    DataTable dtLeaveApp = new DataTable();
                    dtLeaveApp = objLeaveMgr.SelectLeaveAppMstRpt(Convert.ToInt32(strVal[1]), strVal[0], strVal[2], strStartDate, strEndDate);

                    //Leave Profile
                    if (dtLeaveApp.Rows.Count > 0)
                    {
                        lblApplicantName.Text     = dtLeaveApp.Rows[0]["FullName"].ToString().Trim() + ", " + dtLeaveApp.Rows[0]["DesigName"].ToString().Trim();
                        lblOffice.Text            = dtLeaveApp.Rows[0]["DeptName"].ToString().Trim();
                        lblDateofApplication.Text = Common.ReturnDateTimeInString(Common.DisplayDateTime(dtLeaveApp.Rows[0]["AppDate"].ToString().Trim(), false, Constant.strDateFormat), false, Constant.strDateFormat);
                        lblAppliedFor.Text        = dtLeaveApp.Rows[0]["LTypeTitle"].ToString().Trim();
                        lblLeaveApplied.Text      = Common.ReturnDateTimeInString(Common.DisplayDateTime(dtLeaveApp.Rows[0]["LeaveStart"].ToString().Trim(), false, Constant.strDateFormat), false, Constant.strDateFormat) + " to " + Common.ReturnDateTimeInString(Common.DisplayDateTime(dtLeaveApp.Rows[0]["LeaveEnd"].ToString().Trim(), false, Constant.strDateFormat), false, Constant.strDateFormat);
                        lblPurpose.Text           = dtLeaveApp.Rows[0]["LTReason"].ToString().Trim();
                        lblContact.Text           = dtLeaveApp.Rows[0]["AddrAtLeave"].ToString().Trim();
                        lblResumingDate.Text      = Common.ReturnDateTimeInString(Common.DisplayDateTime(dtLeaveApp.Rows[0]["ResumeDate"].ToString().Trim(), false, Constant.strDateFormat), false, Constant.strDateFormat);
                        lblApprovedBy.Text        = dtLeaveApp.Rows[0]["ApprovedBy"].ToString().Trim();
                        lblApprovedOn.Text        = Common.ReturnDateTimeInString(Common.DisplayDateTime(dtLeaveApp.Rows[0]["ApproveDate"].ToString().Trim(), false, Constant.strDateFormat), false, Constant.strDateFormat);
                        lblLeaveBalanceDate.Text  = "Leave Balance Record As Of: " + Common.ReturnDateTimeInString(DateTime.Today.ToShortDateString(), false, Constant.strDateFormat);
                        if (dtLeaveApp.Rows[0]["Gender"].ToString() == "F")
                        {
                            this.FillEmpLeaveProfile(strVal[0], "F");
                        }
                        else
                        {
                            this.FillEmpLeaveProfile(strVal[0], "M");
                        }

                        this.FillEmpLeaveDetails(strVal[0]);
                        this.GetLeavePeriod();

                        //Responsible Person Name & designation

                        //DataTable dtDivLevel = new DataTable();
                        DataTable dtResPerson = new DataTable();
                        //dtSecLevel = objLeaveMgr.SelectDivisionLevel(strVal[0].ToString());
                        //if (dtDivLevel.Rows.Count > 0)
                        //{
                        //    if (dtDivLevel.Rows[0]["SecLevel"].ToString() == "C")

                        dtResPerson = objLeaveMgr.SelectResponsePerson(Convert.ToInt32(strVal[1]), strVal[0].ToString());
                        //else
                        //    dtResPerson = objLeaveMgr.SelectResponsePerson(Convert.ToInt32(strVal[1]), strVal[0].ToString() , "B");

                        //if (dtResPerson.Rows.Count > 0)
                        //{
                        //    rptResponsePerson.DataSource = dtResPerson;
                        //    rptResponsePerson.DataBind();
                        //}
                        //}
                    }
                    if (strVal[3].Trim() == "L")
                    {
                        btnApprove.Visible   = true;
                        btnRegret.Visible    = true;
                        btnCancel.Visible    = true;
                        btnRecommend.Visible = false;
                        // ScriptManager.RegisterClientScriptBlock(Page, typeof(string), Guid.NewGuid().ToString(), "document.getElementById('divApproveBy').Visible = false;", true);
                        divApproveBy.Visible = false;
                    }
                    if (strVal[3].Trim() == "A")
                    {
                        btnApprove.Visible   = false;
                        btnRegret.Visible    = false;
                        btnCancel.Visible    = false;
                        btnRecommend.Visible = false;
                        //ScriptManager.RegisterClientScriptBlock(Page, typeof(string), Guid.NewGuid().ToString(), "document.getElementById('divApproveBy').Visible = false;", true);
                        divApproveBy.Visible = false;
                    }
                    else if (strVal[3].Trim() == "R")
                    {
                        btnApprove.Visible   = false;
                        btnRegret.Visible    = false;
                        btnRecommend.Visible = false;
                        //  ScriptManager.RegisterClientScriptBlock(Page, typeof(string), Guid.NewGuid().ToString(), "document.getElementById('divApproveBy').Visible = false;", true);
                        divApproveBy.Visible = false;
                    }
                    else if (strVal[3].Trim() == "M")
                    {
                        btnApprove.Visible   = false;
                        btnRegret.Visible    = true;
                        btnCancel.Visible    = true;
                        btnRecommend.Visible = true;
                        //ScriptManager.RegisterClientScriptBlock(Page, typeof(string), Guid.NewGuid().ToString(), "document.getElementById('divApproveBy').Visible = true;", true);
                        divApproveBy.Visible = true;
                    }
                }
            }
        }