protected void Page_Load(object sender, EventArgs e) { clsSpeedo.Authenticate(); if (!Page.IsPostBack) { bool blnReadOnly; clsRequisition.AuthenticateUser(clsRequisition.RequisitionUserType.SuppliesCustodian, Request.Cookies["Speedo"]["UserName"].ToString(), Request.QueryString["requcode"].ToString()); txtRequisitionCode.Text = Request.QueryString["requcode"].ToString(); txtSuppName.Text = clsUsers.GetName(Request.Cookies["Speedo"]["UserName"]); using (clsRequisition requisition = new clsRequisition(txtRequisitionCode.Text)) { requisition.Fill(); hdnUserCode.Value = requisition.Username; hdnChargeTo.Value = requisition.ChargeTo; lblTotalPrice.Text = "P " + requisition.TotalCost.ToString("###,###.00"); txtStat.Text = requisition.StatusDescription; txtIntended.Text = requisition.Intended; txtDateReq.Text = requisition.DateRequested.ToString("MMMM dd,yyyy"); hdnGrpHeadCode.Value = requisition.GroupHead; txtGrpHeadRem.Text = requisition.GroupHeadRemarks; hdnDiviHeadCode.Value = requisition.DivisionHead; txtDiviHeadRem.Text = requisition.DivisionHeadRemarks; txtSuppRem.Text = requisition.SuppliesCustodianRemarks; blnReadOnly = (requisition.Status == "C" ? true : false); divButtons.Visible = !blnReadOnly; txtSuppRem.ReadOnly = blnReadOnly; } if (blnReadOnly) { txtSuppRem.BackColor = System.Drawing.Color.FromName("#f0f8ff"); } hdnRCCode.Value = clsEmployee.GetRCCode(hdnUserCode.Value); txtRCName.Text = clsRC.GetRCName(hdnRCCode.Value); txtChargeTo.Text = clsRC.GetRCName(hdnChargeTo.Value); BindItems(); txtUserName.Text = clsUsers.GetName(hdnUserCode.Value); hdnUserMail.Value = clsUsers.GetEmail(hdnUserCode.Value); txtGrpHeadName.Text = clsUsers.GetName(hdnGrpHeadCode.Value); txtDiviHeadName.Text = clsUsers.GetName(hdnDiviHeadCode.Value); txtChargeToBudget.Text = "P " + clsRequisition.GetCurrentBudget(hdnChargeTo.Value).ToString("#,###,##0.00"); foreach (DataGridItem itm in dgItems.Items) { TextBox txtpSuppRem = (TextBox)itm.FindControl("txtSuppRem"); TextBox txtpSOQty = (TextBox)itm.FindControl("txtSOQty"); txtpSuppRem.ReadOnly = blnReadOnly; txtpSOQty.ReadOnly = blnReadOnly; } } }
protected void Page_Load(object sender, EventArgs e) { clsSpeedo.Authenticate(); if (!Page.IsPostBack) { bool blnReadOnly; clsRequisition.AuthenticateUser(clsRequisition.RequisitionUserType.DivisionHead, Request.Cookies["Speedo"]["UserName"].ToString(), Request.QueryString["requcode"].ToString()); txtRequCode.Text = Request.QueryString["requcode"]; txtDiviHeadName.Text = clsUsers.GetName(Request.Cookies["Speedo"]["UserName"]); using (clsRequisition requisition = new clsRequisition(txtRequCode.Text)) { requisition.Fill(); hdnRequestor.Value = requisition.Username; txtDateReq.Text = requisition.DateRequested.ToString(); txtRemarks.Text = requisition.Intended; hdnGrpHeadCode.Value = requisition.GroupHead; txtGrpHeadRem.Text = requisition.GroupHeadRemarks; hdnGrpHeadStatus.Value = requisition.GroupHeadStatus; txtDiviHeadRem.Text = requisition.DivisionHeadRemarks; blnReadOnly = (requisition.DivisionHeadStatus == "F" ? false : true); hdnSuppCode.Value = requisition.SuppliesCustodian; txtSuppRem.Text = requisition.SuppliesCustodianRemarks; txtStat.Text = requisition.StatusDescription; hdnChargeTo.Value = requisition.ChargeTo; } txtRCName.Text = clsEmployee.GetRCName(hdnRequestor.Value); txtChargeTo.Text = clsRC.GetRCName(hdnChargeTo.Value); using (clsUsers users = new clsUsers()) { users.Username = hdnRequestor.Value; users.Fill(); txtRequestorName.Text = users.FullName; hdnRequestorMail.Value = users.Email; users.Username = hdnGrpHeadCode.Value; users.Fill(); txtGrpHeadName.Text = users.FullName; hdnGrpHeadMail.Value = users.Email; users.Username = hdnSuppCode.Value; users.Fill(); txtSuppName.Text = users.FullName; hdnSuppMail.Value = users.Email; } txtChargeToBudget.Text = "P " + clsRequisition.GetCurrentBudget(hdnChargeTo.Value).ToString("#,###,##0.00"); BindItems(); HasEnoughBudget(); divButton.Visible = !blnReadOnly; divButtons2.Visible = !blnReadOnly; divBudget.Visible = !blnReadOnly; txtDiviHeadRem.ReadOnly = blnReadOnly; txtRemarks.ReadOnly = blnReadOnly; if (blnReadOnly) { txtDiviHeadRem.BackColor = System.Drawing.Color.FromName("#f0f8ff"); txtRemarks.BackColor = System.Drawing.Color.FromName("#f0f8ff"); dgItems.Columns[5].Visible = false; //foreach (DataGridItem itm in dgItems.Items) //{ // TextBox ptxtQty = (TextBox)itm.FindControl("txtQty"); // ptxtQty.ReadOnly = blnReadOnly; // ptxtQty.BackColor = System.Drawing.Color.FromName("#f0f8ff"); //} } } }
protected void Page_Load(object sender, EventArgs e) { clsSpeedo.Authenticate(); if (!Page.IsPostBack) { bool blnReadOnly; clsRequisition.AuthenticateUser(clsRequisition.RequisitionUserType.Requestor, Request.Cookies["Speedo"]["UserName"].ToString(), Request.QueryString["requcode"].ToString()); MakeCart(); LoadPrimaryItemCategory(); LoadItems(ddlItemCategory.SelectedValue.ToString()); LoadItemDetails(); txtRequCode.Text = Request.QueryString["requcode"].ToString(); txtRequestorName.Text = clsUsers.GetName(Request.Cookies["Speedo"]["UserName"]); using (clsRequisition requisition = new clsRequisition(txtRequCode.Text)) { requisition.Fill(); txtDateReq.Text = requisition.DateRequested.ToString(); txtIntended.Text = requisition.Intended; hdnChargeTo.Value = requisition.ChargeTo; hdnGrpHeadCode.Value = requisition.GroupHead; txtGrpHeadRem.Text = requisition.GroupHeadRemarks; hdnDiviHeadCode.Value = requisition.DivisionHead; txtHeadRem.Text = requisition.DivisionHeadRemarks; hdnSuppCode.Value = requisition.SuppliesCustodian; txtSuppRem.Text = requisition.SuppliesCustodianRemarks; hdnStatus.Value = requisition.Status; txtStat.Text = requisition.StatusDescription; blnReadOnly = (hdnStatus.Value == "M" ? false : true); } txtChargeTo.Text = clsRC.GetRCName(hdnChargeTo.Value); using (clsUsers users = new clsUsers()) { users.Username = hdnGrpHeadCode.Value; users.Fill(); txtGrpHeadName.Text = users.FullName; hdnGrpHeadMail.Value = users.Email; users.Username = hdnDiviHeadCode.Value; users.Fill(); txtDiviHeadName.Text = users.FullName; hdnDiviHeadMail.Value = users.Email; users.Username = hdnSuppCode.Value; users.Fill(); txtSuppName.Text = users.FullName; hdnSuppMail.Value = users.Email; } txtIntended.ReadOnly = blnReadOnly; divButtons.Visible = !blnReadOnly; divAddItem.Visible = !blnReadOnly; divBudget.Visible = !blnReadOnly; BindItems(); if (blnReadOnly) { //foreach (DataGridItem itm in dgItems.Items) //{ // TextBox ptxtQty = (TextBox)itm.FindControl("txtQty"); // ptxtQty.ReadOnly = blnReadOnly; // ptxtQty.BackColor = System.Drawing.Color.FromName("#f0f8ff"); //} } else { // LoadItems(); HasEnoughBudget(); } if (blnReadOnly) { txtIntended.BackColor = System.Drawing.Color.FromName("#f0f8ff"); dgItems.Columns[6].Visible = false; } } }