Example #1
0
        /// <summary>
        /// 将DataRedar转换为List
        /// </summary>
        private List <FoWoSoft.Data.Model.WorkFlowDelegation> DataReaderToList(SqlDataReader dataReader)
        {
            List <FoWoSoft.Data.Model.WorkFlowDelegation> List = new List <FoWoSoft.Data.Model.WorkFlowDelegation>();

            FoWoSoft.Data.Model.WorkFlowDelegation model = null;
            while (dataReader.Read())
            {
                model           = new FoWoSoft.Data.Model.WorkFlowDelegation();
                model.ID        = dataReader.GetGuid(0);
                model.UserID    = dataReader.GetGuid(1);
                model.StartTime = dataReader.GetDateTime(2);
                model.EndTime   = dataReader.GetDateTime(3);
                if (!dataReader.IsDBNull(4))
                {
                    model.FlowID = dataReader.GetGuid(4);
                }
                model.ToUserID  = dataReader.GetGuid(5);
                model.WriteTime = dataReader.GetDateTime(6);
                if (!dataReader.IsDBNull(7))
                {
                    model.Note = dataReader.GetString(7);
                }
                List.Add(model);
            }
            return(List);
        }
Example #2
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="model">FoWoSoft.Data.Model.WorkFlowDelegation实体类</param>
        public int Update(FoWoSoft.Data.Model.WorkFlowDelegation model)
        {
            string sql = @"UPDATE WorkFlowDelegation SET 
				UserID=@UserID,StartTime=@StartTime,EndTime=@EndTime,FlowID=@FlowID,ToUserID=@ToUserID,WriteTime=@WriteTime,Note=@Note
				WHERE ID=@ID"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@UserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.UserID
                },
                new SqlParameter("@StartTime", SqlDbType.DateTime, 8)
                {
                    Value = model.StartTime
                },
                new SqlParameter("@EndTime", SqlDbType.DateTime, 8)
                {
                    Value = model.EndTime
                },
                model.FlowID == null ? new SqlParameter("@FlowID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@FlowID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.FlowID
                },
                new SqlParameter("@ToUserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ToUserID
                },
                new SqlParameter("@WriteTime", SqlDbType.DateTime, 8)
                {
                    Value = model.WriteTime
                },
                model.Note == null ? new SqlParameter("@Note", SqlDbType.NVarChar, 8000)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Note", SqlDbType.NVarChar, 8000)
                {
                    Value = model.Note
                },
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Example #3
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model">FoWoSoft.Data.Model.WorkFlowDelegation实体类</param>
        /// <returns>操作所影响的行数</returns>
        public int Add(FoWoSoft.Data.Model.WorkFlowDelegation model)
        {
            string sql = @"INSERT INTO WorkFlowDelegation
				(ID,UserID,StartTime,EndTime,FlowID,ToUserID,WriteTime,Note) 
				VALUES(@ID,@UserID,@StartTime,@EndTime,@FlowID,@ToUserID,@WriteTime,@Note)"                ;

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@ID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ID
                },
                new SqlParameter("@UserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.UserID
                },
                new SqlParameter("@StartTime", SqlDbType.DateTime, 8)
                {
                    Value = model.StartTime
                },
                new SqlParameter("@EndTime", SqlDbType.DateTime, 8)
                {
                    Value = model.EndTime
                },
                model.FlowID == null ? new SqlParameter("@FlowID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@FlowID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.FlowID
                },
                new SqlParameter("@ToUserID", SqlDbType.UniqueIdentifier, -1)
                {
                    Value = model.ToUserID
                },
                new SqlParameter("@WriteTime", SqlDbType.DateTime, 8)
                {
                    Value = model.WriteTime
                },
                model.Note == null ? new SqlParameter("@Note", SqlDbType.NVarChar, 8000)
                {
                    Value = DBNull.Value
                } : new SqlParameter("@Note", SqlDbType.NVarChar, 8000)
                {
                    Value = model.Note
                }
            };
            return(dbHelper.Execute(sql, parameters));
        }
Example #4
0
 /// <summary>
 /// 更新
 /// </summary>
 public int Update(FoWoSoft.Data.Model.WorkFlowDelegation model)
 {
     return(dataWorkFlowDelegation.Update(model));
 }
Example #5
0
 /// <summary>
 /// 新增
 /// </summary>
 public int Add(FoWoSoft.Data.Model.WorkFlowDelegation model)
 {
     return(dataWorkFlowDelegation.Add(model));
 }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];

            string UserID    = string.Empty;
            string ToUserID  = string.Empty;
            string StartTime = string.Empty;
            string EndTime   = string.Empty;
            string FlowID    = string.Empty;
            string Note      = string.Empty;

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

            Guid delegationID;

            if (id.IsGuid(out delegationID))
            {
                workFlowDelegation = bworkFlowDelegation.Get(delegationID);
                if (workFlowDelegation != null)
                {
                    FlowID = workFlowDelegation.FlowID.ToString();
                }
            }
            string oldXML = workFlowDelegation.Serialize();

            if (IsPostBack)
            {
                UserID    = Request.Form["UserID"];
                ToUserID  = Request.Form["ToUserID"];
                StartTime = Request.Form["StartTime"];
                EndTime   = Request.Form["EndTime"];
                FlowID    = Request.Form["FlowID"];
                Note      = Request.Form["Note"];

                bool isAdd = !id.IsGuid();
                if (workFlowDelegation == null)
                {
                    workFlowDelegation    = new FoWoSoft.Data.Model.WorkFlowDelegation();
                    workFlowDelegation.ID = Guid.NewGuid();
                }
                workFlowDelegation.UserID  = isOneSelf ? FoWoSoft.Platform.Users.CurrentUserID : FoWoSoft.Platform.Users.RemovePrefix(UserID).ToGuid();
                workFlowDelegation.EndTime = EndTime.ToDateTime();
                if (FlowID.IsGuid())
                {
                    workFlowDelegation.FlowID = FlowID.ToGuid();
                }
                workFlowDelegation.Note      = Note.IsNullOrEmpty() ? null : Note;
                workFlowDelegation.StartTime = StartTime.ToDateTime();
                workFlowDelegation.ToUserID  = FoWoSoft.Platform.Users.RemovePrefix(ToUserID).ToGuid();
                workFlowDelegation.WriteTime = FoWoSoft.Utility.DateTimeNew.Now;

                if (isAdd)
                {
                    bworkFlowDelegation.Add(workFlowDelegation);
                    FoWoSoft.Platform.Log.Add("添加了工作委托", workFlowDelegation.Serialize(), FoWoSoft.Platform.Log.Types.流程相关);
                }
                else
                {
                    bworkFlowDelegation.Update(workFlowDelegation);
                    FoWoSoft.Platform.Log.Add("修改了工作委托", "", FoWoSoft.Platform.Log.Types.流程相关, oldXML, workFlowDelegation.Serialize());
                }
                bworkFlowDelegation.RefreshCache();
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
            }
            FlowOptions = new FoWoSoft.Platform.WorkFlow().GetOptions(FlowID);
            if (workFlowDelegation == null)
            {
                workFlowDelegation = new FoWoSoft.Data.Model.WorkFlowDelegation();
            }
        }