protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserInfo user = new UserInfo(); if (Session["user"] == null) { Response.Redirect("../login.aspx"); return; } ViewState["urlReferrer"] = Request.UrlReferrer.LocalPath; int id = Convert.ToInt32(Request.QueryString["id"]); ResourceInfo item = ResourceInfoManager.Get(id); if (item != new ResourceInfo() && item != null) { this.lblResourceName.Text = item.RIName; this.lblNumber.Text = item.Number.ToString(); this.lblPrice.Text = item.Price.ToString(); this.lblInTime.Text = item.InTime; this.lblProvider.Text = item.Provider.PID.ToString(); this.lblResourceType.Text = item.Type.RTName; this.lblSpec.Text = item.RISpec; if (item.RIState == 1) { this.lblState.Text = "可用"; } else { this.lblState.Text = "禁用"; } this.lblResourceStore.Text = item.Store.RSName; this.txtRemark.Text = item.RIRemark; } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (IsValid) { ResourceRestore restore = new ResourceRestore(); restore.Borrow.BAID = Convert.ToInt32(txtBorrowNo.Text.Trim()); restore.Resource.RIID = Convert.ToInt32(ddlName.SelectedValue); restore.User.UID = Convert.ToInt32(hfUID.Value); restore.RRTime = txtTime.Value.Trim(); restore.RRNumber = Convert.ToInt32(txtRebackNum.Text.Trim()); ApplicationResourseInfo appResource = ApplicationResourceManager.GetApplicationResourse(restore.Borrow.BAID, restore.Resource.RIID); if (restore.RRNumber > appResource.Number) { ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('您的输入归还数量有误!')</script>"); return; } restore.RRRemark = txtMark.Text.Trim(); if (ResourceRestoreManager.Add(restore) != 0) { restore.Resource = ResourceInfoManager.Get(restore.Resource.RIID); restore.Resource.Number += restore.RRNumber; ResourceInfoManager.UpdateResourceInfo(restore.Resource); this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('录入成功!')</script>"); } Response.Redirect("UseList.aspx"); } }
private void BindResource(int id) { ResourceInfo item = ResourceInfoManager.Get(id); this.lblPrice.Text = item.Price.ToString(); this.lblSpec.Text = item.RISpec; this.lblProvider.Text = item.Provider.PName; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = Convert.ToInt32(Request.QueryString["id"]); ResourceInfo item = ResourceInfoManager.Get(id); this.txtResourceName.Text = item.RIName; txtNumber.Text = item.Number.ToString(); txtPrice.Text = item.Price.ToString(); txtTime.Value = item.InTime; ddlProvider.SelectedValue = item.Provider.PID.ToString(); ddlType.SelectedValue = item.Type.RTID.ToString(); txtRISpec.Text = item.RISpec; ddlState.SelectedValue = item.RIState.ToString(); txtRemark.Text = item.RIRemark; } }
protected void btnAdd_Click(object sender, EventArgs e) { int riid = 0; int number = 0; try { number = Convert.ToInt32(txtNumber.Text.Trim()); ResourceInfo resource = ResourceInfoManager.Get(Convert.ToInt32(ddlResourceType.SelectedValue)); if (number > resource.Number) { this.ClientScript.RegisterStartupScript(GetType(), "", string.Format("<script>alert('库存数量为{0},您输入的数量以大于现有库存,请重新输入!')</script>", resource.Number)); return; } } catch { this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请输入数字!')</script>"); return; } if (null != ddlResourceName.SelectedValue && "" != ddlResourceName.SelectedValue) { riid = Convert.ToInt32(ddlResourceName.SelectedValue); if (UrlReferrer == "/WebUI/ResourceManager/ApplyBorrow.aspx") { ApplicationResources.AddItem(ResourceInfoManager.Get(riid), 1, number); Response.Redirect("ApplyBorrow.aspx"); } else if (UrlReferrer == "/WebUI/ResourceManager/ApplyStock.aspx") { ApplicationResources.AddItem(ResourceInfoManager.Get(riid), 2, number); Response.Redirect("ApplyStock.aspx"); } } else { this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('请选择资源!')</script>"); return; } }
protected void Page_Load(object sender, EventArgs e) { int id = Convert.ToInt32(Request.QueryString["id"]); ResourceInfo item = ResourceInfoManager.Get(id); this.txtResourceName.Text = item.RIName; this.txtNumber.Text = item.Number.ToString(); this.txtPrice.Text = item.Price.ToString(); this.txtInTime.Text = item.InTime; this.txtProvider.Text = item.Provider.PID.ToString(); this.txtResourceType.Text = item.Type.RTName; this.txtSpec.Text = item.RISpec; if (item.RIState == 1) { this.txtState.Text = "可用"; } else { this.txtState.Text = "禁用"; } this.txtResourceStore.Text = item.Store.RSName; this.txtRemark.Text = item.RIRemark; }