Ejemplo n.º 1
0
        public int Update(YHFramework.SysModel.BoxNumberModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BoxNumber set ");
            strSql.Append("BoxNumber=@BoxNumber,ShortBoxNumber=@ShortBoxNumber,IndexCode=@IndexCode,BatchNumber=@BatchNumber,ContentStatusId=@ContentStatusId,IsBind=@IsBind,BindTime=@BindTime,UpdateOn=@UpdateOn,CreateOn=@CreateOn,ApployInfoId=@ApployInfoId ");
            strSql.Append(" where BoxNumberId=@BoxNumberId ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@BoxNumber", DbTool.FixSqlParameter(model.BoxNumber))
                ,                              new SqlParameter("@ShortBoxNumber", DbTool.FixSqlParameter(model.ShortBoxNumber))
                ,                              new SqlParameter("@IndexCode", DbTool.FixSqlParameter(model.IndexCode))
                ,                              new SqlParameter("@BatchNumber", DbTool.FixSqlParameter(model.BatchNumber))
                ,                              new SqlParameter("@ContentStatusId", DbTool.FixSqlParameter(model.ContentStatusId))
                ,                              new SqlParameter("@IsBind", DbTool.FixSqlParameter(model.IsBind))
                ,                              new SqlParameter("@BindTime", DbTool.FixSqlParameter(model.BindTime))
                ,                              new SqlParameter("@UpdateOn", DbTool.FixSqlParameter(model.UpdateOn))
                ,                              new SqlParameter("@CreateOn", DbTool.FixSqlParameter(model.CreateOn))
                ,                              new SqlParameter("@ApployInfoId", DbTool.FixSqlParameter(model.ApployInfoId))
                ,                              new SqlParameter("@BoxNumberId", model.BoxNumberId)
            };


            return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters));
        }
Ejemplo n.º 2
0
        public int Add(YHFramework.SysModel.BoxNumberModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into  [BoxNumber]");
            strSql.Append("(BoxNumber,ShortBoxNumber,IndexCode,BatchNumber,ContentStatusId,IsBind,BindTime,UpdateOn,CreateOn,ApployInfoId)");
            strSql.Append(" values (@BoxNumber,@ShortBoxNumber,@IndexCode,@BatchNumber,@ContentStatusId,@IsBind,@BindTime,@UpdateOn,@CreateOn,@ApployInfoId)");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BoxNumber", DbTool.FixSqlParameter(model.BoxNumber))
                ,                              new SqlParameter("@ShortBoxNumber", DbTool.FixSqlParameter(model.ShortBoxNumber))
                ,                              new SqlParameter("@IndexCode", DbTool.FixSqlParameter(model.IndexCode))
                ,                              new SqlParameter("@BatchNumber", DbTool.FixSqlParameter(model.BatchNumber))
                ,                              new SqlParameter("@ContentStatusId", DbTool.FixSqlParameter(model.ContentStatusId))
                ,                              new SqlParameter("@IsBind", DbTool.FixSqlParameter(model.IsBind))
                ,                              new SqlParameter("@BindTime", DbTool.FixSqlParameter(model.BindTime))
                ,                              new SqlParameter("@UpdateOn", DbTool.FixSqlParameter(model.UpdateOn))
                ,                              new SqlParameter("@CreateOn", DbTool.FixSqlParameter(model.CreateOn))
                ,                              new SqlParameter("@ApployInfoId", DbTool.FixSqlParameter(model.ApployInfoId))
            };


            return(DbTool.ConvertObject <int>(SqlHelper.ExecuteScalar(conn, CommandType.Text, strSql.ToString(), parameters), 0));
        }
