示例#1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mofang.Model.OrderApply GetModel(int OrderApplyID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select OrderApplyID, CreatUserID, RecordUpdateUserID, RecordIsDelete, RecordUpdateTime, RecordCreateTime, MachineID, UserID, DepartmentId, InsureNum, Price, Respmsg, Respstat, Status  ");
            strSql.Append("  from dbo.[OrderApply] ");
            strSql.Append(" where OrderApplyID=@OrderApplyID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderApplyID", SqlDbType.Int, 4)
            };
            parameters[0].Value = OrderApplyID;


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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mofang.Model.OrderApply model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dbo.[OrderApply] set ");

            strSql.Append(" CreatUserID = @CreatUserID , ");
            strSql.Append(" RecordUpdateUserID = @RecordUpdateUserID , ");
            strSql.Append(" RecordIsDelete = @RecordIsDelete , ");
            strSql.Append(" RecordUpdateTime = @RecordUpdateTime , ");
            strSql.Append(" RecordCreateTime = @RecordCreateTime , ");
            strSql.Append(" MachineID = @MachineID , ");
            strSql.Append(" UserID = @UserID , ");
            strSql.Append(" DepartmentId = @DepartmentId , ");
            strSql.Append(" InsureNum = @InsureNum , ");
            strSql.Append(" Price = @Price , ");
            strSql.Append(" Respmsg = @Respmsg , ");
            strSql.Append(" Respstat = @Respstat , ");
            strSql.Append(" Status = @Status  ");
            strSql.Append(" where OrderApplyID=@OrderApplyID ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderApplyID",       model.OrderApplyID),
                new SqlParameter("@CreatUserID",        model.CreatUserID),
                new SqlParameter("@RecordUpdateUserID", model.RecordUpdateUserID),
                new SqlParameter("@RecordIsDelete",     model.RecordIsDelete),
                new SqlParameter("@RecordUpdateTime",   model.RecordUpdateTime),
                new SqlParameter("@RecordCreateTime",   model.RecordCreateTime),
                new SqlParameter("@MachineID",          model.MachineID),
                new SqlParameter("@UserID",             model.UserID),
                new SqlParameter("@DepartmentId",       model.DepartmentId),
                new SqlParameter("@InsureNum",          model.InsureNum),
                new SqlParameter("@Price",              model.Price),
                new SqlParameter("@Respmsg",            model.Respmsg),
                new SqlParameter("@Respstat",           model.Respstat),
                new SqlParameter("@Status",             model.Status)
            };

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Mofang.Model.OrderApply model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo.[OrderApply](");
            strSql.Append("CreatUserID,RecordUpdateUserID,RecordIsDelete,RecordUpdateTime,RecordCreateTime,MachineID,UserID,DepartmentId,InsureNum,Price,Respmsg,Respstat,Status");
            strSql.Append(") values (");
            strSql.Append("@CreatUserID,@RecordUpdateUserID,@RecordIsDelete,@RecordUpdateTime,@RecordCreateTime,@MachineID,@UserID,@DepartmentId,@InsureNum,@Price,@Respmsg,@Respstat,@Status");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CreatUserID",        model.CreatUserID),
                new SqlParameter("@RecordUpdateUserID", model.RecordUpdateUserID),
                new SqlParameter("@RecordIsDelete",     model.RecordIsDelete),
                new SqlParameter("@RecordUpdateTime",   model.RecordUpdateTime),
                new SqlParameter("@RecordCreateTime",   model.RecordCreateTime),
                new SqlParameter("@MachineID",          model.MachineID),
                new SqlParameter("@UserID",             model.UserID),
                new SqlParameter("@DepartmentId",       model.DepartmentId),
                new SqlParameter("@InsureNum",          model.InsureNum),
                new SqlParameter("@Price",              model.Price),
                new SqlParameter("@Respmsg",            model.Respmsg),
                new SqlParameter("@Respstat",           model.Respstat),
                new SqlParameter("@Status",             model.Status)
            };


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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
示例#4
0
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public Mofang.Model.OrderApply DataRowToModel(DataRow row)
        {
            Mofang.Model.OrderApply model = new Mofang.Model.OrderApply();

            if (row != null)
            {
                if (row["OrderApplyID"].ToString() != "")
                {
                    model.OrderApplyID = int.Parse(row["OrderApplyID"].ToString());
                }
                if (row["CreatUserID"].ToString() != "")
                {
                    model.CreatUserID = int.Parse(row["CreatUserID"].ToString());
                }
                if (row["RecordUpdateUserID"].ToString() != "")
                {
                    model.RecordUpdateUserID = int.Parse(row["RecordUpdateUserID"].ToString());
                }
                if (row["RecordIsDelete"].ToString() != "")
                {
                    if ((row["RecordIsDelete"].ToString() == "1") || (row["RecordIsDelete"].ToString().ToLower() == "true"))
                    {
                        model.RecordIsDelete = true;
                    }
                    else
                    {
                        model.RecordIsDelete = false;
                    }
                }
                if (row["RecordUpdateTime"].ToString() != "")
                {
                    model.RecordUpdateTime = DateTime.Parse(row["RecordUpdateTime"].ToString());
                }
                if (row["RecordCreateTime"].ToString() != "")
                {
                    model.RecordCreateTime = DateTime.Parse(row["RecordCreateTime"].ToString());
                }
                if (row["MachineID"].ToString() != "")
                {
                    model.MachineID = int.Parse(row["MachineID"].ToString());
                }
                if (row["UserID"].ToString() != "")
                {
                    model.UserID = int.Parse(row["UserID"].ToString());
                }
                if (row["DepartmentId"].ToString() != "")
                {
                    model.DepartmentId = int.Parse(row["DepartmentId"].ToString());
                }
                model.InsureNum = row["InsureNum"].ToString();
                model.Price     = row["Price"].ToString();
                model.Respmsg   = row["Respmsg"].ToString();
                model.Respstat  = row["Respstat"].ToString();
                if (row["Status"].ToString() != "")
                {
                    model.Status = int.Parse(row["Status"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mofang.Model.OrderApply model)
 {
     return(dal.Update(model));
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Mofang.Model.OrderApply model)
 {
     return(dal.Add(model));
 }