Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update_sfdc(YJUI.Model.ui_fhqk model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ui_fhqk set ");
            strSql.Append("sfdc=@sfdc,"); //是否点出
            strSql.Append("dcsj=@dcsj,"); //点出时间
            strSql.Append("sfjd=@sfjd,"); //是否急单
            strSql.Append("beizhu=@beizhu");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sfdc",   SqlDbType.VarChar, 50),
                new SqlParameter("@dcsj",   SqlDbType.VarChar, 50),
                new SqlParameter("@sfjd",   SqlDbType.VarChar, 50),
                new SqlParameter("@beizhu", SqlDbType.Text),
                new SqlParameter("@ID",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.sfdc;
            parameters[1].Value = model.dcsj;
            parameters[2].Value = model.sfjd;
            parameters[3].Value = model.beizhu;
            parameters[4].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public YJUI.Model.ui_fhqk DataRowToModel(DataRow row)
 {
     YJUI.Model.ui_fhqk model = new YJUI.Model.ui_fhqk();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["djmc"] != null)
         {
             model.djmc = row["djmc"].ToString();
         }
         if (row["xhdh"] != null)
         {
             model.xhdh = row["xhdh"].ToString();
         }
         if (row["khqc"] != null)
         {
             model.khqc = row["khqc"].ToString();
         }
         if (row["zsl"] != null && row["zsl"].ToString() != "")
         {
             model.zsl = decimal.Parse(row["zsl"].ToString());
         }
         if (row["xhje"] != null && row["xhje"].ToString() != "")
         {
             model.xhje = decimal.Parse(row["xhje"].ToString());
         }
         if (row["fhck"] != null)
         {
             model.fhck = row["fhck"].ToString();
         }
         if (row["sfdc"] != null)
         {
             model.sfdc = row["sfdc"].ToString();
         }
         if (row["sfdb"] != null)
         {
             model.dcsj = row["dcsj"].ToString();
         }
         if (row["sffc"] != null)
         {
             model.sffc = row["sffc"].ToString();
         }
         if (row["fcsj"] != null && row["fcsj"].ToString() != "")
         {
             model.fcsj = row["fcsj"].ToString();
         }
         if (row["sfjd"] != null)
         {
             model.sfjd = row["sfjd"].ToString();
         }
     }
     return(model);
 }
Пример #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(YJUI.Model.ui_fhqk model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ui_fhqk(");
            strSql.Append("djmc,xhdh,khqc,zsl,xhje,fhck,sfdc,sfdb,sffc,fcsj,sfjd)");
            strSql.Append(" values (");
            strSql.Append("@djmc,@xhdh,@khqc,@zsl,@xhje,@fhck,@sfdc,@sfdb,@sffc,@fcsj,@sfjd)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@djmc", SqlDbType.Char,      10),
                new SqlParameter("@xhdh", SqlDbType.Char,      11),
                new SqlParameter("@khqc", SqlDbType.Char,      72),
                new SqlParameter("@zsl",  SqlDbType.Decimal,    9),
                new SqlParameter("@xhje", SqlDbType.Decimal,    9),
                new SqlParameter("@fhck", SqlDbType.Char,      10),
                new SqlParameter("@sfdc", SqlDbType.Char,      10),
                new SqlParameter("@sfdb", SqlDbType.Char,      10),
                new SqlParameter("@sffc", SqlDbType.Char,      10),
                new SqlParameter("@fcsj", SqlDbType.DateTime),
                new SqlParameter("@sfjd", SqlDbType.Char, 10)
            };
            parameters[0].Value  = model.djmc;
            parameters[1].Value  = model.xhdh;
            parameters[2].Value  = model.khqc;
            parameters[3].Value  = model.zsl;
            parameters[4].Value  = model.xhje;
            parameters[5].Value  = model.fhck;
            parameters[6].Value  = model.sfdc;
            parameters[7].Value  = model.dcsj;
            parameters[8].Value  = model.sffc;
            parameters[9].Value  = model.fcsj;
            parameters[10].Value = model.sfjd;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public YJUI.Model.ui_fhqk GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,djmc,xhdh,khqc,zsl,xhje,fhck,sfdc,sfdb,sffc,fcsj,sfjd from ui_fhqk ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }