diff --git a/DAL/nr_z_cprk.cs b/DAL/nr_z_cprk.cs index d28d514..4786ae5 100644 --- a/DAL/nr_z_cprk.cs +++ b/DAL/nr_z_cprk.cs @@ -5,383 +5,358 @@ using System.Data.SqlClient; using Maticsoft.DBUtility;//Please add references namespace Maticsoft.DAL { - /// - /// 数据访问类:nr_z_cprk - /// - public partial class nr_z_cprk - { - public nr_z_cprk() - {} - #region BasicMethod + /// + /// 数据访问类:nr_z_cprk + /// + public partial class nr_z_cprk + { + public nr_z_cprk() + { } + #region BasicMethod - /// - /// 得到最大ID - /// - public int GetMaxId() - { - return DbHelperSQL.GetMaxID("id", "nr_z_cprk"); - } + /// + /// 得到最大ID + /// + public int GetMaxId() + { + return DbHelperSQL.GetMaxID("id", "nr_z_cprk"); + } - /// - /// 是否存在该记录 - /// - public bool Exists(int id) - { - StringBuilder strSql=new StringBuilder(); - strSql.Append("select count(1) from nr_z_cprk"); - strSql.Append(" where id=@id"); - SqlParameter[] parameters = { - new SqlParameter("@id", SqlDbType.Int,4) - }; - parameters[0].Value = id; + /// + /// 是否存在该记录 + /// + public bool Exists(int id) + { + StringBuilder strSql = new StringBuilder(); + strSql.Append("select count(1) from nr_z_cprk"); + strSql.Append(" where id=@id"); + SqlParameter[] parameters = { + new SqlParameter("@id", SqlDbType.Int,4) + }; + parameters[0].Value = id; - return DbHelperSQL.Exists(strSql.ToString(),parameters); - } + return DbHelperSQL.Exists(strSql.ToString(), parameters); + } - /// - /// 增加一条数据 - /// - public int Add(Maticsoft.Model.nr_z_cprk model) - { - StringBuilder strSql=new StringBuilder(); - strSql.Append("insert into nr_z_cprk("); - strSql.Append("rkbh,riqi,scdh,kw,rkxm,cpmc,bzgg,zzsl,lt,sl,dw,jsr,bz,zt)"); - strSql.Append(" values ("); - strSql.Append("@rkbh,@riqi,@scdh,@kw,@rkxm,@cpmc,@bzgg,@zzsl,@lt,@sl,@dw,@jsr,@bz,@zt)"); - strSql.Append(";select @@IDENTITY"); - SqlParameter[] parameters = { - new SqlParameter("@rkbh", SqlDbType.VarChar,50), - new SqlParameter("@riqi", SqlDbType.DateTime), - new SqlParameter("@scdh", SqlDbType.VarChar,50), - new SqlParameter("@kw", SqlDbType.VarChar,2000), - new SqlParameter("@rkxm", SqlDbType.VarChar,50), - new SqlParameter("@cpmc", SqlDbType.VarChar,50), - new SqlParameter("@bzgg", SqlDbType.Decimal,9), - new SqlParameter("@zzsl", SqlDbType.Int,4), - new SqlParameter("@lt", SqlDbType.Decimal,9), - new SqlParameter("@sl", SqlDbType.Decimal,9), - new SqlParameter("@dw", SqlDbType.VarChar,50), - new SqlParameter("@jsr", SqlDbType.VarChar,50), - new SqlParameter("@bz", SqlDbType.VarChar,2000), - new SqlParameter("@zt", SqlDbType.VarChar,50)}; - parameters[0].Value = model.rkbh; - parameters[1].Value = model.riqi; - parameters[2].Value = model.scdh; - parameters[3].Value = model.kw; - parameters[4].Value = model.rkxm; - parameters[5].Value = model.cpmc; - parameters[6].Value = model.bzgg; - parameters[7].Value = model.zzsl; - parameters[8].Value = model.lt; - parameters[9].Value = model.sl; - parameters[10].Value = model.dw; - parameters[11].Value = model.jsr; - parameters[12].Value = model.bz; - parameters[13].Value = model.zt; + /// + /// 增加一条数据 + /// + public int Add(Maticsoft.Model.nr_z_cprk model) + { + StringBuilder strSql = new StringBuilder(); + strSql.Append("insert into nr_z_cprk("); + strSql.Append("rkbh,riqi,scdh,kw,cpbh,cpmc,rkxm,bzgg,guige,zzsl,lt,sl,danwei,songhuoren,shdizhi,zje,jsr,beizhu,zt)"); + strSql.Append(" values ("); + strSql.Append("@rkbh,@riqi,@scdh,@kw,@cpbh,@cpmc,@rkxm,@bzgg,@guige,@zzsl,@lt,@sl,@danwei,@songhuoren,@shdizhi,@zje,@jsr,@beizhu,@zt)"); + strSql.Append(";select @@IDENTITY"); + SqlParameter[] parameters = { + new SqlParameter("@rkbh", SqlDbType.VarChar,50), + new SqlParameter("@riqi", SqlDbType.DateTime), + new SqlParameter("@scdh", SqlDbType.VarChar,50), + new SqlParameter("@kw", SqlDbType.VarChar,2000), + new SqlParameter("@cpbh", SqlDbType.VarChar,50), + new SqlParameter("@cpmc", SqlDbType.VarChar,50), + new SqlParameter("@rkxm", SqlDbType.VarChar,50), + new SqlParameter("@bzgg", SqlDbType.Decimal,9), + new SqlParameter("@guige", SqlDbType.Decimal,9), + new SqlParameter("@zzsl", SqlDbType.Int,4), + new SqlParameter("@lt", SqlDbType.Decimal,9), + new SqlParameter("@sl", SqlDbType.Decimal,9), + new SqlParameter("@danwei", SqlDbType.VarChar,50), + new SqlParameter("@zje", SqlDbType.Decimal,9), + new SqlParameter("@jsr", SqlDbType.VarChar,50), + new SqlParameter("@beizhu", SqlDbType.VarChar,2000), + new SqlParameter("@zt", SqlDbType.VarChar,50)}; + parameters[0].Value = model.rkbh; + parameters[1].Value = model.riqi; + parameters[2].Value = model.scdh; + parameters[3].Value = model.kw; + parameters[4].Value = model.cpbh; + parameters[5].Value = model.cpmc; + parameters[6].Value = model.rkxm; + parameters[7].Value = model.bzgg; + parameters[8].Value = model.guige; + parameters[9].Value = model.zzsl; + parameters[10].Value = model.lt; + parameters[11].Value = model.sl; + parameters[12].Value = model.danwei; + parameters[13].Value = model.zje; + parameters[14].Value = model.jsr; + parameters[15].Value = model.beizhu; + parameters[16].Value = model.zt; - object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters); - if (obj == null) - { - return 0; - } - else - { - return Convert.ToInt32(obj); - } - } - /// - /// 更新一条数据 - /// - public bool Update(Maticsoft.Model.nr_z_cprk model) - { - StringBuilder strSql=new StringBuilder(); - strSql.Append("update nr_z_cprk set "); - strSql.Append("rkbh=@rkbh,"); - strSql.Append("riqi=@riqi,"); - strSql.Append("scdh=@scdh,"); - strSql.Append("kw=@kw,"); - strSql.Append("rkxm=@rkxm,"); - strSql.Append("cpmc=@cpmc,"); - strSql.Append("bzgg=@bzgg,"); - strSql.Append("zzsl=@zzsl,"); - strSql.Append("lt=@lt,"); - strSql.Append("sl=@sl,"); - strSql.Append("dw=@dw,"); - strSql.Append("jsr=@jsr,"); - strSql.Append("bz=@bz,"); - strSql.Append("zt=@zt"); - strSql.Append(" where id=@id"); - SqlParameter[] parameters = { - new SqlParameter("@rkbh", SqlDbType.VarChar,50), - new SqlParameter("@riqi", SqlDbType.DateTime), - new SqlParameter("@scdh", SqlDbType.VarChar,50), - new SqlParameter("@kw", SqlDbType.VarChar,2000), - new SqlParameter("@rkxm", SqlDbType.VarChar,50), - new SqlParameter("@cpmc", SqlDbType.VarChar,50), - new SqlParameter("@bzgg", SqlDbType.Decimal,9), - new SqlParameter("@zzsl", SqlDbType.Int,4), - new SqlParameter("@lt", SqlDbType.Decimal,9), - new SqlParameter("@sl", SqlDbType.Decimal,9), - new SqlParameter("@dw", SqlDbType.VarChar,50), - new SqlParameter("@jsr", SqlDbType.VarChar,50), - new SqlParameter("@bz", SqlDbType.VarChar,2000), - new SqlParameter("@zt", SqlDbType.VarChar,50), - new SqlParameter("@id", SqlDbType.Int,4)}; - parameters[0].Value = model.rkbh; - parameters[1].Value = model.riqi; - parameters[2].Value = model.scdh; - parameters[3].Value = model.kw; - parameters[4].Value = model.rkxm; - parameters[5].Value = model.cpmc; - parameters[6].Value = model.bzgg; - parameters[7].Value = model.zzsl; - parameters[8].Value = model.lt; - parameters[9].Value = model.sl; - parameters[10].Value = model.dw; - parameters[11].Value = model.jsr; - parameters[12].Value = model.bz; - parameters[13].Value = model.zt; - parameters[14].Value = model.id; + object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); + if (obj == null) + { + return 0; + } + else + { + return Convert.ToInt32(obj); + } + } + /// + /// 更新一条数据 + /// + public bool Update(Maticsoft.Model.nr_z_cprk model) + { + /* +rkbh +riqi +scdh +kw +cpbh +cpmc +rkxm +bzgg +guige +zzsl +lt +sl +danwei +zje +jsr +beizhu +zt + */ - int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); - if (rows > 0) - { - return true; - } - else - { - return false; - } - } + StringBuilder strSql = new StringBuilder(); + strSql.Append("update nr_z_cprk set "); + strSql.Append("rkbh=@rkbh,"); - /// - /// 删除一条数据 - /// - public bool Delete(int id) - { - - StringBuilder strSql=new StringBuilder(); - strSql.Append("delete from nr_z_cprk "); - strSql.Append(" where id=@id"); - SqlParameter[] parameters = { - new SqlParameter("@id", SqlDbType.Int,4) - }; - parameters[0].Value = id; + strSql.Append("riqi=@riqi,"); + strSql.Append("scdh=@scdh,"); + strSql.Append("kw=@kw,"); + strSql.Append("cpbh=@cpbh,"); + strSql.Append("cpmc=@cpmc,"); + strSql.Append("rkxm=@rkxm,"); - int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); - if (rows > 0) - { - return true; - } - else - { - return false; - } - } - /// - /// 批量删除数据 - /// - public bool DeleteList(string idlist ) - { - StringBuilder strSql=new StringBuilder(); - strSql.Append("delete from nr_z_cprk "); - strSql.Append(" where id in ("+idlist + ") "); - int rows=DbHelperSQL.ExecuteSql(strSql.ToString()); - if (rows > 0) - { - return true; - } - else - { - return false; - } - } + strSql.Append("bzgg=@bzgg,"); + strSql.Append("guige=@guige,"); + strSql.Append("zzsl=@zzsl,"); + strSql.Append("lt=@lt,"); + strSql.Append("sl=@sl,"); + strSql.Append("danwei=@danwei,"); + strSql.Append("zje=@zje,"); + strSql.Append("jsr=@jsr,"); + strSql.Append("beizhu=@beizhu,"); + strSql.Append("zt=@zt"); + strSql.Append(" where id=@id"); + SqlParameter[] parameters = { + new SqlParameter("@rkbh", SqlDbType.VarChar,50), + new SqlParameter("@riqi", SqlDbType.DateTime), + new SqlParameter("@scdh", SqlDbType.VarChar,50), + new SqlParameter("@kw", SqlDbType.VarChar,2000), + new SqlParameter("@cpbh", SqlDbType.VarChar,50), + new SqlParameter("@cpmc", SqlDbType.VarChar,50), + new SqlParameter("@rkxm", SqlDbType.VarChar,50), + new SqlParameter("@bzgg", SqlDbType.Decimal,9), + new SqlParameter("@guige", SqlDbType.Decimal,9), + new SqlParameter("@zzsl", SqlDbType.Int,4), + new SqlParameter("@lt", SqlDbType.Decimal,9), + new SqlParameter("@sl", SqlDbType.Decimal,9), + new SqlParameter("@danwei", SqlDbType.VarChar,50), + new SqlParameter("@zje", SqlDbType.Decimal,9), + new SqlParameter("@jsr", SqlDbType.VarChar,50), + new SqlParameter("@beizhu", SqlDbType.VarChar,2000), + new SqlParameter("@zt", SqlDbType.VarChar,50), + new SqlParameter("@id", SqlDbType.Int,4)}; + parameters[0].Value = model.rkbh; + parameters[1].Value = model.riqi; + parameters[2].Value = model.scdh; + parameters[3].Value = model.kw; + parameters[4].Value = model.cpbh; + parameters[5].Value = model.cpmc; + parameters[6].Value = model.rkxm; + parameters[7].Value = model.bzgg; + parameters[8].Value = model.guige; + parameters[9].Value = model.zzsl; + parameters[10].Value = model.lt; + parameters[11].Value = model.sl; + parameters[12].Value = model.danwei; + parameters[13].Value = model.zje; + parameters[14].Value = model.jsr; + parameters[15].Value = model.beizhu; + parameters[16].Value = model.zt; + parameters[17].Value = model.id; + int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); + if (rows > 0) + { + return true; + } + else + { + return false; + } + } + + /// + /// 删除一条数据 + /// + public bool Delete(int id) + { + + StringBuilder strSql = new StringBuilder(); + strSql.Append("delete from nr_z_cprk "); + strSql.Append(" where id=@id"); + SqlParameter[] parameters = { + new SqlParameter("@id", SqlDbType.Int,4) + }; + parameters[0].Value = id; + + int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); + if (rows > 0) + { + return true; + } + else + { + return false; + } + } + /// + /// 批量删除数据 + /// + public bool DeleteList(string idlist) + { + StringBuilder strSql = new StringBuilder(); + strSql.Append("delete from nr_z_cprk "); + strSql.Append(" where id in (" + idlist + ") "); + int rows = DbHelperSQL.ExecuteSql(strSql.ToString()); + if (rows > 0) + { + return true; + } + else + { + return false; + } + } - /// - /// 得到一个对象实体 - /// - public Maticsoft.Model.nr_z_cprk GetModel(int id) - { - - StringBuilder strSql=new StringBuilder(); - strSql.Append("select top 1 id,rkbh,riqi,scdh,kw,rkxm,cpmc,bzgg,zzsl,lt,sl,dw,jsr,bz,zt from nr_z_cprk "); - strSql.Append(" where id=@id"); - SqlParameter[] parameters = { - new SqlParameter("@id", SqlDbType.Int,4) - }; - parameters[0].Value = id; + /// + /// 得到一个对象实体 + /// + public Maticsoft.Model.nr_z_cprk GetModel(int id) + { - Maticsoft.Model.nr_z_cprk model=new Maticsoft.Model.nr_z_cprk(); - DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); - if(ds.Tables[0].Rows.Count>0) - { - return DataRowToModel(ds.Tables[0].Rows[0]); - } - else - { - return null; - } - } + StringBuilder strSql = new StringBuilder(); + strSql.Append("select top 1 id,rkbh, riqi, scdh, kw, cpbh, cpmc, rkxm, bzgg, guige, zzsl, lt, sl, danwei, zje, jsr, beizhu, zt from nr_z_cprk "); + strSql.Append(" where id=@id"); + SqlParameter[] parameters = { + new SqlParameter("@id", SqlDbType.Int,4) + }; + parameters[0].Value = id; + + Maticsoft.Model.nr_z_cprk model = new Maticsoft.Model.nr_z_cprk(); + DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); + if (ds.Tables[0].Rows.Count > 0) + { + return DataRowToModel(ds.Tables[0].Rows[0]); + } + else + { + return null; + } + } - /// - /// 得到一个对象实体 - /// - public Maticsoft.Model.nr_z_cprk DataRowToModel(DataRow row) - { - Maticsoft.Model.nr_z_cprk model=new Maticsoft.Model.nr_z_cprk(); - if (row != null) - { - if(row["id"]!=null && row["id"].ToString()!="") - { - model.id=int.Parse(row["id"].ToString()); - } - if(row["rkbh"]!=null) - { - model.rkbh=row["rkbh"].ToString(); - } - if(row["riqi"]!=null && row["riqi"].ToString()!="") - { - model.riqi=DateTime.Parse(row["riqi"].ToString()); - } - if(row["scdh"]!=null) - { - model.scdh=row["scdh"].ToString(); - } - if(row["kw"]!=null) - { - model.kw=row["kw"].ToString(); - } - if(row["rkxm"]!=null) - { - model.rkxm=row["rkxm"].ToString(); - } - if(row["cpmc"]!=null) - { - model.cpmc=row["cpmc"].ToString(); - } - if(row["bzgg"]!=null && row["bzgg"].ToString()!="") - { - model.bzgg=decimal.Parse(row["bzgg"].ToString()); - } - if(row["zzsl"]!=null && row["zzsl"].ToString()!="") - { - model.zzsl=int.Parse(row["zzsl"].ToString()); - } - if(row["lt"]!=null && row["lt"].ToString()!="") - { - model.lt=decimal.Parse(row["lt"].ToString()); - } - if(row["sl"]!=null && row["sl"].ToString()!="") - { - model.sl=decimal.Parse(row["sl"].ToString()); - } - if(row["dw"]!=null) - { - model.dw=row["dw"].ToString(); - } - if(row["jsr"]!=null) - { - model.jsr=row["jsr"].ToString(); - } - if(row["bz"]!=null) - { - model.bz=row["bz"].ToString(); - } - if(row["zt"]!=null) - { - model.zt=row["zt"].ToString(); - } - } - return model; - } + /// + /// 得到一个对象实体 + /// + public Maticsoft.Model.nr_z_cprk DataRowToModel(DataRow row) + { - /// - /// 获得数据列表 - /// - public DataSet GetList(string strWhere) - { - StringBuilder strSql=new StringBuilder(); - strSql.Append("select id,rkbh,riqi,scdh,kw,rkxm,cpmc,bzgg,zzsl,lt,sl,dw,jsr,bz,zt "); - strSql.Append(" FROM nr_z_cprk "); - if(strWhere.Trim()!="") - { - strSql.Append(" where "+strWhere); - } - return DbHelperSQL.Query(strSql.ToString()); - } - /// - /// 获得前几行数据 - /// - public DataSet GetList(int Top,string strWhere,string filedOrder) - { - StringBuilder strSql=new StringBuilder(); - strSql.Append("select "); - if(Top>0) - { - strSql.Append(" top "+Top.ToString()); - } - strSql.Append(" id,rkbh,riqi,scdh,kw,rkxm,cpmc,bzgg,zzsl,lt,sl,dw,jsr,bz,zt "); - strSql.Append(" FROM nr_z_cprk "); - if(strWhere.Trim()!="") - { - strSql.Append(" where "+strWhere); - } - strSql.Append(" order by " + filedOrder); - return DbHelperSQL.Query(strSql.ToString()); - } + var model = Mapper.CreateItem(row); + return model; + } - /// - /// 获取记录总数 - /// - public int GetRecordCount(string strWhere) - { - StringBuilder strSql=new StringBuilder(); - strSql.Append("select count(1) FROM nr_z_cprk "); - if(strWhere.Trim()!="") - { - strSql.Append(" where "+strWhere); - } - object obj = DbHelperSQL.GetSingle(strSql.ToString()); - if (obj == null) - { - return 0; - } - else - { - return Convert.ToInt32(obj); - } - } - /// - /// 分页获取数据列表 - /// - public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) - { - StringBuilder strSql=new StringBuilder(); - strSql.Append("SELECT * FROM ( "); - strSql.Append(" SELECT ROW_NUMBER() OVER ("); - if (!string.IsNullOrEmpty(orderby.Trim())) - { - strSql.Append("order by T." + orderby ); - } - else - { - strSql.Append("order by T.id desc"); - } - strSql.Append(")AS Row, T.* from nr_z_cprk T "); - if (!string.IsNullOrEmpty(strWhere.Trim())) - { - strSql.Append(" WHERE " + strWhere); - } - strSql.Append(" ) TT"); - strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex); - return DbHelperSQL.Query(strSql.ToString()); - } + /// + /// 获得数据列表 + /// + public DataSet GetList(string strWhere) + { + StringBuilder strSql = new StringBuilder(); + strSql.Append("select id,rkbh, riqi, scdh, kw, cpbh, cpmc, rkxm, bzgg, guige, zzsl, lt, sl, danwei, zje, jsr, beizhu, zt "); + strSql.Append(" FROM nr_z_cprk "); + if (strWhere.Trim() != "") + { + strSql.Append(" where " + strWhere); + } + return DbHelperSQL.Query(strSql.ToString()); + } - /* + /// + /// 获得前几行数据 + /// + public DataSet GetList(int Top, string strWhere, string filedOrder) + { + StringBuilder strSql = new StringBuilder(); + strSql.Append("select "); + if (Top > 0) + { + strSql.Append(" top " + Top.ToString()); + } + strSql.Append(" id,rkbh, riqi, scdh, kw, cpbh, cpmc, rkxm, bzgg, guige, zzsl, lt, sl, danwei, zje, jsr, beizhu, zt "); + strSql.Append(" FROM nr_z_cprk "); + if (strWhere.Trim() != "") + { + strSql.Append(" where " + strWhere); + } + strSql.Append(" order by " + filedOrder); + return DbHelperSQL.Query(strSql.ToString()); + } + + /// + /// 获取记录总数 + /// + public int GetRecordCount(string strWhere) + { + StringBuilder strSql = new StringBuilder(); + strSql.Append("select count(1) FROM nr_z_cprk "); + if (strWhere.Trim() != "") + { + strSql.Append(" where " + strWhere); + } + object obj = DbHelperSQL.GetSingle(strSql.ToString()); + if (obj == null) + { + return 0; + } + else + { + return Convert.ToInt32(obj); + } + } + /// + /// 分页获取数据列表 + /// + public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) + { + StringBuilder strSql = new StringBuilder(); + strSql.Append("SELECT * FROM ( "); + strSql.Append(" SELECT ROW_NUMBER() OVER ("); + if (!string.IsNullOrEmpty(orderby.Trim())) + { + strSql.Append("order by T." + orderby); + } + else + { + strSql.Append("order by T.id desc"); + } + strSql.Append(")AS Row, T.* from nr_z_cprk T "); + if (!string.IsNullOrEmpty(strWhere.Trim())) + { + strSql.Append(" WHERE " + strWhere); + } + strSql.Append(" ) TT"); + strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex); + return DbHelperSQL.Query(strSql.ToString()); + } + + /* /// /// 分页获取数据列表 /// @@ -406,10 +381,10 @@ namespace Maticsoft.DAL return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds"); }*/ - #endregion BasicMethod - #region ExtensionMethod + #endregion BasicMethod + #region ExtensionMethod - #endregion ExtensionMethod - } + #endregion ExtensionMethod + } } diff --git a/DBUtility/DBUtility.csproj b/DBUtility/DBUtility.csproj index 5a01194..da56cf4 100644 --- a/DBUtility/DBUtility.csproj +++ b/DBUtility/DBUtility.csproj @@ -116,6 +116,7 @@ Code + diff --git a/DBUtility/Mapper.cs b/DBUtility/Mapper.cs new file mode 100644 index 0000000..49e5031 --- /dev/null +++ b/DBUtility/Mapper.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Reflection; +using System.Text; + +namespace Maticsoft.DBUtility +{ + public class Mapper + { + public static T CreateItem(DataRow row) + { + T obj = default(T); + if (row != null) + { + obj = Activator.CreateInstance(); + + foreach (DataColumn column in row.Table.Columns) + { + PropertyInfo prop = obj.GetType().GetProperty(column.ColumnName); + try + { + object value = row[column.ColumnName]; + prop.SetValue(obj, value, null); + } + catch + { //You can log something here + //throw; + } + } + } + + return obj; + } + } +} diff --git a/Model/nr_z_cprk.cs b/Model/nr_z_cprk.cs index c8a26ab..e11c1e5 100644 --- a/Model/nr_z_cprk.cs +++ b/Model/nr_z_cprk.cs @@ -1,152 +1,191 @@ using System; namespace Maticsoft.Model { - /// - /// nr_z_cprk:实体类(属性说明自动提取数据库字段的描述信息) - /// - [Serializable] - public partial class nr_z_cprk - { - public nr_z_cprk() - {} - #region Model - private int _id; - private string _rkbh; - private DateTime _riqi; - private string _scdh; - private string _kw; - private string _rkxm; - private string _cpmc; - private decimal? _bzgg; - private int? _zzsl; - private decimal? _lt; - private decimal? _sl; - private string _dw; - private string _jsr; - private string _bz; - private string _zt; - /// - /// - /// - public int id - { - set{ _id=value;} - get{return _id;} - } - /// - /// - /// - public string rkbh - { - set{ _rkbh=value;} - get{return _rkbh;} - } - /// - /// - /// - public DateTime riqi - { - set{ _riqi=value;} - get{return _riqi;} - } - /// - /// - /// - public string scdh - { - set{ _scdh=value;} - get{return _scdh;} - } - /// - /// - /// - public string kw - { - set{ _kw=value;} - get{return _kw;} - } - /// - /// - /// - public string rkxm - { - set{ _rkxm=value;} - get{return _rkxm;} - } - /// - /// - /// - public string cpmc - { - set{ _cpmc=value;} - get{return _cpmc;} - } - /// - /// - /// - public decimal? bzgg - { - set{ _bzgg=value;} - get{return _bzgg;} - } - /// - /// - /// - public int? zzsl - { - set{ _zzsl=value;} - get{return _zzsl;} - } - /// - /// - /// - public decimal? lt - { - set{ _lt=value;} - get{return _lt;} - } - /// - /// - /// - public decimal? sl - { - set{ _sl=value;} - get{return _sl;} - } - /// - /// - /// - public string dw - { - set{ _dw=value;} - get{return _dw;} - } - /// - /// - /// - public string jsr - { - set{ _jsr=value;} - get{return _jsr;} - } - /// - /// - /// - public string bz - { - set{ _bz=value;} - get{return _bz;} - } - /// - /// - /// - public string zt - { - set{ _zt=value;} - get{return _zt;} - } - #endregion Model - } + /// + /// nr_z_cprk:实体类(属性说明自动提取数据库字段的描述信息) + /// + [Serializable] + public partial class nr_z_cprk + { + + public nr_z_cprk() + { } + #region Model + private int _id; + private string _rkbh; + private DateTime _riqi; + private string _scdh; + private string _kw; + private string _rkxm; + private string _cpbh; + private string _cpmc; + private decimal? _bzgg; + private decimal? _guige; + private int? _zzsl; + private decimal? _lt; + private decimal? _sl; + private string _dw; + private decimal? _zje; + private string _jsr; + private string _bz; + private string _zt; + + + + + /// + /// + /// + public int id + { + set { _id = value; } + get { return _id; } + } + /// + /// + /// + public string rkbh + { + set { _rkbh = value; } + get { return _rkbh; } + } + /// + /// + /// + public DateTime riqi + { + set { _riqi = value; } + get { return _riqi; } + } + /// + /// + /// + public string scdh + { + set { _scdh = value; } + get { return _scdh; } + } + /// + /// + /// + public string kw + { + set { _kw = value; } + get { return _kw; } + } + /// + /// + /// + public string rkxm + { + set { _rkxm = value; } + get { return _rkxm; } + } + + /// + /// + /// + public string cpbh + { + set { _cpbh = value; } + get { return _cpbh; } + } + + /// + /// + /// + public string cpmc + { + set { _cpmc = value; } + get { return _cpmc; } + } + + /// + /// + /// + public decimal? guige + { + set { _guige = value; } + get { return _guige; } + } + + /// + /// + /// + public decimal? bzgg + { + set { _bzgg = value; } + get { return _bzgg; } + } + /// + /// + /// + public int? zzsl + { + set { _zzsl = value; } + get { return _zzsl; } + } + /// + /// + /// + public decimal? lt + { + set { _lt = value; } + get { return _lt; } + } + /// + /// + /// + public decimal? sl + { + set { _sl = value; } + get { return _sl; } + } + /// + /// + /// + public string danwei + { + set { _dw = value; } + get { return _dw; } + } + + /// + /// + /// + public decimal? zje + { + set { _zje = value; } + get { return _zje; } + } + + /// + /// + /// + public string jsr + { + set { _jsr = value; } + get { return _jsr; } + } + /// + /// + /// + public string beizhu + { + set { _bz = value; } + get { return _bz; } + } + /// + /// + /// + public string zt + { + set { _zt = value; } + get { return _zt; } + } + #endregion Model + + } } diff --git a/newyt/Css/right.css b/newyt/Css/right.css index 41018d8..c2ba70f 100644 --- a/newyt/Css/right.css +++ b/newyt/Css/right.css @@ -39,11 +39,11 @@ .right-top-dh{width:300px;float:left; position:relative;} .right-top-dh h4{ padding-left:8px;color: #363636;border-left: 2px solid #0098cd; font-size: 16px; } .right-top-an{ float:left;height:30px;}/*width:800px;*/ -.ulgongju{height:30px; } -.ulgongju li{list-style:none;float:left; cursor:pointer; width:66px;margin-left:5px; +.ulgongju{height:30px;} +.ulgongju li{list-style:none;float:left; cursor:pointer; width:30px;margin-left:5px; } .daohangxlk{ height:25px;cursor:pointer; width:68px; padding:3px; margin-left:10px; margin-top:3px;box-shadow:inset 0px 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; border:1px solid #cccccc; } -.ulgongju li img{width:55px; height:25px; margin-top:2px;} +.ulgongju li img{width:25px; height:25px; margin-top:2px;} .Gjxzhu{ height:85px; display:none; border-bottom:1px solid #eee; margin-bottom:10px;} .right-top-fy{float:right; width:300px; height:30px; line-height:30px;} .right-gjxnr{width:100%; height:80px; text-align:center;} diff --git a/newyt/Images_Folder/addcd.png b/newyt/Images_Folder/addcd.png new file mode 100644 index 0000000..e402a8b Binary files /dev/null and b/newyt/Images_Folder/addcd.png differ diff --git a/newyt/Images_Folder/search.png b/newyt/Images_Folder/search.png new file mode 100644 index 0000000..2a26744 Binary files /dev/null and b/newyt/Images_Folder/search.png differ diff --git a/newyt/Module_data/Productin_Form.aspx b/newyt/Module_data/Productin_Form.aspx index f1b5c66..6ecabac 100644 --- a/newyt/Module_data/Productin_Form.aspx +++ b/newyt/Module_data/Productin_Form.aspx @@ -107,10 +107,9 @@ - - + + - @@ -126,18 +125,11 @@ - - - - + - - - - diff --git a/newyt/Module_data/Productin_Form.aspx.cs b/newyt/Module_data/Productin_Form.aspx.cs index 3ff8738..e565160 100644 --- a/newyt/Module_data/Productin_Form.aspx.cs +++ b/newyt/Module_data/Productin_Form.aspx.cs @@ -11,9 +11,9 @@ public partial class Productin_Form : System.Web.UI.Page //创建一个操作记录bll Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi(); //创建一个共用的申购单模板 - Maticsoft.Model.nr_z_cpck cpckmodel = new Maticsoft.Model.nr_z_cpck(); + Maticsoft.Model.nr_z_cprk cpckmodel = new Maticsoft.Model.nr_z_cprk(); //创建一个共同的申购单bll - Maticsoft.BLL.nr_z_cpck cpckbll = new Maticsoft.BLL.nr_z_cpck(); + Maticsoft.BLL.nr_z_cprk cprkbll = new Maticsoft.BLL.nr_z_cprk(); //创建一个操作记录模板 Maticsoft.Model.nr_sys_rizhi rizhi = new Maticsoft.Model.nr_sys_rizhi(); @@ -41,7 +41,7 @@ public partial class Productin_Form : System.Web.UI.Page pdquanxian(user.juese); riqi.Value = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day; jingshouren.Value = user.zhanghao; - shr.Value = user.zhanghao; + //shr.Value = user.zhanghao; } @@ -50,25 +50,25 @@ public partial class Productin_Form : System.Web.UI.Page #region 修改时获取真正数据值 private void initdata(int did) { - cpckmodel = cpckbll.GetModel(did); - ckdh.Text = cpckmodel.ckbh; + cpckmodel = cprkbll.GetModel(did); + ckdh.Text = cpckmodel.rkbh; riqi.Value = cpckmodel.riqi.ToString("yyyy-MM-dd"); scdh.Value = cpckmodel.scdh; - khming.Value = cpckmodel.khmc; + //khming.Value = cpckmodel.khmc; cpbh.Value = cpckmodel.cpbh; cpmc.Value = cpckmodel.cpmc; - danjia.Value = cpckmodel.cpdj.ToString(); + //danjia.Value = cpckmodel.cpdj.ToString(); guige.Value = cpckmodel.guige.ToString(); zzshuliang.Value = cpckmodel.zzsl.ToString(); lingtou.Value = cpckmodel.lt.ToString(); shuliang.Value = cpckmodel.sl.ToString(); danwei.Value = cpckmodel.danwei; - lxr.Value = cpckmodel.lxr; + //lxr.Value = cpckmodel.lxr; zongjine.Value = cpckmodel.zje.ToString(); - lxdh.Value = cpckmodel.lxdh; + //lxdh.Value = cpckmodel.lxdh; jingshouren.Value = cpckmodel.jsr; - shr.Value = cpckmodel.shr; - dizhi.Value = cpckmodel.shdizhi; + //shr.Value = cpckmodel.shr; + //dizhi.Value = cpckmodel.shdizhi; txt_beizhu.Text = cpckmodel.beizhu; zhuangtai.Value = cpckmodel.zt; } @@ -77,24 +77,24 @@ public partial class Productin_Form : System.Web.UI.Page #region 获取页面参数赋值model对象 private void getmd() { - cpckmodel.ckbh = ckdh.Text; + cpckmodel.rkbh = ckdh.Text; cpckmodel.riqi = Convert.ToDateTime(riqi.Value); cpckmodel.scdh = scdh.Value; - cpckmodel.khmc = khming.Value; + //cpckmodel.khmc = khming.Value; cpckmodel.cpbh = cpbh.Value; cpckmodel.cpmc = cpmc.Value; - cpckmodel.cpdj = Convert.ToDecimal(danjia.Value); + //cpckmodel.cpdj = Convert.ToDecimal(danjia.Value); cpckmodel.guige = Convert.ToDecimal(guige.Value); cpckmodel.zzsl = Convert.ToInt32(zzshuliang.Value); cpckmodel.lt = Convert.ToDecimal(lingtou.Value); cpckmodel.sl = Convert.ToDecimal(shuliang.Value); cpckmodel.danwei = danwei.Value; - cpckmodel.lxr = lxr.Value; + //cpckmodel.lxr = lxr.Value; cpckmodel.zje = Convert.ToDecimal(zongjine.Value); - cpckmodel.lxdh = lxdh.Value; + //cpckmodel.lxdh = lxdh.Value; cpckmodel.jsr = jingshouren.Value; - cpckmodel.shr = shr.Value; - cpckmodel.shdizhi = dizhi.Value; + //cpckmodel.shr = shr.Value; + //cpckmodel.shdizhi = dizhi.Value; cpckmodel.beizhu = txt_beizhu.Text; cpckmodel.zt = zhuangtai.Value; @@ -148,7 +148,7 @@ public partial class Productin_Form : System.Web.UI.Page if (id.Value != null && id.Value != "") { cpckmodel.id = Convert.ToInt32(id.Value); - if (cpckbll.Update(cpckmodel)) + if (cprkbll.Update(cpckmodel)) { rtx = Convert.ToInt32(id.Value); caozuo = "修改"; @@ -156,9 +156,9 @@ public partial class Productin_Form : System.Web.UI.Page } else { - cpckmodel.ckbh = DBHlper.getbh("CPCK-", "nr_z_cpck", "ckbh", 4); + cpckmodel.rkbh = DBHlper.getbh("CPRK-", "nr_z_cprk", "rkbh", 4); // bh.Text = sgdmodel.sgdbianhao; - rtx = cpckbll.Add(cpckmodel); + rtx = cprkbll.Add(cpckmodel); } if (rtx > 0) { @@ -166,8 +166,8 @@ public partial class Productin_Form : System.Web.UI.Page Maticsoft.Model.nr_z_yhzh zh = (Maticsoft.Model.nr_z_yhzh)Session["user"]; rizhi.yonghuming = zh.zhanghao; //拼接字符串插入日志 - rizhi.jilu = zh.zhanghao + caozuo + "了成品出库,出库单号为:" + ckdh.Text.Trim(); - rizhi.leixing = "成品出库"; + rizhi.jilu = zh.zhanghao + caozuo + "了成品入库,入库单号为:" + ckdh.Text.Trim(); + rizhi.leixing = "成品入库"; rizhi.riqi = DateTime.Now; rizhibll.Add(rizhi); Response.Redirect("Productin_browse.aspx?uid=" + rtx, false); diff --git a/newyt/ddselect/Product_list.aspx b/newyt/ddselect/Product_list.aspx index 5b03a9e..6cc95dc 100644 --- a/newyt/ddselect/Product_list.aspx +++ b/newyt/ddselect/Product_list.aspx @@ -24,22 +24,22 @@ var xinxizu = cpxinxi.split('//'); var rowval = $("body", parent.document).find('#dialogcp').attr("tag"); var pagename = $("body", parent.document).find('#pagename').val(); - if (pagename == 'cpck') { + if (pagename == 'cpck') { $("body", parent.document).find('#cpbh').val(xinxizu[0]); $("body", parent.document).find('#cpmc').val(xinxizu[1]); $("body", parent.document).find('#shuliang').val(xinxizu[2]); $("body", parent.document).find('#danjia').val(xinxizu[3]); $("body", parent.document).find('#danwei').val(xinxizu[4]); - $("body", parent.document).find('#btn_cpclose').click(); + //$("body", parent.document).find('#btn_cpclose').click(); //$("body", parent.document).find('#guige').keyup(); } else if (pagename == 'cpbom') { $("body", parent.document).find('#cpbh' + rowval).val(xinxizu[0]); - $("body", parent.document).find('#cpmc'+ rowval).val(xinxizu[1]); - $("body", parent.document).find('#mxlx'+ rowval).val("产品"); - $("body", parent.document).find('#cpdj'+ rowval).val(xinxizu[3]); - $("body", parent.document).find('#cpdw'+ rowval).val(xinxizu[4]); - $("body", parent.document).find('#btn_cpclose').click(); + $("body", parent.document).find('#cpmc' + rowval).val(xinxizu[1]); + $("body", parent.document).find('#mxlx' + rowval).val("产品"); + $("body", parent.document).find('#cpdj' + rowval).val(xinxizu[3]); + $("body", parent.document).find('#cpdw' + rowval).val(xinxizu[4]); + //$("body", parent.document).find('#btn_cpclose').click(); } else if (pagename == 'dd') { $("body", parent.document).find('#mxlx' + rowval).val("产品"); $("body", parent.document).find('#cphh' + rowval).val(xinxizu[0]); @@ -50,10 +50,17 @@ $("body", parent.document).find('#zhonglei' + rowval).val(xinxizu[8]); $("body", parent.document).find('#danwei' + rowval).val(xinxizu[4]); $("body", parent.document).find('#danjia' + rowval).val(xinxizu[3]); - - $("body", parent.document).find('#btn_cpclose').click(); + + //$("body", parent.document).find('#btn_cpclose').click(); + } else if (pagename == 'cprk') { + $("body", parent.document).find('#cpbh').val(xinxizu[0]); + $("body", parent.document).find('#cpmc').val(xinxizu[1]); + $("body", parent.document).find('#shuliang').val(xinxizu[2]); + $("body", parent.document).find('#danjia').val(xinxizu[3]); + $("body", parent.document).find('#danwei').val(xinxizu[4]); } + $("body", parent.document).find('#btn_cpclose').click(); } function select(obj) { $(".xz").attr("src", "../Images_Folder/checkOff1.png"); diff --git a/newyt/ddselect/kehu_list.aspx b/newyt/ddselect/kehu_list.aspx index 9a062ac..953b2ce 100644 --- a/newyt/ddselect/kehu_list.aspx +++ b/newyt/ddselect/kehu_list.aspx @@ -81,7 +81,7 @@
出库编号出库日期入库编号入库日期 单据编号客户名称 产品编号 产品名称  
单位联系人联系电话经手人送货人经手人 状态  
送货地址 
备注  
    -
  • +
