Exemple #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static yny_005.Model.C_Car GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,PZCode,CarType,CarBrand,CarEngine,CarCJCode,CarXSZCode,CarDW,RYType,BXDate,YYZDate,BYDate,GJYDate,AQFDate,CarZLC,Remark,IsDelete,CreateDate,Spare1,Spare2,Spare3,CType,JQXDate,SZXDate,CYXDate,CLRHDate,CLJJPDDate,YSJZ from C_Car ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            yny_005.Model.C_Car model = new yny_005.Model.C_Car();
            DataSet             ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static int Add(yny_005.Model.C_Car model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into C_Car(");
            strSql.Append("PZCode,CarType,CarBrand,CarEngine,CarCJCode,CarXSZCode,CarDW,RYType,BXDate,YYZDate,BYDate,GJYDate,AQFDate,CarZLC,Remark,IsDelete,CreateDate,Spare1,Spare2,Spare3,CType,JQXDate,SZXDate,CYXDate,CLRHDate,CLJJPDDate,YSJZ)");
            strSql.Append(" values (");
            strSql.Append("@PZCode,@CarType,@CarBrand,@CarEngine,@CarCJCode,@CarXSZCode,@CarDW,@RYType,@BXDate,@YYZDate,@BYDate,@GJYDate,@AQFDate,@CarZLC,@Remark,@IsDelete,@CreateDate,@Spare1,@Spare2,@Spare3,@CType,@JQXDate,@SZXDate,@CYXDate,@CLRHDate,@CLJJPDDate,@YSJZ)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PZCode",     SqlDbType.VarChar,    50),
                new SqlParameter("@CarType",    SqlDbType.VarChar,    50),
                new SqlParameter("@CarBrand",   SqlDbType.VarChar,    50),
                new SqlParameter("@CarEngine",  SqlDbType.VarChar,    50),
                new SqlParameter("@CarCJCode",  SqlDbType.VarChar,    50),
                new SqlParameter("@CarXSZCode", SqlDbType.VarChar,    50),
                new SqlParameter("@CarDW",      SqlDbType.Decimal,     9),
                new SqlParameter("@RYType",     SqlDbType.VarChar,    10),
                new SqlParameter("@BXDate",     SqlDbType.DateTime),
                new SqlParameter("@YYZDate",    SqlDbType.DateTime),
                new SqlParameter("@BYDate",     SqlDbType.DateTime),
                new SqlParameter("@GJYDate",    SqlDbType.DateTime),
                new SqlParameter("@AQFDate",    SqlDbType.DateTime),
                new SqlParameter("@CarZLC",     SqlDbType.Int,         4),
                new SqlParameter("@Remark",     SqlDbType.VarChar,   250),
                new SqlParameter("@IsDelete",   SqlDbType.Int,         4),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@Spare1",     SqlDbType.VarChar,   250),
                new SqlParameter("@Spare2",     SqlDbType.VarChar,   250),
                new SqlParameter("@Spare3",     SqlDbType.VarChar,   250),new SqlParameter("@CType",SqlDbType.VarChar, 50),
                new SqlParameter("@JQXDate",    SqlDbType.DateTime),
                new SqlParameter("@SZXDate",    SqlDbType.DateTime),
                new SqlParameter("@CYXDate",    SqlDbType.DateTime),
                new SqlParameter("@CLRHDate",   SqlDbType.DateTime),
                new SqlParameter("@CLJJPDDate", SqlDbType.DateTime),
                new SqlParameter("@YSJZ",       SqlDbType.VarChar, 50)
            };
            parameters[0].Value  = model.PZCode;
            parameters[1].Value  = model.CarType;
            parameters[2].Value  = model.CarBrand;
            parameters[3].Value  = model.CarEngine;
            parameters[4].Value  = model.CarCJCode;
            parameters[5].Value  = model.CarXSZCode;
            parameters[6].Value  = model.CarDW;
            parameters[7].Value  = model.RYType;
            parameters[8].Value  = model.BXDate;
            parameters[9].Value  = model.YYZDate;
            parameters[10].Value = model.BYDate;
            parameters[11].Value = model.GJYDate;
            parameters[12].Value = model.AQFDate;
            parameters[13].Value = model.CarZLC;
            parameters[14].Value = model.Remark;
            parameters[15].Value = model.IsDelete;
            parameters[16].Value = model.CreateDate;
            parameters[17].Value = model.Spare1;
            parameters[18].Value = model.Spare2;
            parameters[19].Value = model.Spare3;
            parameters[20].Value = model.CType;

            parameters[21].Value = model.JQXDate;
            parameters[22].Value = model.SZXDate;
            parameters[23].Value = model.CYXDate;
            parameters[24].Value = model.CLRHDate;
            parameters[25].Value = model.CLJJPDDate;
            parameters[26].Value = model.YSJZ;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public static yny_005.Model.C_Car DataRowToModel(DataRow row)
 {
     yny_005.Model.C_Car model = new yny_005.Model.C_Car();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["PZCode"] != null)
         {
             model.PZCode = row["PZCode"].ToString();
         }
         if (row["CarType"] != null)
         {
             model.CarType = row["CarType"].ToString();
         }
         if (row["CarBrand"] != null)
         {
             model.CarBrand = row["CarBrand"].ToString();
         }
         if (row["CarEngine"] != null)
         {
             model.CarEngine = row["CarEngine"].ToString();
         }
         if (row["CarCJCode"] != null)
         {
             model.CarCJCode = row["CarCJCode"].ToString();
         }
         if (row["CarXSZCode"] != null)
         {
             model.CarXSZCode = row["CarXSZCode"].ToString();
         }
         if (row["CarDW"] != null && row["CarDW"].ToString() != "")
         {
             model.CarDW = decimal.Parse(row["CarDW"].ToString());
         }
         if (row["RYType"] != null)
         {
             model.RYType = row["RYType"].ToString();
         }
         if (row["BXDate"] != null && row["BXDate"].ToString() != "")
         {
             model.BXDate = DateTime.Parse(row["BXDate"].ToString());
         }
         if (row["YYZDate"] != null && row["YYZDate"].ToString() != "")
         {
             model.YYZDate = DateTime.Parse(row["YYZDate"].ToString());
         }
         if (row["BYDate"] != null && row["BYDate"].ToString() != "")
         {
             model.BYDate = DateTime.Parse(row["BYDate"].ToString());
         }
         if (row["GJYDate"] != null && row["GJYDate"].ToString() != "")
         {
             model.GJYDate = DateTime.Parse(row["GJYDate"].ToString());
         }
         if (row["AQFDate"] != null && row["AQFDate"].ToString() != "")
         {
             model.AQFDate = DateTime.Parse(row["AQFDate"].ToString());
         }
         if (row["CarZLC"] != null && row["CarZLC"].ToString() != "")
         {
             model.CarZLC = int.Parse(row["CarZLC"].ToString());
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
         if (row["IsDelete"] != null && row["IsDelete"].ToString() != "")
         {
             model.IsDelete = int.Parse(row["IsDelete"].ToString());
         }
         if (row["CreateDate"] != null && row["CreateDate"].ToString() != "")
         {
             model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
         }
         if (row["Spare1"] != null)
         {
             model.Spare1 = row["Spare1"].ToString();
         }
         if (row["Spare2"] != null)
         {
             model.Spare2 = row["Spare2"].ToString();
         }
         if (row["Spare3"] != null)
         {
             model.Spare3 = row["Spare3"].ToString();
         }
         if (row["CType"] != null)
         {
             model.CType = row["CType"].ToString();
         }
         if (row["JQXDate"] != null && row["JQXDate"].ToString() != "")
         {
             model.JQXDate = DateTime.Parse(row["JQXDate"].ToString());
         }
         if (row["SZXDate"] != null && row["SZXDate"].ToString() != "")
         {
             model.SZXDate = DateTime.Parse(row["SZXDate"].ToString());
         }
         if (row["CYXDate"] != null && row["CYXDate"].ToString() != "")
         {
             model.CYXDate = DateTime.Parse(row["CYXDate"].ToString());
         }
         if (row["CLRHDate"] != null && row["CLRHDate"].ToString() != "")
         {
             model.CLRHDate = DateTime.Parse(row["CLRHDate"].ToString());
         }
         if (row["CLJJPDDate"] != null && row["CLJJPDDate"].ToString() != "")
         {
             model.CLJJPDDate = DateTime.Parse(row["CLJJPDDate"].ToString());
         }
         if (row["YSJZ"] != null)
         {
             model.YSJZ = row["YSJZ"].ToString();
         }
     }
     return(model);
 }
