zclr.aspx.cs
资源名称:OASystem.rar [点击查看]
上传用户:lishan0805
上传日期:2019-12-08
资源大小:12048k
文件大小:7k
源码类别:
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.Entity;
- using COM.OA.BLL;
- using System.Collections.Generic;
- public partial class zclr : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- //取登陆人信息
- COM.OA.Entity.users loginuser = Session["loginuser"] as COM.OA.Entity.users;
- //如果取不到跳转到登陆页
- if (loginuser == null)
- {
- this.Response.Write(string.Format(GetRedirect.ALLREDIRECT, "../login.aspx"));
- }
- else
- {
- //登录时插数据库 编号+1
- IList<assetmanage> l = assetmanageBLL.Select();
- //没有数据
- if (l.Count == 0)
- {
- this.txtNumber.Text = "10001";
- }
- else
- {
- List<assetmanage> list = (List<assetmanage>)l;
- assetmanage ass = new assetmanage();
- ass = list[0];
- int num = Int32.Parse(ass.am_number) + 1;
- this.txtNumber.Text = num.ToString();
- }
- int Loginid = 0;
- string Loginname = "";
- Loginid = loginuser.u_em_id;
- string where = "em_id=" + Loginid;
- IList<employee> il = employeeBLL.Select(where);
- List<employee> ll = (List<employee>)il;
- employee em = new employee();
- em = ll[0];
- Loginname = em.em_name;
- Loginid = loginuser.u_id;
- this.txtBookerid.Text = Loginname;
- this.txtLoginid.Text = Loginid.ToString();
- }
- }
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- 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 (Production.Equals(""))
- {
- pdate = DateTime.Parse("1753-1-1");
- }
- else
- {
- pdate = DateTime.Parse(this.wdProductiondate.Text);
- }
- string Deliverusetime = this.wdDeliverusetime.Text;//交付使用日期
- DateTime dtime;
- if (Deliverusetime.Equals(""))
- {
- dtime = DateTime.Parse("1753-1-1");
- }
- else
- {
- dtime = DateTime.Parse(this.wdDeliverusetime.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 = 0;
- if (u.Equals("使用中"))
- {
- usestate = 1;
- }
- int Bookerid = Int32.Parse(this.txtLoginid.Text);//录入人
- string Remark = this.txtRemark.Text;//备注
- DateTime Registertime = DateTime.Now;//录入时间
- assetmanage am = new assetmanage();
- 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_bookerid = Bookerid;
- am.am_registertime = Registertime;
- am.am_remark = Remark;
- am.am_isscrap = 1;
- int update = assetmanageBLL.Insert(am);
- if (update > 0)
- {
- this.Response.Write(string.Format(GetRedirect.WINALERT, "添加失败!"));
- }
- else
- {
- this.Response.Write(string.Format(GetRedirect.REDIRECT, "zclr2.aspx"));
- }
- this.Session.Add("am", am);
- }
- }