Ejemplo n.º 3
0
        protected YHFramework.SysModel.BoxNumberModel AutoBindDataReader(SqlDataReader dr, params string[] fields)
        {
            var model = new YHFramework.SysModel.BoxNumberModel();

            if (DbTool.HasFields("BoxNumberId", fields))
            {
                model.BoxNumberId = DbTool.ConvertObject <System.Int32>(dr["BoxNumberId"]);
            }
            if (DbTool.HasFields("BoxNumber", fields))
            {
                model.BoxNumber = DbTool.ConvertObject <System.String>(dr["BoxNumber"]);
            }
            if (DbTool.HasFields("ShortBoxNumber", fields))
            {
                model.ShortBoxNumber = DbTool.ConvertObject <System.String>(dr["ShortBoxNumber"]);
            }
            if (DbTool.HasFields("IndexCode", fields))
            {
                model.IndexCode = DbTool.ConvertObject <System.String>(dr["IndexCode"]);
            }
            if (DbTool.HasFields("BatchNumber", fields))
            {
                model.BatchNumber = DbTool.ConvertObject <System.String>(dr["BatchNumber"]);
            }
            if (DbTool.HasFields("ContentStatusId", fields))
            {
                model.ContentStatusId = DbTool.ConvertObject <System.String>(dr["ContentStatusId"]);
            }
            if (DbTool.HasFields("IsBind", fields))
            {
                model.IsBind = DbTool.ConvertObject <System.Boolean>(dr["IsBind"]);
            }
            if (DbTool.HasFields("BindTime", fields))
            {
                model.BindTime = DbTool.ConvertObject <System.DateTime>(dr["BindTime"]);
            }
            if (DbTool.HasFields("UpdateOn", fields))
            {
                model.UpdateOn = DbTool.ConvertObject <System.DateTime>(dr["UpdateOn"]);
            }
            if (DbTool.HasFields("CreateOn", fields))
            {
                model.CreateOn = DbTool.ConvertObject <System.DateTime>(dr["CreateOn"]);
            }
            if (DbTool.HasFields("ApployInfoId", fields))
            {
                model.ApployInfoId = DbTool.ConvertObject <System.Int32>(dr["ApployInfoId"]);
            }

            return(model);
        }
Ejemplo n.º 4
0
 protected void BindDataReader(YHFramework.SysModel.BoxNumberModel model, SqlDataReader dr)
 {
     model.BoxNumberId     = DbTool.ConvertObject <System.Int32>(dr["BoxNumberId"]);
     model.BoxNumber       = DbTool.ConvertObject <System.String>(dr["BoxNumber"]);
     model.ShortBoxNumber  = DbTool.ConvertObject <System.String>(dr["ShortBoxNumber"]);
     model.IndexCode       = DbTool.ConvertObject <System.String>(dr["IndexCode"]);
     model.BatchNumber     = DbTool.ConvertObject <System.String>(dr["BatchNumber"]);
     model.ContentStatusId = DbTool.ConvertObject <System.String>(dr["ContentStatusId"]);
     model.IsBind          = DbTool.ConvertObject <System.Boolean>(dr["IsBind"]);
     model.BindTime        = DbTool.ConvertObject <System.DateTime>(dr["BindTime"]);
     model.UpdateOn        = DbTool.ConvertObject <System.DateTime>(dr["UpdateOn"]);
     model.CreateOn        = DbTool.ConvertObject <System.DateTime>(dr["CreateOn"]);
     model.ApployInfoId    = DbTool.ConvertObject <System.Int32>(dr["ApployInfoId"]);
 }
Ejemplo n.º 5
0
        public YHFramework.SysModel.BoxNumberModel GetModelByBoxNumber(string boxnumber)
        {
            string sql = "select top 1 * from BoxNumber where BoxNumber ='" + boxnumber.FixSql() + "'";

            YHFramework.SysModel.BoxNumberModel model = new YHFramework.SysModel.BoxNumberModel();
            SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql.ToString());

            if (dr.Read())
            {
                //var fields = DbTool.GetReaderFieldNames(dr);
                //model = AutoBindDataReader(dr, fields);
                BindDataReader(model, dr);
            }
            dr.Close();
            return(model);
        }
Ejemplo n.º 6
0
        public List <YHFramework.SysModel.BoxNumberModel> GetModelList()
        {
            List <YHFramework.SysModel.BoxNumberModel> result = new List <YHFramework.SysModel.BoxNumberModel>();
            string sql = "select * from BoxNumber where 1=1";

            YHFramework.SysModel.BoxNumberModel model = new YHFramework.SysModel.BoxNumberModel();
            SqlDataReader dr = SqlHelper.ExecuteReader(conn, CommandType.Text, sql.ToString());

            //var fields = DbTool.GetReaderFieldNames(dr);
            while (dr.Read())
            {
                //model = AutoBindDataReader(dr, fields);
                model = new YHFramework.SysModel.BoxNumberModel();
                BindDataReader(model, dr);
                result.Add(model);
            }
            dr.Close();
            return(result);
        }