Exemple #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static Hashtable Update(yny_005.Model.C_Car model, Hashtable MyHs)
        {
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update C_Car set ");
            strSql.Append("PZCode=@PZCode,");
            strSql.Append("CarType=@CarType,");
            strSql.Append("CarBrand=@CarBrand,");
            strSql.Append("CarEngine=@CarEngine,");
            strSql.Append("CarCJCode=@CarCJCode,");
            strSql.Append("CarXSZCode=@CarXSZCode,");
            strSql.Append("CarDW=@CarDW,");
            strSql.Append("RYType=@RYType,");
            strSql.Append("BXDate=@BXDate,");
            strSql.Append("YYZDate=@YYZDate,");
            strSql.Append("BYDate=@BYDate,");
            strSql.Append("GJYDate=@GJYDate,");
            strSql.Append("AQFDate=@AQFDate,");
            strSql.Append("CarZLC=@CarZLC,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("IsDelete=@IsDelete,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("Spare1=@Spare1,");
            strSql.Append("Spare2=@Spare2,");
            strSql.Append("Spare3=@Spare3,");
            strSql.Append("CType=@CType,");
            strSql.Append("JQXDate=@JQXDate,");
            strSql.Append("SZXDate=@SZXDate,");
            strSql.Append("CYXDate=@CYXDate,");
            strSql.Append("CLRHDate=@CLRHDate,");
            strSql.Append("CLJJPDDate=@CLJJPDDate, ");
            strSql.Append("YSJZ=@YSJZ ");
            strSql.Append(" where ID=@ID");
            strSql.AppendFormat(" ;select '{0}'", guid);
            SqlParameter[] parameters =
            {
                new SqlParameter("@PZCode",     SqlDbType.VarChar,    50),
                new SqlParameter("@CarType",    SqlDbType.VarChar,    50),
                new SqlParameter("@CarBrand",   SqlDbType.VarChar,    50),
                new SqlParameter("@CarEngine",  SqlDbType.VarChar,    50),
                new SqlParameter("@CarCJCode",  SqlDbType.VarChar,    50),
                new SqlParameter("@CarXSZCode", SqlDbType.VarChar,    50),
                new SqlParameter("@CarDW",      SqlDbType.Decimal,     9),
                new SqlParameter("@RYType",     SqlDbType.VarChar,    10),
                new SqlParameter("@BXDate",     SqlDbType.DateTime),
                new SqlParameter("@YYZDate",    SqlDbType.DateTime),
                new SqlParameter("@BYDate",     SqlDbType.DateTime),
                new SqlParameter("@GJYDate",    SqlDbType.DateTime),
                new SqlParameter("@AQFDate",    SqlDbType.DateTime),
                new SqlParameter("@CarZLC",     SqlDbType.Int,         4),
                new SqlParameter("@Remark",     SqlDbType.VarChar,   250),
                new SqlParameter("@IsDelete",   SqlDbType.Int,         4),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@Spare1",     SqlDbType.VarChar,   250),
                new SqlParameter("@Spare2",     SqlDbType.VarChar,   250),
                new SqlParameter("@Spare3",     SqlDbType.VarChar,   250),
                new SqlParameter("@CType",      SqlDbType.VarChar,    50),
                new SqlParameter("@JQXDate",    SqlDbType.DateTime),
                new SqlParameter("@SZXDate",    SqlDbType.DateTime),
                new SqlParameter("@CYXDate",    SqlDbType.DateTime),
                new SqlParameter("@CLRHDate",   SqlDbType.DateTime),
                new SqlParameter("@CLJJPDDate", SqlDbType.DateTime),
                new SqlParameter("@YSJZ",       SqlDbType.VarChar,    50),
                new SqlParameter("@ID",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.PZCode;
            parameters[1].Value  = model.CarType;
            parameters[2].Value  = model.CarBrand;
            parameters[3].Value  = model.CarEngine;
            parameters[4].Value  = model.CarCJCode;
            parameters[5].Value  = model.CarXSZCode;
            parameters[6].Value  = model.CarDW;
            parameters[7].Value  = model.RYType;
            parameters[8].Value  = model.BXDate;
            parameters[9].Value  = model.YYZDate;
            parameters[10].Value = model.BYDate;
            parameters[11].Value = model.GJYDate;
            parameters[12].Value = model.AQFDate;
            parameters[13].Value = model.CarZLC;
            parameters[14].Value = model.Remark;
            parameters[15].Value = model.IsDelete;
            parameters[16].Value = model.CreateDate;
            parameters[17].Value = model.Spare1;
            parameters[18].Value = model.Spare2;
            parameters[19].Value = model.Spare3;
            parameters[20].Value = model.CType;
            parameters[21].Value = model.JQXDate;
            parameters[22].Value = model.SZXDate;
            parameters[23].Value = model.CYXDate;
            parameters[24].Value = model.CLRHDate;
            parameters[25].Value = model.CLJJPDDate;
            parameters[26].Value = model.YSJZ;
            parameters[27].Value = model.ID;

            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
Exemple #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static bool Update(yny_005.Model.C_Car model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update C_Car set ");
            strSql.Append("PZCode=@PZCode,");
            strSql.Append("CarType=@CarType,");
            strSql.Append("CarBrand=@CarBrand,");
            strSql.Append("CarEngine=@CarEngine,");
            strSql.Append("CarCJCode=@CarCJCode,");
            strSql.Append("CarXSZCode=@CarXSZCode,");
            strSql.Append("CarDW=@CarDW,");
            strSql.Append("RYType=@RYType,");
            strSql.Append("BXDate=@BXDate,");
            strSql.Append("YYZDate=@YYZDate,");
            strSql.Append("BYDate=@BYDate,");
            strSql.Append("GJYDate=@GJYDate,");
            strSql.Append("AQFDate=@AQFDate,");
            strSql.Append("CarZLC=@CarZLC,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("IsDelete=@IsDelete,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("Spare1=@Spare1,");
            strSql.Append("Spare2=@Spare2,");
            strSql.Append("Spare3=@Spare3,");
            strSql.Append("CType=@CType,");

            strSql.Append("JQXDate=@JQXDate,");
            strSql.Append("SZXDate=@SZXDate,");
            strSql.Append("CYXDate=@CYXDate,");
            strSql.Append("CLRHDate=@CLRHDate,");
            strSql.Append("CLJJPDDate=@CLJJPDDate, ");
            strSql.Append("YSJZ=@YSJZ ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PZCode",     SqlDbType.VarChar,    50),
                new SqlParameter("@CarType",    SqlDbType.VarChar,    50),
                new SqlParameter("@CarBrand",   SqlDbType.VarChar,    50),
                new SqlParameter("@CarEngine",  SqlDbType.VarChar,    50),
                new SqlParameter("@CarCJCode",  SqlDbType.VarChar,    50),
                new SqlParameter("@CarXSZCode", SqlDbType.VarChar,    50),
                new SqlParameter("@CarDW",      SqlDbType.Decimal,     9),
                new SqlParameter("@RYType",     SqlDbType.VarChar,    10),
                new SqlParameter("@BXDate",     SqlDbType.DateTime),
                new SqlParameter("@YYZDate",    SqlDbType.DateTime),
                new SqlParameter("@BYDate",     SqlDbType.DateTime),
                new SqlParameter("@GJYDate",    SqlDbType.DateTime),
                new SqlParameter("@AQFDate",    SqlDbType.DateTime),
                new SqlParameter("@CarZLC",     SqlDbType.Int,         4),
                new SqlParameter("@Remark",     SqlDbType.VarChar,   250),
                new SqlParameter("@IsDelete",   SqlDbType.Int,         4),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@Spare1",     SqlDbType.VarChar,   250),
                new SqlParameter("@Spare2",     SqlDbType.VarChar,   250),
                new SqlParameter("@Spare3",     SqlDbType.VarChar,   250),
                new SqlParameter("@CType",      SqlDbType.VarChar,    50),
                new SqlParameter("@JQXDate",    SqlDbType.DateTime),
                new SqlParameter("@SZXDate",    SqlDbType.DateTime),
                new SqlParameter("@CYXDate",    SqlDbType.DateTime),
                new SqlParameter("@CLRHDate",   SqlDbType.DateTime),
                new SqlParameter("@CLJJPDDate", SqlDbType.DateTime),
                new SqlParameter("@YSJZ",       SqlDbType.VarChar,    50),
                new SqlParameter("@ID",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.PZCode;
            parameters[1].Value  = model.CarType;
            parameters[2].Value  = model.CarBrand;
            parameters[3].Value  = model.CarEngine;
            parameters[4].Value  = model.CarCJCode;
            parameters[5].Value  = model.CarXSZCode;
            parameters[6].Value  = model.CarDW;
            parameters[7].Value  = model.RYType;
            parameters[8].Value  = model.BXDate;
            parameters[9].Value  = model.YYZDate;
            parameters[10].Value = model.BYDate;
            parameters[11].Value = model.GJYDate;
            parameters[12].Value = model.AQFDate;
            parameters[13].Value = model.CarZLC;
            parameters[14].Value = model.Remark;
            parameters[15].Value = model.IsDelete;
            parameters[16].Value = model.CreateDate;
            parameters[17].Value = model.Spare1;
            parameters[18].Value = model.Spare2;
            parameters[19].Value = model.Spare3;
            parameters[20].Value = model.CType;

            parameters[21].Value = model.JQXDate;
            parameters[22].Value = model.SZXDate;
            parameters[23].Value = model.CYXDate;
            parameters[24].Value = model.CLRHDate;
            parameters[25].Value = model.CLJJPDDate;
            parameters[26].Value = model.YSJZ;


            parameters[27].Value = model.ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static Hashtable Update(yny_005.Model.C_Car model, Hashtable MyHs)
 {
     return(DAL.C_Car.Update(model, MyHs));
 }
Exemple #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(yny_005.Model.C_Car model)
 {
     return(DAL.C_Car.Update(model));
 }
Exemple #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int  Add(yny_005.Model.C_Car model)
 {
     return(DAL.C_Car.Add(model));
 }