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.CreateDeduction, 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) { Bonuses bonus = new Bonuses(); bonus.get(Convert.ToInt32(Request.QueryString["id"].ToString())); ddlEmp.SelectedValue = bonus.EmpID.ToString(); ddlType.SelectedValue = bonus.Type.ToString(); txtAmount.Text = bonus.Value.ToString(); ddlMonth.SelectedValue = bonus.Month.ToString(); ddlYear.SelectedValue = bonus.Year.ToString(); ddlManger.SelectedValue = bonus.Manger.ToString(); ddlprecentageFrom.SelectedValue = bonus.PrecentageFrom.ToString(); txtResone.Text = bonus.Reason.ToString(); txtNumberOfDays.Text = bonus.NumberOfDays.ToString(); btnSave.Visible = false; btnEdit.Visible = true; } else { btnSave.Visible = true; btnEdit.Visible = false; } } } }
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.ViewBonus, 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) { Bonuses bonus = new Bonuses(); bonus.get(Convert.ToInt32(Request.QueryString["id"].ToString())); Employee emp = new Employee(); emp.get(bonus.EmpID); ddlEmp.Text = emp.EmpName; ddlType.Text = bonus.Type.ToString(); txtAmount.Text = bonus.Value.ToString(); btnEdit.Visible = true; } else { btnEdit.Visible = false; } } } }