예제 #1
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model">Data.Model.WorkFlowComment实体类</param>
        public int Update(Data.Model.WorkFlowComment model)
        {
            string sql = @"UPDATE WorkFlowComment SET 
				MemberID=@MemberID,Comment=@Comment,Type=@Type,Sort=@Sort
				WHERE ID=@ID"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@MemberID", SqlDbType.VarChar, -1)
                {
                    Value = model.MemberID
                },
                new SqlParameter("@Comment", SqlDbType.NVarChar, 1000)
                {
                    Value = model.Comment
                },
                new SqlParameter("@Type", SqlDbType.Int, -1)
                {
                    Value = model.Type
                },
                new SqlParameter("@Sort", SqlDbType.Int, -1)
                {
                    Value = model.Sort
                },
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
예제 #2
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model">Data.Model.WorkFlowComment实体类</param>
        /// <returns>操作所影响的行数</returns>
        public int Add(Data.Model.WorkFlowComment model)
        {
            string sql = @"INSERT INTO WorkFlowComment
				(ID,MemberID,Comment,Type,Sort) 
				VALUES(@ID,@MemberID,@Comment,@Type,@Sort)"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                },
                new SqlParameter("@MemberID", SqlDbType.VarChar, -1)
                {
                    Value = model.MemberID
                },
                new SqlParameter("@Comment", SqlDbType.NVarChar, 1000)
                {
                    Value = model.Comment
                },
                new SqlParameter("@Type", SqlDbType.Int, -1)
                {
                    Value = model.Type
                },
                new SqlParameter("@Sort", SqlDbType.Int, -1)
                {
                    Value = model.Sort
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
        public ActionResult Edit(FormCollection collection)
        {
            Business.Platform.WorkFlowComment bworkFlowComment = new Business.Platform.WorkFlowComment();
            Data.Model.WorkFlowComment        workFlowComment  = null;
            string id = Request.QueryString["id"];

            string member  = string.Empty;
            string comment = string.Empty;
            string sort    = string.Empty;

            bool isOneSelf = "1" == Request.QueryString["isoneself"];

            Guid commentID;

            if (id.IsGuid(out commentID))
            {
                workFlowComment = bworkFlowComment.Get(commentID);
                member          = workFlowComment.MemberID;
                comment         = workFlowComment.Comment;
                sort            = workFlowComment.Sort.ToString();
            }
            string oldXML = workFlowComment.Serialize();

            if (collection != null)
            {
                member  = isOneSelf ? Business.Platform.Users.PREFIX + Business.Platform.Users.CurrentUserID.ToString() : Request.Form["Member"];
                comment = Request.Form["Comment"];
                sort    = Request.Form["Sort"];

                bool isAdd = !id.IsGuid();
                if (workFlowComment == null)
                {
                    workFlowComment      = new Data.Model.WorkFlowComment();
                    workFlowComment.ID   = Guid.NewGuid();
                    workFlowComment.Type = isOneSelf ? 1 : 0;
                }

                workFlowComment.MemberID = member.IsNullOrEmpty() ? "" : member.Trim();
                workFlowComment.Comment  = comment.IsNullOrEmpty() ? "" : comment.Trim();
                workFlowComment.Sort     = sort.IsInt() ? sort.ToInt() : bworkFlowComment.GetManagerMaxSort();


                if (isAdd)
                {
                    bworkFlowComment.Add(workFlowComment);
                    Business.Platform.Log.Add("添加了流程意见", workFlowComment.Serialize(), Business.Platform.Log.Types.流程相关);
                }
                else
                {
                    bworkFlowComment.Update(workFlowComment);
                    Business.Platform.Log.Add("修改了流程意见", "", Business.Platform.Log.Types.流程相关, oldXML, workFlowComment.Serialize());
                }
                bworkFlowComment.RefreshCache();
                ViewBag.Script = "new RoadUI.Window().reloadOpener();alert('保存成功!');";
            }
            return(View(workFlowComment == null ? new Data.Model.WorkFlowComment() : workFlowComment));
        }
예제 #4
0
        /// <summary>
        /// 将DataRedar转换为List
        /// </summary>
        private List <Data.Model.WorkFlowComment> DataReaderToList(SqlDataReader dataReader)
        {
            List <Data.Model.WorkFlowComment> List = new List <Data.Model.WorkFlowComment>();

            Data.Model.WorkFlowComment model = null;
            while (dataReader.Read())
            {
                model          = new Data.Model.WorkFlowComment();
                model.ID       = dataReader.GetGuid(0);
                model.MemberID = dataReader.GetString(1);
                model.Comment  = dataReader.GetString(2);
                model.Type     = dataReader.GetInt32(3);
                model.Sort     = dataReader.GetInt32(4);
                List.Add(model);
            }
            return(List);
        }
예제 #5
0
 /// <summary>
 /// 更新
 /// </summary>
 public int Update(Data.Model.WorkFlowComment model)
 {
     return(dataWorkFlowComment.Update(model));
 }
예제 #6
0
 /// <summary>
 /// 新增
 /// </summary>
 public int Add(Data.Model.WorkFlowComment model)
 {
     return(dataWorkFlowComment.Add(model));
 }