Ejemplo n.º 1
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            string Title1    = this.Title1.Value;
            string ReadUsers = Request.Form["ReadUsers"];
            string Contents  = Request.Form["Contents"];
            string Files     = Request.Form["Files"];
            string Source    = Request.Form["Source"];

            bool   isAdd  = false;
            string oldxml = string.Empty;

            if (doc == null)
            {
                doc               = new RoadFlow.Data.Model.Documents();
                isAdd             = true;
                doc.ID            = Guid.NewGuid();
                doc.ReadCount     = 0;
                doc.WriteTime     = RoadFlow.Utility.DateTimeNew.Now;
                doc.WriteUserID   = CurrentUserID;
                doc.WriteUserName = CurrentUserName;
            }
            else
            {
                oldxml           = doc.Serialize();
                doc.EditTime     = RoadFlow.Utility.DateTimeNew.Now;
                doc.EditUserID   = CurrentUserID;
                doc.EditUserName = CurrentUserName;
            }
            doc.Contents      = Contents;
            doc.DirectoryID   = DirID.ToGuid();
            doc.Source        = Source;
            doc.Files         = Files;
            doc.ReadUsers     = ReadUsers;
            doc.Title         = Title1.Trim1();
            doc.DirectoryName = DocDir.GetName(doc.DirectoryID);

            if (isAdd)
            {
                DOC.Add(doc);
                RoadFlow.Platform.Log.Add("添加了文档", doc.Serialize(), RoadFlow.Platform.Log.Types.文档中心);
            }
            else
            {
                DOC.Update(doc);
                RoadFlow.Platform.Log.Add("修改了文档", doc.Serialize(), RoadFlow.Platform.Log.Types.文档中心, oldxml, doc.Serialize());
            }

            //更新阅读人员
            var users = doc.ReadUsers.IsNullOrEmpty() ? DocDir.GetReadUsers(doc.DirectoryID) : new RoadFlow.Platform.Organize().GetAllUsers(doc.ReadUsers);

            DocReadUsers.Delete(doc.ID);
            bool isWeiXin = RoadFlow.Platform.WeiXin.Config.IsUse;

            RoadFlow.Platform.WeiXin.Message weiXinMsg = new RoadFlow.Platform.WeiXin.Message();
            System.Text.StringBuilder        wxUsers   = new System.Text.StringBuilder();
            foreach (var user in users)
            {
                RoadFlow.Data.Model.DocumentsReadUsers docReadUsers = new RoadFlow.Data.Model.DocumentsReadUsers();
                docReadUsers.DocumentID = doc.ID;
                docReadUsers.IsRead     = 0;
                docReadUsers.UserID     = user.ID;
                DocReadUsers.Add(docReadUsers);
                if (isWeiXin)
                {
                    wxUsers.Append(user.Account);
                    wxUsers.Append('|');
                }
            }
            if (isWeiXin)
            {
                weiXinMsg.SendText(doc.Title, wxUsers.ToString().TrimEnd('|'), agentid: new RoadFlow.Platform.WeiXin.Agents().GetAgentIDByCode("weixinagents_documents"), async: true);
            }
            string url = string.Empty;

            if (isAdd)
            {
                url = "'List.aspx" + Request.Url.Query + "'";
            }
            else
            {
                url = "'DocRead.aspx" + Request.Url.Query + "'";
            }

            Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');window.location=" + url + ";", true);
        }
