protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.ViewLeaveType, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/HR/UnAuthorized.aspx");
                }
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["id"].ToString() != null)
                {
                    if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
                    {
                        LeaveType leaveType = new LeaveType();
                        leaveType.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        txtLeaveType.Text = leaveType.LeaveTypeName;

                        btnEdit.Visible = true;
                    }
                    else
                    {
                        btnEdit.Visible = false;
                    }
                }
            }
        }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["user"] == null)
     {
         Response.Redirect("~/Default.aspx");
     }
     else
     {
         if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.AddLeaveType, Request.Cookies["user"]["Permission"].ToString()))
         {
             Response.Redirect("~/HR/UnAuthorized.aspx");
         }
     }
     if (!IsPostBack)
     {
         if (Request.QueryString["alert"] == "notpass")
         {
             Response.Write("<script>alert('لم يتم الحفظ');</script>");
         }
         if (Request.QueryString["id"].ToString() != null)
         {
             if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
             {
                 LeaveType leaveType = new LeaveType();
                 leaveType.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                 txtLeaveType.Text = leaveType.LeaveTypeName;
                 txtBalance.Text   = leaveType.Balance.ToString();
                 if (leaveType.Deduction == 1)
                 {
                     cbDeduction.Checked = true;
                     txtDays.Text        = leaveType.DeductionValue.ToString();
                 }
                 else
                 {
                     cbDeduction.Checked = false;
                 }
                 btnSave.Visible = false;
                 btnEdit.Visible = true;
             }
             else
             {
                 btnSave.Visible = true;
                 btnEdit.Visible = false;
             }
         }
     }
 }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.ViewLeave, Request.Cookies["user"]["Permission"].ToString()))
                {
                    Response.Redirect("~/HR/UnAuthorized.aspx");
                }
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["id"].ToString() != null)
                {
                    if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
                    {
                        Leave leaves = new Leave();
                        leaves.get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        Employee emp = new Employee();
                        emp.get(leaves.EmpID);
                        ddlEmp.Text = emp.EmpName;
                        LeaveType type = new LeaveType();
                        type.get(leaves.LeaveTypeID);
                        ddlLeaveType.Text = type.LeaveTypeName;
                        txtfrom.Text      = leaves.FromDate.ToShortDateString();
                        txtTo.Text        = leaves.ToDate.ToShortDateString();
                        txtComment.Text   = leaves.Comment;


                        btnEdit.Visible = true;
                    }
                    else
                    {
                        btnEdit.Visible = false;
                    }
                }
            }
        }