Ejemplo n.º 1
0
        public Model_BookAudit DataRowToModel(DataRow row)
        {
            Model_BookAudit audit = new Model_BookAudit();

            if (row != null)
            {
                if (row["ResourceFolder_Id"] != null)
                {
                    audit.ResourceFolder_Id = row["ResourceFolder_Id"].ToString();
                }
                if (row["Book_Name"] != null)
                {
                    audit.Book_Name = row["Book_Name"].ToString();
                }
                if (row["AuditState"] != null)
                {
                    audit.AuditState = row["AuditState"].ToString();
                }
                if (row["AuditRemark"] != null)
                {
                    audit.AuditRemark = row["AuditRemark"].ToString();
                }
                if (row["CreateUser"] != null)
                {
                    audit.CreateUser = row["CreateUser"].ToString();
                }
                if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != ""))
                {
                    audit.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString()));
                }
            }
            return(audit);
        }
Ejemplo n.º 2
0
        public bool Add(Model_BookAudit model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into BookAudit(");
            builder.Append("ResourceFolder_Id,Book_Name,AuditState,AuditRemark,CreateUser,CreateTime)");
            builder.Append(" values (");
            builder.Append("@ResourceFolder_Id,@Book_Name,@AuditState,@AuditRemark,@CreateUser,@CreateTime)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ResourceFolder_Id", SqlDbType.Char, 0x24), new SqlParameter("@Book_Name", SqlDbType.NVarChar, 100), new SqlParameter("@AuditState", SqlDbType.Char, 1), new SqlParameter("@AuditRemark", SqlDbType.NVarChar, 500), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime) };
            cmdParms[0].Value = model.ResourceFolder_Id;
            cmdParms[1].Value = model.Book_Name;
            cmdParms[2].Value = model.AuditState;
            cmdParms[3].Value = model.AuditRemark;
            cmdParms[4].Value = model.CreateUser;
            cmdParms[5].Value = model.CreateTime;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 3
0
        public List <Model_BookAudit> DataTableToList(DataTable dt)
        {
            List <Model_BookAudit> list = new List <Model_BookAudit>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_BookAudit item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 4
0
        public bool Update(Model_BookAudit model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update BookAudit set ");
            builder.Append("Book_Name=@Book_Name,");
            builder.Append("AuditState=@AuditState,");
            builder.Append("AuditRemark=@AuditRemark,");
            builder.Append("CreateUser=@CreateUser,");
            builder.Append("CreateTime=@CreateTime");
            builder.Append(" where ResourceFolder_Id=@ResourceFolder_Id ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@Book_Name", SqlDbType.NVarChar, 100), new SqlParameter("@AuditState", SqlDbType.Char, 1), new SqlParameter("@AuditRemark", SqlDbType.NVarChar, 500), new SqlParameter("@CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@ResourceFolder_Id", SqlDbType.Char, 0x24) };
            cmdParms[0].Value = model.Book_Name;
            cmdParms[1].Value = model.AuditState;
            cmdParms[2].Value = model.AuditRemark;
            cmdParms[3].Value = model.CreateUser;
            cmdParms[4].Value = model.CreateTime;
            cmdParms[5].Value = model.ResourceFolder_Id;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Ejemplo n.º 5
0
        public static string BookAudit(string reid, string rename, string type)
        {
            try
            {
                Model_VSysUserRole loginUser = HttpContext.Current.Session["LoginUser"] as Model_VSysUserRole;
                reid = reid.Filter();
                type = type.Filter();
                Model_BookAudit model   = new Model_BookAudit();
                BLL_BookAudit   bll     = new BLL_BookAudit();
                Model_SyncData  modelSD = new Model_SyncData();
                model = bll.GetModel(reid);
                if (model == null)
                {
                    model = new Model_BookAudit();

                    if (type == "1")
                    {
                        model.AuditState        = "1";
                        model.ResourceFolder_Id = reid;
                        model.Book_Name         = rename;
                        model.CreateTime        = DateTime.Now;
                        model.CreateUser        = loginUser.SysUser_ID;
                        #region 审核通过,记录同步数据
                        modelSD.SyncDataId  = Guid.NewGuid().ToString();
                        modelSD.TableName   = "BookAudit";
                        modelSD.DataId      = reid;
                        modelSD.OperateType = "bookaudit";
                        modelSD.CreateTime  = DateTime.Now;
                        modelSD.SyncStatus  = "0";
                        #endregion
                    }
                    else
                    {
                        model.AuditState        = "0";
                        model.ResourceFolder_Id = reid;
                        model.Book_Name         = rename;
                        model.CreateTime        = DateTime.Now;
                        model.CreateUser        = loginUser.SysUser_ID;
                    }
                    if (bll.Add(model))
                    {
                        if (modelSD.SyncDataId != null)
                        {
                            new BLL_SyncData().Add(modelSD);
                        }
                        return("1");
                    }
                    else
                    {
                        return("2");
                    }
                }
                else
                {
                    if (type == "1")
                    {
                        model            = bll.GetModel(reid);
                        model.AuditState = "1";
                        model.CreateTime = DateTime.Now;
                        model.CreateUser = loginUser.SysUser_ID;
                        #region 审核通过,记录同步数据
                        modelSD.SyncDataId  = Guid.NewGuid().ToString();
                        modelSD.TableName   = "BookAudit";
                        modelSD.DataId      = reid;
                        modelSD.OperateType = "bookaudit";
                        modelSD.CreateTime  = DateTime.Now;
                        modelSD.SyncStatus  = "0";
                        #endregion
                    }
                    else
                    {
                        model            = bll.GetModel(reid);
                        model.AuditState = "0";
                        model.CreateTime = DateTime.Now;
                        model.CreateUser = loginUser.SysUser_ID;
                    }
                    if (bll.Update(model))
                    {
                        if (modelSD.SyncDataId != null)
                        {
                            new BLL_SyncData().Add(modelSD);
                        }
                        return("1");
                    }
                    else
                    {
                        return("2");
                    }
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
Ejemplo n.º 6
0
 public bool Add(Model_BookAudit model)
 {
     return(this.dal.Add(model));
 }
Ejemplo n.º 7
0
 public bool Update(Model_BookAudit model)
 {
     return(this.dal.Update(model));
 }