zcxg.aspx.cs
资源名称:OASystem.rar [点击查看]
上传用户:lishan0805
上传日期:2019-12-08
资源大小:12048k
文件大小:12k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using COM.OA.BLL;
- using System.Collections.Generic;
- using COM.OA.Entity;
- public partial class wc_zcgl_zcxg : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- users loginuser = Session["loginuser"] as users;
- if (loginuser == null)
- {
- this.Response.Write(string.Format(GetRedirect.ALLREDIRECT, "../login.aspx"));
- }
- else
- {
- if (!IsPostBack)
- {
- int xid = Int32.Parse(this.Request["xid"]);
- string where = "am_id=" + xid;
- IList<assetmanage> amlist = assetmanageBLL.Select(where);
- assetmanage am = new assetmanage();
- if (amlist.Count != 0)
- {
- am = amlist[0];
- this.txtAssetname.Text = am.am_assetname;
- this.txtNumber.Text = am.am_number;
- this.txtMeasureunit.Text = am.am_measureunit;
- this.txtScalar.Text = am.am_scalar.ToString();
- if (am.am_spectype.Equals("0"))
- {
- this.txtSpectype.Text = "";
- }
- else
- {
- this.txtSpectype.Text = am.am_spectype;
- }
- if (am.am_leavefactorynumber.Equals("0"))
- {
- this.txtLeaveFactoryNumber.Text = "";
- }
- else
- {
- this.txtLeaveFactoryNumber.Text = am.am_leavefactorynumber;
- }
- if (am.am_artletternumber.Equals("0"))
- {
- this.txtArtletterNumber.Text = "";
- }
- else
- {
- this.txtArtletterNumber.Text = am.am_artletternumber;
- }
- this.txtBuyPrice.Text = am.am_buyprice.ToString();
- if (am.am_installcost == 0)
- {
- this.txtInstallcost.Text = "";
- }
- else
- {
- this.txtInstallcost.Text = am.am_installcost.ToString();
- }
- if (am.am_depreciationcost == 0)
- {
- this.txtDepreciationcost.Text = "";
- }
- else
- {
- this.txtDepreciationcost.Text = am.am_depreciationcost.ToString();
- }
- if (am.am_betvalue == 0)
- {
- this.txtBetvalue.Text = "";
- }
- else
- {
- this.txtBetvalue.Text = am.am_betvalue.ToString();
- }
- this.txtProduction.Text = am.am_production;
- if (am.am_productiondate.ToString("yyyy-MM-dd").Equals("1753-01-01"))
- {
- this.wdproductiondate.Text = "";
- }
- else
- {
- this.wdproductiondate.Text = am.am_productiondate.ToString("yyyy-MM-dd");
- }
- this.wddeliverusetim.Text = am.am_deliverusetime.ToString("yyyy-MM-dd");
- if (am.am_advanceuseyear == 0)
- {
- this.txtAdvanceuseyear.Text = "";
- }
- else
- {
- this.txtAdvanceuseyear.Text = am.am_advanceuseyear.ToString();
- }
- this.txtBuyordept.Text = am.am_buyordept;
- this.txtStorageordept.Text = am.am_storageordept;
- this.txtPurpose.Text = am.am_purpose;
- if (!IsPostBack)
- {
- this.ddDept.SelectedIndex = am.am_dept_id - 1;
- }
- this.txtUseaddress.Text = am.am_useaddress;
- if (am.am_usestate == 0)
- {
- this.txtUsestate.Text = "未使用";
- }
- else
- {
- this.txtUsestate.Text = "使用中";
- }
- //录入人
- int bid = am.am_bookerid;
- string bwhere = "u_id=" + bid;
- IList<users> userilist = usersBLL.Select(bwhere);
- List<users> userlist = (List<users>)userilist;
- users us = new users();
- us = userlist[0];
- int emid = us.u_em_id;
- string whereem = "em_id=" + emid;
- IList<employee> emilist = employeeBLL.Select(whereem);
- List<employee> emlist = (List<employee>)emilist;
- employee em = new employee();
- em = emlist[0];
- this.txtBookerid.Text = em.em_name;
- this.txtRemark.Text = am.am_remark;
- int aaaa = am.am_isscrap;
- if (am.am_isscrap == 0)
- {
- this.rbno.Checked = false;
- this.rbis.Checked = true;
- }
- else if (am.am_isscrap == 1)
- {
- this.rbno.Checked = true;
- this.rbis.Checked = false;
- }
- }
- }
- }
- }
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- if (IsPostBack) {
- string Assetname = this.txtAssetname.Text;//资产名称
- string Number = this.txtNumber.Text;//编号
- string Measureunit = this.txtMeasureunit.Text;//计量单位
- string s = this.txtScalar.Text; //数量
- int Scalar;
- if (s.Equals(""))
- {
- Scalar = 0;
- }
- else
- {
- Scalar = Int32.Parse(this.txtScalar.Text);
- }
- string Spectype = this.txtSpectype.Text;//规格型号
- string LeaveFactoryNumber = this.txtLeaveFactoryNumber.Text;//出厂编号
- string ArtletterNumber = this.txtArtletterNumber.Text;//技术证书号
- string b = this.txtBuyPrice.Text;//购买价格
- float BuyPrice;
- if (b.Equals(""))
- {
- BuyPrice = 0;
- }
- else
- {
- BuyPrice = float.Parse(this.txtBuyPrice.Text);
- }
- string i = this.txtInstallcost.Text;//安装费
- float Installcost;
- if (i.Equals(""))
- {
- Installcost = 0;
- }
- else
- {
- Installcost = float.Parse(this.txtInstallcost.Text);
- }
- string d = this.txtDepreciationcost.Text;//折旧
- float Depreciationcost;
- if (d.Equals(""))
- {
- Depreciationcost = 0;
- }
- else
- {
- Depreciationcost = float.Parse(this.txtDepreciationcost.Text);
- }
- string bv = this.txtBetvalue.Text;//净值
- float Betvalue;
- if (bv.Equals(""))
- {
- Betvalue = 0;
- }
- else
- {
- Betvalue = float.Parse(this.txtBetvalue.Text);
- }
- string Production = this.txtProduction.Text;//生产单位
- string Productiondate = this.wdproductiondate.Text;//生产年月
- DateTime pdate;
- if (Productiondate.Equals(""))
- {
- pdate = DateTime.Parse("1753-1-1");
- }
- else
- {
- pdate = DateTime.Parse(this.wdproductiondate.Text);
- }
- string Deliverusetime = this.wddeliverusetim.Text;//交付使用日期
- DateTime dtime;
- if (Deliverusetime.Equals(""))
- {
- dtime = DateTime.Parse("1753-1-1");
- }
- else
- {
- dtime = DateTime.Parse(this.wddeliverusetim.Text);
- }
- string a = this.txtAdvanceuseyear.Text;//预计使用年限
- int Advanceuseyear;
- if (a.Equals(""))
- {
- Advanceuseyear = 0;
- }
- else
- {
- Advanceuseyear = Int32.Parse(this.txtAdvanceuseyear.Text);
- }
- string Buyordept = this.txtBuyordept.Text;//请购人或部门
- string Storageordept = this.txtStorageordept.Text;//保管人或部门
- string Purpose = this.txtPurpose.Text;//用途
- int Dept = Int32.Parse(this.ddDept.Text);//使用部门
- string Useaddress = this.txtUseaddress.Text;//使用地点
- string u = this.txtUsestate.Text;//使用状态
- int Usestate;
- if (u.Equals("使用中"))
- {
- Usestate = 1;
- }
- else
- {
- Usestate = 0;
- }
- int Bookerid = Int32.Parse(this.txtLoginid.Text);//录入人
- string Remark = this.txtRemark.Text;//备注
- DateTime Registertime = DateTime.Now;//录入时间
- assetmanage am = new assetmanage();
- int xid = Int32.Parse(this.Request["xid"]);
- am.am_assetname = Assetname;
- am.am_number = Number;
- am.am_measureunit = Measureunit;
- am.am_scalar = Scalar;
- am.am_spectype = Spectype;
- am.am_leavefactorynumber = LeaveFactoryNumber;
- am.am_artletternumber = ArtletterNumber;
- am.am_buyprice = BuyPrice;
- am.am_installcost = Installcost;
- am.am_depreciationcost = Depreciationcost;
- am.am_betvalue = Betvalue;
- am.am_production = Production;
- am.am_productiondate = pdate;
- am.am_deliverusetime = dtime;
- am.am_advanceuseyear = Advanceuseyear;
- am.am_buyordept = Buyordept;
- am.am_storageordept = Storageordept;
- am.am_purpose = Purpose;
- am.am_dept_id = Dept;
- am.am_useaddress = Useaddress;
- am.am_usestate = Usestate;
- am.am_registertime = Registertime;
- users loginuser = Session["loginuser"] as users;
- int bookid = loginuser.u_id;
- am.am_bookerid = bookid;
- am.am_remark = Remark;
- am.am_id = xid;
- int isscrap = 0;
- if (this.rbis.Checked == true)
- {
- isscrap = 0;
- }
- else if(this.rbno.Checked == true)
- {
- isscrap = 1;
- }
- am.am_isscrap = isscrap;
- int update = assetmanageBLL.Update(am);
- if (update > 0)
- {
- this.Response.Write(string.Format(GetRedirect.WINALERT, "修改失败!"));
- }
- else
- {
- this.Response.Write(string.Format(GetRedirect.WINALERT, "修改成功!"));
- this.Response.Write(string.Format(GetRedirect.REDIRECT, "zclb.aspx"));
- }
- }
- }
- }