コード例 #1
0
ファイル: xbwn_TaskDAL.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XBWN.Model.xbwn_Task GetModel(int AutoId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select AutoId, IsDeleted, CreateId, CreateDate, EditId, EditDate, NetLoanApplyId, TelNo, ServicePwd, TaskId, State, TaskStatus, ImgStr, Mark  ");
            strSql.Append("  from dbo.[xbwn_Task] ");
            strSql.Append(" where AutoId=@AutoId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AutoId", SqlDbType.Int, 4)
            };
            parameters[0].Value = AutoId;


            XBWN.Model.xbwn_Task model = new XBWN.Model.xbwn_Task();
            DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: xbwn_TaskDAL.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public XBWN.Model.xbwn_Task DataRowToModel(DataRow row)
        {
            XBWN.Model.xbwn_Task model = new XBWN.Model.xbwn_Task();

            if (row != null)
            {
                if (row["AutoId"].ToString() != "")
                {
                    model.AutoId = int.Parse(row["AutoId"].ToString());
                }
                if (row["IsDeleted"].ToString() != "")
                {
                    model.IsDeleted = int.Parse(row["IsDeleted"].ToString());
                }
                if (row["CreateId"].ToString() != "")
                {
                    model.CreateId = int.Parse(row["CreateId"].ToString());
                }
                if (row["CreateDate"].ToString() != "")
                {
                    model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
                }
                if (row["EditId"].ToString() != "")
                {
                    model.EditId = int.Parse(row["EditId"].ToString());
                }
                if (row["EditDate"].ToString() != "")
                {
                    model.EditDate = DateTime.Parse(row["EditDate"].ToString());
                }
                if (row["NetLoanApplyId"].ToString() != "")
                {
                    model.NetLoanApplyId = int.Parse(row["NetLoanApplyId"].ToString());
                }
                model.TelNo      = row["TelNo"].ToString();
                model.ServicePwd = row["ServicePwd"].ToString();
                model.TaskId     = row["TaskId"].ToString();
                model.State      = row["State"].ToString();
                model.TaskStatus = row["TaskStatus"].ToString();
                model.ImgStr     = row["ImgStr"].ToString();
                if (row["Mark"].ToString() != "")
                {
                    if ((row["Mark"].ToString() == "1") || (row["Mark"].ToString().ToLower() == "true"))
                    {
                        model.Mark = true;
                    }
                    else
                    {
                        model.Mark = false;
                    }
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
ファイル: xbwn_TaskDAL.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XBWN.Model.xbwn_Task model)
        {
            StringBuilder strSql = new StringBuilder();

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

            strSql.Append(" IsDeleted = @IsDeleted , ");
            strSql.Append(" CreateId = @CreateId , ");
            strSql.Append(" CreateDate = @CreateDate , ");
            strSql.Append(" EditId = @EditId , ");
            strSql.Append(" EditDate = @EditDate , ");
            strSql.Append(" NetLoanApplyId = @NetLoanApplyId , ");
            strSql.Append(" TelNo = @TelNo , ");
            strSql.Append(" ServicePwd = @ServicePwd , ");
            strSql.Append(" TaskId = @TaskId , ");
            strSql.Append(" State = @State , ");
            strSql.Append(" TaskStatus = @TaskStatus , ");
            strSql.Append(" ImgStr = @ImgStr , ");
            strSql.Append(" Mark = @Mark  ");
            strSql.Append(" where AutoId=@AutoId ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@AutoId",         model.AutoId),
                new SqlParameter("@IsDeleted",      model.IsDeleted),
                new SqlParameter("@CreateId",       model.CreateId),
                new SqlParameter("@CreateDate",     model.CreateDate),
                new SqlParameter("@EditId",         model.EditId),
                new SqlParameter("@EditDate",       model.EditDate),
                new SqlParameter("@NetLoanApplyId", model.NetLoanApplyId),
                new SqlParameter("@TelNo",          model.TelNo),
                new SqlParameter("@ServicePwd",     model.ServicePwd),
                new SqlParameter("@TaskId",         model.TaskId),
                new SqlParameter("@State",          model.State),
                new SqlParameter("@TaskStatus",     model.TaskStatus),
                new SqlParameter("@ImgStr",         model.ImgStr),
                new SqlParameter("@Mark",           model.Mark)
            };

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
ファイル: xbwn_TaskDAL.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(XBWN.Model.xbwn_Task model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo.[xbwn_Task](");
            strSql.Append("IsDeleted,CreateId,CreateDate,EditId,EditDate,NetLoanApplyId,TelNo,ServicePwd,TaskId,State,TaskStatus,ImgStr,Mark");
            strSql.Append(") values (");
            strSql.Append("@IsDeleted,@CreateId,@CreateDate,@EditId,@EditDate,@NetLoanApplyId,@TelNo,@ServicePwd,@TaskId,@State,@TaskStatus,@ImgStr,@Mark");
            strSql.Append(") ");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@IsDeleted",      model.IsDeleted),
                new SqlParameter("@CreateId",       model.CreateId),
                new SqlParameter("@CreateDate",     model.CreateDate),
                new SqlParameter("@EditId",         model.EditId),
                new SqlParameter("@EditDate",       model.EditDate),
                new SqlParameter("@NetLoanApplyId", model.NetLoanApplyId),
                new SqlParameter("@TelNo",          model.TelNo),
                new SqlParameter("@ServicePwd",     model.ServicePwd),
                new SqlParameter("@TaskId",         model.TaskId),
                new SqlParameter("@State",          model.State),
                new SqlParameter("@TaskStatus",     model.TaskStatus),
                new SqlParameter("@ImgStr",         model.ImgStr),
                new SqlParameter("@Mark",           model.Mark)
            };


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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(XBWN.Model.xbwn_Task model)
 {
     return(dal.Update(model));
 }
コード例 #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(XBWN.Model.xbwn_Task model)
 {
     return(dal.Add(model));
 }