Ejemplo n.º 2
0
        public ActionResult DocAdd(FormCollection collection)
        {
            string str1 = this.Request.QueryString["docid"];

            RoadFlow.Platform.Documents          documents          = new RoadFlow.Platform.Documents();
            RoadFlow.Platform.DocumentDirectory  documentDirectory  = new RoadFlow.Platform.DocumentDirectory();
            RoadFlow.Platform.DocumentsReadUsers documentsReadUsers = new RoadFlow.Platform.DocumentsReadUsers();
            RoadFlow.Data.Model.Documents        model = (RoadFlow.Data.Model.Documents)null;
            if (str1.IsGuid())
            {
                model = documents.Get(str1.ToGuid());
            }
            if (collection != null)
            {
                string str2   = this.Request.Form["DirectoryID"];
                string str3   = this.Request.Form["Title1"];
                string str4   = this.Request.Form["ReadUsers"];
                string str5   = this.Request.Form["Source"];
                string str6   = this.Request.Form["Contents"];
                string str7   = this.Request.Form["Files"];
                string oldXML = string.Empty;
                bool   flag   = false;
                if (model == null)
                {
                    flag                = true;
                    model               = new RoadFlow.Data.Model.Documents();
                    model.ID            = Guid.NewGuid();
                    model.ReadCount     = 0;
                    model.WriteTime     = DateTimeNew.Now;
                    model.WriteUserID   = RoadFlow.Platform.Users.CurrentUserID;
                    model.WriteUserName = RoadFlow.Platform.Users.CurrentUserName;
                }
                else
                {
                    oldXML = model.Serialize();
                }
                model.Contents      = str6;
                model.DirectoryID   = str2.ToGuid();
                model.DirectoryName = documentDirectory.GetName(model.DirectoryID);
                model.EditTime      = new DateTime?(DateTimeNew.Now);
                model.EditUserID    = new Guid?(RoadFlow.Platform.Users.CurrentUserID);
                model.EditUserName  = RoadFlow.Platform.Users.CurrentUserName;
                model.Files         = str7;
                model.ReadUsers     = str4;
                model.Source        = str5.IsNullOrEmpty() ? " " : str5;
                model.Title         = str3.Trim1();
                if (flag)
                {
                    documents.Add(model);
                    RoadFlow.Platform.Log.Add("添加了文档", model.Serialize(), RoadFlow.Platform.Log.Types.文档中心, "", "", (RoadFlow.Data.Model.Users)null);
                }
                else
                {
                    documents.Update(model);
                    RoadFlow.Platform.Log.Add("修改了文档", model.Serialize(), RoadFlow.Platform.Log.Types.文档中心, oldXML, model.Serialize(), (RoadFlow.Data.Model.Users)null);
                }
                List <RoadFlow.Data.Model.Users> usersList = model.ReadUsers.IsNullOrEmpty() ? documentDirectory.GetReadUsers(model.DirectoryID) : new RoadFlow.Platform.Organize().GetAllUsers(model.ReadUsers);
                documentsReadUsers.Delete(model.ID);
                bool          isUse         = RoadFlow.Platform.WeiXin.Config.IsUse;
                Message       message       = new Message();
                StringBuilder stringBuilder = new StringBuilder();
                foreach (RoadFlow.Data.Model.Users users in usersList)
                {
                    documentsReadUsers.Add(new RoadFlow.Data.Model.DocumentsReadUsers()
                    {
                        DocumentID = model.ID,
                        IsRead     = 0,
                        UserID     = users.ID
                    });
                    if (isUse)
                    {
                        stringBuilder.Append(users.Account);
                        stringBuilder.Append('|');
                    }
                }
                string empty = string.Empty;
                string str8  = !flag ? "'DocRead" + this.Request.Url.Query + "'" : "'List" + this.Request.Url.Query + "'";
                if (isUse)
                {
                    message.SendText(model.Title, stringBuilder.ToString().TrimEnd('|'), "", "", 0, new Agents().GetAgentIDByCode("weixinagents_documents"), true);
                }
                // ISSUE: reference to a compiler-generated field
                if (DocumentsController.\u003C\u003Eo__5.\u003C\u003Ep__0 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    DocumentsController.\u003C\u003Eo__5.\u003C\u003Ep__0 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "script", typeof(DocumentsController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                    {
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                    }));
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                object obj = DocumentsController.\u003C\u003Eo__5.\u003C\u003Ep__0.Target((CallSite)DocumentsController.\u003C\u003Eo__5.\u003C\u003Ep__0, this.ViewBag, "alert('保存成功!');window.location=" + str8 + ";");
            }
            if (model == null)
            {
                model = new RoadFlow.Data.Model.Documents();
            }
            return((ActionResult)this.View((object)model));
        }