protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oCustomized = new Customized(intProfile, dsn); oPage = new Pages(intProfile, dsn); oUser = new Users(intProfile, dsn); if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intId = Int32.Parse(Request.QueryString["id"]); } if (intId > 0) { DataSet ds = oCustomized.GetCostAvoidanceById(intId); if (ds.Tables[0].Rows.Count > 0) { lblTitle.Text = "View Cost Avoidance"; lblCAO.Text = ds.Tables[0].Rows[0]["opportunity"].ToString(); lblDescription.Text = ds.Tables[0].Rows[0]["description"].ToString(); if (ds.Tables[0].Rows[0]["path"].ToString() != "") { hypUpload.NavigateUrl = ds.Tables[0].Rows[0]["path"].ToString(); } else { hypUpload.Text = ""; } string strVal = ds.Tables[0].Rows[0]["addtlcostavoidance"].ToString(); strVal = strVal == "" ? "0" : strVal; lblAddtlCA.Text = String.Format("{0:C}", Double.Parse(strVal)); lblDate.Text = DateTime.Parse(ds.Tables[0].Rows[0]["date"].ToString()).ToShortDateString(); lblSubmitter.Text = oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString())); lblDateSubmit.Text = DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString()).ToShortDateString(); rptView.DataSource = oCustomized.GetCategoryList(intId); rptView.DataBind(); lblNone.Visible = rptView.Items.Count == 0; } } }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oCustomized = new Customized(intProfile, dsn); oApplication = new Applications(intProfile, dsn); oPage = new Pages(intProfile, dsn); if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "") { intApplication = Int32.Parse(Request.QueryString["applicationid"]); } if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intId = Int32.Parse(Request.QueryString["id"]); } if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "") { intApplication = Int32.Parse(Request.Cookies["application"].Value); } if (intId > 0) { DataSet ds = oCustomized.GetCostAvoidanceById(intId); if (ds.Tables[0].Rows.Count > 0) { btnUpdate.Visible = true; lblTitle.Text = "Edit Cost Avoidance"; txtCAO.Text = ds.Tables[0].Rows[0]["opportunity"].ToString(); txtDescription.Text = ds.Tables[0].Rows[0]["description"].ToString(); if (ds.Tables[0].Rows[0]["path"].ToString() != "") { panUploaded.Visible = true; hypUpload.NavigateUrl = ds.Tables[0].Rows[0]["path"].ToString(); } else { panUpload.Visible = true; } panNew.Visible = false; panView.Visible = true; string strVal = ds.Tables[0].Rows[0]["addtlcostavoidance"].ToString(); strVal = strVal == "" ? "0" : strVal; txtAddtlCA.Text = Double.Parse(strVal).ToString("F"); txtDate.Text = DateTime.Parse(ds.Tables[0].Rows[0]["date"].ToString()).ToShortDateString(); } } else { panNew.Visible = true; panView.Visible = false; panUpload.Visible = true; btnSave.Visible = true; lblTitle.Text = oPage.Get(intPage, "title"); } imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');"); btnSave.Attributes.Add("onclick", "return ValidateText('" + txtCAO.ClientID + "','Please enter a text for Cost Avoidance Opportunity') " + " && EnsureNumber('" + txtAddtlCA.ClientID + "','Please enter a valid cost') " + " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid date');"); btnUpdate.Attributes.Add("onclick", "return ValidateText('" + txtCAO.ClientID + "','Please enter a text for Cost Avoidance Opportunity') " + " && EnsureNumber('" + txtAddtlCA.ClientID + "','Please enter a valid cost') " + " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid date');"); btnView.Attributes.Add("onclick", "return OpenWindow('COST_AVOIDANCE','?id=" + intId + "');"); }