diff --git a/newyt/ddselect/shengchandan.aspx b/newyt/ddselect/shengchandan.aspx index 767f298..ab1d6bd 100644 --- a/newyt/ddselect/shengchandan.aspx +++ b/newyt/ddselect/shengchandan.aspx @@ -28,24 +28,36 @@ $(obj).children("td:first").children().attr("src", "../Images_Folder/checkOn1.png"); } function check(id) { + debugger var xinxi = ddselect_shengchandan.getxinxi(id).value; var xxzu = xinxi.split('/'); var pagename = $("body", parent.document).find('#pagename').val(); if (pagename == 'sg') { $("body", parent.document).find('#txt_shengchandan').val(xxzu[1]); $("body", parent.document).find('#scdidhidden').val(xxzu[0]); + } else if (pagename == 'qtck') { + $("body", parent.document).find('#scdh').val(xxzu[1]); + $("body", parent.document).find('#khbh').val(xxzu[10]); + $("body", parent.document).find('#khmc').val(xxzu[3]); + } else if (pagename == 'cpck') { + $("body", parent.document).find('#scdh').val(xxzu[1]); + $("body", parent.document).find('#lxr').val(xxzu[6]); + $("body", parent.document).find('#lxdh').val(xxzu[7]); + $("body", parent.document).find('#khming').val(xxzu[3]); + $("body", parent.document).find('#dizhi').val(xxzu[9]); + $("body", parent.document).find('#guige').val(xxzu[8]); + $("body", parent.document).find('#shuliang').val(xxzu[8]); } else if (pagename == 'cprk') { + /* + else if (pagename == 'cprk') { $("body", parent.document).find('#shengchandan').val(xxzu[1]); $("body", parent.document).find('#xiangmu').val(xxzu[4]); $("body", parent.document).find('#rpmingcheng').val(xxzu[4]); $("body", parent.document).find('#danwei').val(xxzu[5]); $("body", parent.document).find('#guige').val(xxzu[8]); $("body", parent.document).find('#shuliang').val(xxzu[8]); - } else if (pagename == 'qtck') { - $("body", parent.document).find('#scdh').val(xxzu[1]); - $("body", parent.document).find('#khbh').val(xxzu[10]); - $("body", parent.document).find('#khmc').val(xxzu[3]); - } else if (pagename == 'cpck') { + } + */ $("body", parent.document).find('#scdh').val(xxzu[1]); $("body", parent.document).find('#lxr').val(xxzu[6]); $("body", parent.document).find('#lxdh').val(xxzu[7]);