Exemple #1
0
        private void Save()
        {
            try
            {
                if (archives.ARCHIVESTITLE == null || string.IsNullOrEmpty(archives.ARCHIVESTITLE.Trim()))
                {
                    //HtmlPage.Window.Alert("档案标题不能为空!");
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "ARCHIVESTITLE"));
                    //this.txtTitle.Focus();
                    return;
                }
                if (txtContent.GetRichTextbox().Xaml == "") //if (archives.CONTENT == null || txtContent.GetRichTextbox().Xaml == "")
                {
                    //HtmlPage.Window.Alert("档案内容不能为空!");
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "ARCHIVESCONTENT"));
                    //this.txtContent.Focus();
                    return;
                }

                //archives.ARCHIVESTITLE = txtTitle.Text.Trim();
                //Items cbxItems = this.comboxType.SelectedItem as Items;
                archives.RECORDTYPE = Utility.GetCbxSelectItemText(comboxType);
                //archives.CONTENT = txtContent.Text.Trim();
                archives.SOURCEFLAG = "1";
                archives.CONTENT    = txtContent.RichTextBoxContext;
                RefreshUI(RefreshedTypes.ProgressBar);
                if (actions == Action.Add) //新增操作
                {
                    //应考虑新增时先点保存再点保存并关闭的情况 此时还是执行新增操作

                    archives.ARCHIVESID         = System.Guid.NewGuid().ToString();
                    archives.COMPANYID          = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    archives.CREATEUSERID       = Common.CurrentLoginUserInfo.EmployeeID;
                    archives.CREATEUSERNAME     = Common.CurrentLoginUserInfo.EmployeeName;
                    archives.CREATEPOSTID       = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    archives.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    archives.CREATECOMPANYID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    archives.OWNERID            = Common.CurrentLoginUserInfo.EmployeeID;
                    archives.OWNERNAME          = Common.CurrentLoginUserInfo.EmployeeName;
                    archives.OWNERPOSTID        = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    archives.OWNERDEPARTMENTID  = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    archives.OWNERCOMPANYID     = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    archives.CREATEDATE         = DateTime.Now;
                    client.AddArchivesAsync(archives);
                }
                else                       //更新操作
                {
                    archives.UPDATEDATE     = DateTime.Now;
                    archives.UPDATEUSERID   = Common.CurrentLoginUserInfo.EmployeeID;
                    archives.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;
                    client.UpdateArchivesAsync(archives);
                }
            }
            catch (Exception ex)
            {
                //HtmlPage.Window.Alert(ex.ToString());
                RefreshUI(RefreshedTypes.ProgressBar);
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.ToString());
            }
        }
        private void DocTORecordBtn_Click(object sender, RoutedEventArgs e)
        {
            if (Companysenddoc != null)
            {
                try
                {
                    SmtOADocumentAdminClient ArchivesClient = new SmtOADocumentAdminClient();
                    T_OA_ARCHIVES ArchiveT = new T_OA_ARCHIVES();
                    ArchiveT.ARCHIVESID = System.Guid.NewGuid().ToString();
                    ArchiveT.ARCHIVESTITLE = Companysenddoc.OACompanySendDoc.SENDDOCTITLE;
                    ArchiveT.COMPANYID = Companysenddoc.OACompanySendDoc.CREATECOMPANYID;
                    ArchiveT.CONTENT = Companysenddoc.OACompanySendDoc.CONTENT;
                    ArchiveT.CREATEDATE = System.DateTime.Now;

                    ArchiveT.RECORDTYPE = "SENDDOC";
                    ArchiveT.SOURCEFLAG = "0"; //自动导入

                    
                    ArchiveT.CREATECOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    ArchiveT.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    ArchiveT.CREATEPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                    ArchiveT.CREATEUSERID = Common.CurrentLoginUserInfo.EmployeeID;
                    ArchiveT.CREATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;

                    ArchiveT.OWNERCOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                    ArchiveT.OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                    ArchiveT.OWNERID = Common.CurrentLoginUserInfo.EmployeeID;
                    ArchiveT.OWNERNAME = Common.CurrentLoginUserInfo.EmployeeName;
                    ArchiveT.OWNERPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID;

                    ArchiveT.UPDATEDATE = null;
                    ArchiveT.UPDATEUSERID = "";
                    ArchiveT.UPDATEUSERNAME = "";

                    T_OA_SENDDOC SendDocT = new T_OA_SENDDOC();
                    SendDocT = Companysenddoc.OACompanySendDoc;
                    SendDocT.UPDATEDATE = System.DateTime.Now;
                    //SendDocT.UPDATEUSERID = "1";
                    SendDocT.UPDATEUSERID = Common.CurrentLoginUserInfo.EmployeeID;
                    SendDocT.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;
                    SendDocT.ISSAVE = "1";
                    
                    tmpSendDoc = SendDocT;
                    tmpSendDoc.T_OA_SENDDOCTYPE = Companysenddoc.doctype;

                    ArchivesClient.AddArchivesCompleted += new EventHandler<AddArchivesCompletedEventArgs>(ArchivesClient_AddArchivesCompleted);
                    ArchivesClient.AddArchivesAsync(ArchiveT);

                    //SendDocClient.SendDocBatchDelAsync(DelInfosList);

                }
                catch (Exception ex)
                {
                    //com.SelectionBox(Utility.GetResourceStr("DELETECONFIRM"), Utility.GetResourceStr("DELETEALTER"), SMT.SaaS.FrameworkUI.ChildWidow.ComfirmWindow.titlename, Result);
                }
            }
            else
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "COMPANYDOC"), Utility.GetResourceStr("CONFIRMBUTTON"));              
            }    
        }