private string GetCYNames(EntityLetterSend entity)
        {
            string chuanYueIDs = "";

            if (entity.ccLeaderIDs != "")
            {
                chuanYueIDs += entity.ccLeaderIDs + ";";
            }
            if (entity.deptLeaderIDs != "") //旧版才有
            {
                chuanYueIDs += entity.deptLeaderIDs + ";";
            }
            if (entity.DrafterID != "") // 发起人
            {
                chuanYueIDs += entity.DrafterID + ";";
            }
            if (entity.wfHeGaoRenID != "") //核稿人
            {
                chuanYueIDs += entity.wfHeGaoRenID + ";";
            }
            if (entity.wfHuiQianRenIDs != "") //会签人
            {
                chuanYueIDs += entity.wfHuiQianRenIDs + ";";
            }
            if (entity.wfQianFaRenID != "") //签发人
            {
                chuanYueIDs += entity.wfQianFaRenID + ";";
            }

            return(chuanYueIDs);
        }
 private void EntityToHuiQian(EntityLetterSend entity)
 {
     if (entity.huiQian.Count > 0)//新版从list里取
     {
         string shuiqian = "";
         if (entity.huiQian.Count > 0)
         {
             for (int i = 0; i < entity.huiQian.Count; i++)
             {
                 if (entity.huiQian[i].ICount == entity.iHuiQianCount)
                 {
                     shuiqian += ";" + entity.huiQian[i].UserName + " " + entity.huiQian[i].Date.ToString(DateFormat);
                 }
             }
             if (shuiqian.Length > 0)
             {
                 shuiqian = shuiqian.Substring(1);
             }
         }
         this.txtHuiQianRenDates.Text = shuiqian;
     }
     else
     {            //兼容旧版
         if (entity.huiqianDates != "")
         {
             this.txtHuiQianRenDates.Text = entity.huiqianDates;
         }
     }
 }
 private string EntityToHuiQian(EntityLetterSend entity)
 {
     if (entity.huiQian.Count > 0)//新版从list里取
     {
         string shuiqian = "";
         if (entity.huiQian.Count > 0)
         {
             for (int i = 0; i < entity.huiQian.Count; i++)
             {
                 if (entity.huiQian[i].ICount == entity.iHuiQianCount)
                 {
                     shuiqian += ";" + entity.huiQian[i].UserName + " " + entity.huiQian[i].Date.ToString(DateFormat);
                 }
             }
             if (shuiqian.Length > 0)
             {
                 shuiqian = shuiqian.Substring(1);
             }
         }
         return(shuiqian);
     }
     else
     {            //兼容旧版
         if (entity.huiqianDates != "")
         {
             return(entity.huiqianDates);
         }
     }
     return("");
 }
 public void SetPrintAttachExport(UC_Print ucPrint, EntityLetterSend cEntity)
 {
     switch (ucPrint.FileName)
     {
         case "函件发文表单":
             //ucPrint.WriteContent("拟稿/日期:", WriteMode.Up, 1);
             //ucPrint.WriteAttach();
             break;
     }
 }
 public void SetPrintAttachExport(UC_Print ucPrint, EntityLetterSend cEntity)
 {
     switch (ucPrint.FileName)
     {
     case "函件发文表单":
         //ucPrint.WriteContent("拟稿/日期:", WriteMode.Up, 1);
         //ucPrint.WriteAttach();
         break;
     }
 }
Exemple #6
0
        private void Print_OnBeginExport(object sender, EventArgs e)
        {
            if (m_print == null || m_print.m_ls == null || m_print.m_ls.Count == 0)
            {
                return;
            }
            Print print = new Print();

            m_Entity = m_print.m_CurrEntity as EntityLetterSend;
            print.SetPrintBeginExport(m_print, m_Entity);
        }
Exemple #7
0
        private void Print_OnExtraExport(object sender, EventArgs e)
        {
            if (m_print == null || m_Entity == null)
            {
                return;
            }
            Print print = new Print();

            switch (m_print.FileName)
            {
            case "函件发文表单":
                m_print.BatchAddPicture("函件发文", "函件发文表单", m_Entity);
                break;
            }

            if (this.IsPreview)
            {
                //m_Entity = ControlToEntity(false) as EntityLetterSend;
            }
            else
            {
                m_Entity = ControlToEntity(false) as EntityLetterSend;
            }

            if (m_Entity.jinJi)
            {
                m_print.WriteByFont(0x0052, 2, "Wingdings 2");
            }
            else
            {
                m_print.WriteByFont(0x00A3, 2, "Wingdings 2");
            }
            if (m_Entity.huiZhi)
            {
                m_print.WriteByFont(0x0052, 1, "Wingdings 2");
            }
            else
            {
                m_print.WriteByFont(0x00A3, 1, "Wingdings 2");
            }

            ArrayList al = new ArrayList();

            for (int i = 0; i < m_Entity.FileList.Count; i++)
            {
                ArrayList tmp = new ArrayList();
                tmp.Add((i + 1).ToString());
                tmp.Add(m_Entity.FileList[i].Alias + "." + m_Entity.FileList[i].Type);
                tmp.Add(m_Entity.FileList[i].Encode /* + "  " + m_Entity.FileList[i].Edition*/);
                tmp.Add(m_Entity.FileList[i].iPage);
                al.Add(tmp);
            }
            m_print.WriteTable(1, 1, al);
        }
Exemple #8
0
        private void ucPrint_OnExtraExport(object sender, EventArgs e)
        {
            string           str     = string.Empty;
            EntityLetterSend cEntity = null;

            if (base.IsPreview)
            {
                cEntity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();
            }
            else
            {
                cEntity = this.ControlToEntity(false) as EntityLetterSend;
            }

            switch (ucPrint.FileName)
            {
            case "函件发文表单":
                ucPrint.BatchAddPicture("函件发文", "函件发文表单", cEntity);
                break;
            }

            if (cEntity.jinJi)
            {
                ucPrint.WriteByFont(0x0052, 2, "Wingdings 2");
            }
            else
            {
                ucPrint.WriteByFont(0x00A3, 2, "Wingdings 2");
            }
            if (cEntity.huiZhi)
            {
                ucPrint.WriteByFont(0x0052, 1, "Wingdings 2");
            }
            else
            {
                ucPrint.WriteByFont(0x00A3, 1, "Wingdings 2");
            }

            ArrayList al = new ArrayList();

            for (int i = 0; i < cEntity.FileList.Count; i++)
            {
                ArrayList tmp = new ArrayList();
                tmp.Add((i + 1).ToString());
                tmp.Add(cEntity.FileList[i].Alias + "." + cEntity.FileList[i].Type);
                tmp.Add(cEntity.FileList[i].Encode /* + "  " + cEntity.FileList[i].Edition*/);
                tmp.Add(cEntity.FileList[i].iPage);
                al.Add(tmp);
            }
            ucPrint.WriteTable(1, 1, al);
        }
Exemple #9
0
        private void ucPrint_OnAttachExport(object sender, EventArgs e)
        {
            Print            print   = new Print();
            EntityLetterSend cEntity = null;

            if (base.IsPreview)
            {
                cEntity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();
            }
            else
            {
                cEntity = this.ControlToEntity(false) as EntityLetterSend;
            }
            print.SetPrintBeginExport(ucPrint, cEntity);
        }
Exemple #10
0
        private void ucPrint_OnBeginExport(object sender, EventArgs e)
        {
            //string sRes = "";
            //this.Devolve(out sRes);
            Print print = new Print();
            //EntityLetterSend entity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();
            EntityLetterSend cEntity = null;

            if (base.IsPreview)
            {
                cEntity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();
            }
            else
            {
                cEntity = this.ControlToEntity(false) as EntityLetterSend;
            }
            print.SetPrintBeginExport(ucPrint, cEntity);
        }
Exemple #11
0
        /// <summary>
        /// 复制函件发文
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="p_strStepName"></param>
        /// <param name="receiveUserID"></param>
        /// <param name="p_strProcessID"></param>
        /// <param name="p_strWorkItemID"></param>
        /// <returns></returns>
        private bool CopyLSInfo(String ID, String p_strStepName, String p_strUserID, String p_strProcessID, String p_strWorkItemID, String p_strPoolID)
        {
            try
            {
                EntityLetterSend selectEntity = new EntityLetterSend();
                selectEntity.ID = int.Parse(ID);

                EntityLetterSend newEntity = new EntityLetterSend();
                selectEntity.Clone(newEntity);

                newEntity.WorkItemID    = p_strWorkItemID;
                newEntity.StepName      = p_strStepName;
                newEntity.ReceiveUserID = p_strUserID;
                newEntity.D_StepStatus  = String.IsNullOrEmpty(p_strPoolID) ? "Assign" : "New";//公办:New 其他:Assign
                return(newEntity.Save());
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        /// <summary>
        /// 实体填充控件
        /// </summary>
        protected override void EntityToControl()
        {
            EntityLetterSend entity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();

            this.wfWorkItemID.Text  = entity.WorkItemID;
            this.wfProcessID.Text   = entity.ProcessID;
            this.txtccCompany.Text  = entity.ccCompany;
            this.txtCompany.Text    = entity.company;
            this.txtCompany.ToolTip = entity.companyID;
            //this.txtContent.Text = SysString.HtmlToTextCode(entity.content);
            this.txtContent.Text      = entity.content;
            this.txtHeGaoRenDate.Text = entity.heGaoRenDate;
            this.txtNiGaoRenDate.Text = entity.niGaoRenDate;
            EntityToHuiQian(entity);
            this.txtOurRef.Text    = entity.ourRef;
            this.txtPages.Text     = entity.pages;
            this.txtSignDate.Text  = entity.signDate;
            this.txtSubject.Text   = entity.subject;
            this.txtTitle.Text     = entity.title;
            this.txtTo.Text        = entity.to;
            this.txtYourRef.Text   = entity.yourRef;
            this.chkJinJi.Checked  = entity.jinJi;
            this.chkHuiZhi.Checked = entity.huiZhi;
            this.txtccDept.Text    = entity.ccDept;
            this.txtccDeptIDs.Text = entity.ccDeptIDs;
            this.txtccLeader.Text  = entity.ccLeader;
            if (entity.isSave)
            {
                this.txtComment.Text = entity.remarks1;
            }

            //单位 抄送单位
            this.txtCompanyID.Text = entity.companyID;

            //意见 Repeater
            this.Repeater1.DataSource = entity.yiJian;
            this.Repeater1.DataBind();

            this.txtComment.Text = entity.syiJian;
            //附件数据绑定
            this.ucAttachment.UCDataList = entity.FileList;

            //流程数据
            this.wfFaQiRen.Text        = entity.Drafter;
            this.wfFaQiRenID.Text      = entity.wfFaQiRenID;
            this.wfHeGaoRenID.Text     = entity.wfHeGaoRenID;
            this.wfHuiQianRenIDs.Text  = entity.wfHuiQianRenIDs;
            this.wfQianFaRenID.Text    = entity.wfQianFaRenID;
            this.txt_UserDate.Text     = entity.UserDate;
            this.txtDeptLeaderIDs.Text = entity.deptLeaderIDs;
            this.txtccLeaderIDs.Text   = entity.ccLeaderIDs;
            this.wfChuanYueRenIDs.Text = entity.wfChuanYueRenIDs;

            this.txtEquipmentCode.Text = entity.equipmentCode1;
            this.txtContractNo.Text    = entity.contractNo1;

            //下拉控件
            if (!Page.IsPostBack)
            {
                OAList.BindHJLX(drpHanJian);
            }
            FormsMethod.SelectedDropDownList(drpHanJian, entity.hanJianID1, entity.hanJian1);
            FormsMethod.SelectedDropDownList(drpSendDept, entity.sendDeptID1, entity.sendDept1);

            txtHeGaoRen.Text   = entity.heGaoRen;
            txtHuiQianRen.Text = entity.huiQianRen;
            txtQianFaRen.Text  = entity.qianFaRen;
            if (IsPreview == false)
            {
                switch (base.StepName)
                {
                case ProcessConstString.StepName.LetterSend.发起函件:
                    break;

                case ProcessConstString.StepName.LetterSend.核稿:
                    break;

                case ProcessConstString.StepName.LetterSend.会签:
                    break;

                case ProcessConstString.StepName.LetterSend.签发:
                    break;

                case ProcessConstString.StepName.LetterSend.函件分发:
                    break;

                case ProcessConstString.StepName.LetterSend.二次分发:
                    break;

                default: break;
                }
            }
            else
            {
            }

            //领导签发示后显示label形式的领导与时间
            if (entity.signDate != "" && entity.signDate != null)
            {
                this.txtQianFaRen.Visible = false;
                this.lbQianFaRen.Visible  = true;
                this.lbQianFaRen.Text     = entity.qianFaRen;// +strNewLine + entity.signDate;

                this.txtSignDate.Visible = false;
                this.lbSignDate.Visible  = true;
                this.lbSignDate.Text     = entity.signDate;
            }

            //核稿后显示label形式的核稿人与时间
            if (entity.heGaoRenDate != "" && entity.heGaoRenDate != null)
            {
                //this.txtHeGaoRen.Visible = false;
                //this.lbHeGaoRen.Visible = true;
                this.lbHeGaoRen.Text = entity.heGaoRen;// +strNewLine + entity.heGaoRenDate;

                this.txtHeGaoRenDate.Visible = false;
                this.lbHeGaoRenDate.Visible  = true;
                this.lbHeGaoRenDate.Text     = entity.heGaoRenDate;
            }

            //拟稿后显示label形式的拟稿人与时间
            if (entity.niGaoRenDate != "" && entity.niGaoRenDate != null)
            {
                this.txtNiGaoRenDate.Visible = false;
                this.lbNiGaoRen.Visible      = true;
                this.lbNiGaoRen.Text         = entity.niGaoRenDate;
            }
        }
        private void Print_OnExtraExport(object sender, EventArgs e)
        {
            if (m_print == null || m_Entity == null) return;
            Print print = new Print();
            switch (m_print.FileName)
            {
                case "函件发文表单":
                    m_print.BatchAddPicture("函件发文", "函件发文表单", m_Entity);
                    break;
            }

            if (this.IsPreview)
            {
                //m_Entity = ControlToEntity(false) as EntityLetterSend;
            }
            else
            {
                m_Entity = ControlToEntity(false) as EntityLetterSend;
            }

            if (m_Entity.jinJi)
            {
                m_print.WriteByFont(0x0052, 2, "Wingdings 2");
            }
            else
            {
                m_print.WriteByFont(0x00A3, 2, "Wingdings 2");
            }
            if (m_Entity.huiZhi)
            {
                m_print.WriteByFont(0x0052, 1, "Wingdings 2");
            }
            else
            {
                m_print.WriteByFont(0x00A3, 1, "Wingdings 2");
            }

            ArrayList al = new ArrayList();
            for (int i = 0; i < m_Entity.FileList.Count; i++)
            {
                ArrayList tmp = new ArrayList();
                tmp.Add((i + 1).ToString());
                tmp.Add(m_Entity.FileList[i].Alias + "." + m_Entity.FileList[i].Type);
                tmp.Add(m_Entity.FileList[i].Encode/* + "  " + m_Entity.FileList[i].Edition*/);
                tmp.Add(m_Entity.FileList[i].iPage);
                al.Add(tmp);
            }
            m_print.WriteTable(1, 1, al);
        }
        private void Print_OnBeginExport(object sender, EventArgs e)
        {
            if (m_print == null || m_print.m_ls == null || m_print.m_ls.Count == 0) return;
            Print print = new Print();

            m_Entity = m_print.m_CurrEntity as EntityLetterSend;
            print.SetPrintBeginExport(m_print, m_Entity);
        }
        protected void SubmitEvents(object sender, EventArgs e)
        {
            try
            {
                if (IsPreview == false)
                {
                    string strActionName = ((Button)sender).Text.Trim();
                    base.SubAction = strActionName;

                    if (strActionName == ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT) //保存
                    {
                        EntityLetterSend entity = ControlToEntity(true) as EntityLetterSend;
                        entity.SubmitAction = strActionName;
                        base.FormSubmit(true, strActionName, null, entity as EntityBase);
                    }
                    else
                    {
                        EntityLetterSend entity = ControlToEntity(false) as EntityLetterSend;
                        entity.SubmitAction = strActionName;
                        if (CheckData(entity) == false)
                        {
                            return;
                        }

                        if (strActionName == ProcessConstString.SubmitAction.ACTION_CANCEL)
                        {
                            base.FormCancel(entity as EntityBase);
                        }
                        else
                        {
                            if (base.StepName == ProcessConstString.StepName.LetterSend.函件分发)
                            {
                                if (base.SubAction == "完成")
                                {
                                    //新增文号
                                    LetterNum lnum = new LetterNum();
                                    lnum.UpdateNo(txtOurRef.Text, txtCompanyID.Text, drpHanJian.SelectedValue);
                                    entity.ReceiveUserID = entity.ReceiveUserID;
                                }
                            }
                            Hashtable ht = EntityLetterSend.GetProcNameValue(base.StepName, strActionName, entity);//ap属性
                            base.FormSubmit(false, strActionName, ht, entity as EntityBase);

                            if (base.StepName == ProcessConstString.StepName.LetterSend.函件分发)
                            {
                                if (base.SubAction == "完成")
                                {
                                    base.Circulate(entity.ccDeptIDs, "1", "", GetCYNames(entity), "2", false, "", true);
                                }
                            }
                        }
                    }
                }
                else
                {
                    string strActionName = ((Button)sender).Text.Trim();
                    base.SubAction = strActionName;

                    EntityLetterSend entity = ControlToEntity(false) as EntityLetterSend;

                    if (strActionName == "追加分发")
                    {
                        base.Circulate(entity.ccDeptIDs, "1", "", GetCYNames(entity), "2", false, "", true);
                    }
                    else if (strActionName == "二次分发")
                    {
                        base.WorkItemID = Guid.NewGuid().ToString("N");
                        base.StepName   = "二次分发";
                        base.SaveNewEntity(strActionName, entity);
                        base.Circulate(entity.ccDeptIDs, "1", "", GetCYNames(entity), "4", true, "", true);
                    }
                }
            }
            catch (Exception ex)
            {
                //JScript.ShowMsgBox(Page, MsgType.VbCritical, ex.Message);
                JScript.Alert(ex.Message, false);
                return;
            }
        }
Exemple #16
0
        private string Devolve2DC2(HN_OA2DC oaDev)
        {
            string sXml = "";

            List <FounderSoftware.ADIM.OA.OA2DC.DevKVItem> ls = oaDev.MapFunction("DC", base.TemplateName);

            FounderSoftware.ADIM.OA.OA2DC.HNDC_CArchiveNode ar = new HNDC_CArchiveNode();
            FounderSoftware.ADIM.OA.OA2DC.HNDC_CFileNode    fl = new HNDC_CFileNode();

            //string sPath = @"E:\QWDMS\Non Baseline Library\Development\03 Code\FounderSoftware.ADIM\FounderSoftware.ADIM.OA\OADevolveLib\DevolveConfig.xml";
            EntityLetterSend entity = this.ControlToEntity(false) as EntityLetterSend;

            entity.FormsData = XmlUtility.SerializeXml(entity);

            #region 开始生成Archive节点
            ar.System = "OA_" + base.IdentityID.ToString();
            string ObjPlatForm = oaDev.GetCfgNodeValues("/Devolve/Process[@Name='" + base.TemplateName + "']/Object");
            switch (ObjPlatForm)
            {
            case "DC":
                ar.SysFlag = "1";
                break;

            case "FC":
                ar.SysFlag = "2";
                break;

            default:
                ar.SysFlag = "1";
                break;
            }

            #region 根据DevolveConfig.xml配置参数设置Archive归档节点
            for (int i = 0; i < ls.Count; i++)
            {
                string skey  = (ls[i] as FounderSoftware.ADIM.OA.OA2DC.DevKVItem).sKey;
                string sName = (ls[i] as FounderSoftware.ADIM.OA.OA2DC.DevKVItem).sValue;
                string sType = (ls[i] as FounderSoftware.ADIM.OA.OA2DC.DevKVItem).sType;
                if (sName == "niGaoRenDate" || sName == "huiqianDates")
                {
                    string[] result = (entity.GetVal(sName) as string).Split(new char[] { ' ' });
                    if (result.Length >= 3)
                    {
                        ar.SetAttribute(skey, result[1] + " " + result[2]);
                    }
                    else
                    {
                        ar.SetAttribute(skey, result[0]);
                    }
                }
                else
                {
                    ar.SetAttribute(skey, oaDev.PreHandel(entity, sName, sType) /*(entity.GetVal(sName) as string)*/);
                }
            }
            ar.SetOAArchiveNode();
            // 其他节点处理应放置在SetOAArchiveNode方法之后
            // Pace-缓急程度
            ar.Pace = chkJinJi.Checked ? "0" : "1";
            //return Devolve2DP(oaDev, sDPID, ar);
            #endregion 根据DevolveConfig.xml配置参数设置Archive归档节点

            ar.ElectronicDocumentCount = ucAttachment.UCDataList.Count.ToString();
            #endregion
            sXml = oaDev.GenOAArchiveNode(ar, base.TemplateName);

            /****开始生成File节点************************************************************************/
            #region 开始生成File节点
            fl.AuthorizeTime   = ar.AuthorizeTime;
            fl.Code            = ar.Code;
            fl.Code19          = ar.Code19;
            fl.D_FileStatus    = ar.D_FileStatus;
            fl.DocCodesExplain = "";
            fl.DocPages        = ar.DocPages;
            fl.ElectronicDocumentTransceiverTime = ar.ElectronicDocumentTransceiverTime;
            fl.Ext_1         = ar.Ext_1;
            fl.Ext_2         = ar.Ext_2;
            fl.Ext_3         = ar.Ext_3;
            fl.Ext_4         = ar.Ext_4;
            fl.Ext_5         = ar.Ext_5;
            fl.Title         = ar.Title;
            fl.FK_ArchiveID  = ar.FK_Archive;
            fl.FK_CategoryID = ar.FK_CategoryID;
            fl.FormationDept = ar.FormationDept;
            fl.FormationTime = ar.FormationTime;
            fl.Importer      = ar.Importer;
            fl.ImporterTime  = ar.ImporterTime;
            fl.OriginalID    = ar.OriginalID;
            fl.OtherTitle    = ar.OtherTitle;
            fl.PaperDocumentTransceiverTime = ar.PaperDocumentTransceiverTime;
            fl.RelatedCode = ar.RelatedCode;
            fl.Revision    = ar.Revision;
            #endregion
            sXml = oaDev.GenOAFileNode(fl);
            /****完成生成File节点************************************************************************/

            #region 始生成Attachment节点
            /****开始生成Attachment节点******************************************************************/
            string sServerWeb = oaDev.GetCfgNodeValues("/Devolve/Other/ServerWeb");
            //"http://172.29.128.239";
            //string sDocumentName = oaDev.GetCfgNodeValues("/Devolve/Other/DocumentName");
            for (int i = 0; i < ucAttachment.UCDataList.Count; i++)
            {
                HNDC_CAttachmentNode at = new HNDC_CAttachmentNode();
                CFuJian file            = ucAttachment.UCDataList[i];

                at.DocumentName  = "函件发文";//file.FileName;
                at.FK_FileID     = "";
                at.MakeDate      = "";
                at.MakeUnit      = "";
                at.PublishedTime = "";
                at.Remark        = "";

                at.ServerWeb = sServerWeb;
                Double iSize = 0;
                string sSize = file.Size.ToUpper();
                if (sSize.Contains("K"))
                {
                    sSize = sSize.Replace("K", "");
                    iSize = Convert.ToDouble(sSize);
                    iSize = iSize * 1024;
                }
                if (sSize.Contains("M"))
                {
                    sSize = sSize.Replace("M", "");
                    iSize = Convert.ToDouble(sSize);
                    iSize = iSize * 1024 * 1024;
                }
                at.Size     = ((int)iSize).ToString();
                at.TimeSize = "";
                at.Title    = file.Alias;
                at.Type     = file.Type;
                at.Url      = file.URL;

                sXml = oaDev.GenOAAttachmentNode(fl.FK_ArchiveID, at);
            }
            #endregion
            /****完成生成Attachment节点******************************************************************/

            return(sXml);
        }
Exemple #17
0
        public void Devolve(out string sResult)
        {
            sResult = "";
            string sPath = HttpContext.Current.Server.MapPath((@"~\Config\DevolveConfig.xml"));

            FounderSoftware.ADIM.OA.OA2DC.HN_OA2DC dcDev = new HN_OA2DC(sPath);
            FounderSoftware.ADIM.OA.OA2DP.HN_OA2DP dpDev = new HN_OA2DP(sPath);

            // 开始发送归档

            /*
             * 根据DevoleConfig.xml配置文件的中相应流程的<Object>DC</Object>节点来判断归档到哪个系统中
             * 若配置中为DC则表明调用OA2DC.DLL接口进行归档,若为DP则表明调用OA2DP.DLL接口进行归档
             */
            string xml        = "";
            string objDevolve = dcDev.GetCfgNodeValues("/Devolve/Process[@Name='" + base.TemplateName + "']/Object");
            string s          = "";

            //EntityLetterSend entity = new EntityLetterSend(base.tableName);
            //SetEntity(entity, true);
            EntityLetterSend entity = this.ControlToEntity(false) as EntityLetterSend;

            entity.FormsData = XmlUtility.SerializeXml(entity);
            if (objDevolve.ToUpper() == "DC" || objDevolve.ToUpper() == "FC")
            {
                FounderSoftware.ADIM.OA.OA2DC.OA2DC oa2dc = new FounderSoftware.ADIM.OA.OA2DC.OA2DC();
                xml = Devolve2DC2(dcDev);

                s        = oa2dc.SendDevolve(xml, entity.FormsData, "函件发文");
                sResult += (s + @"\r\n");
                try
                {
                    Convert.ToInt32(s);
                }
                catch
                {
                    throw new Exception(s);
                }
            }


            if (objDevolve.ToUpper() == "DP")
            {
                FounderSoftware.ADIM.OA.OA2DP.OA2DP oa2dp = new FounderSoftware.ADIM.OA.OA2DP.OA2DP();
                string sOADPIDs = dpDev.GetCfgNodeValues("/Devolve/Process[@Name='" + base.TemplateName + "']/DPID");

                string[] arrDPID = sOADPIDs.Split(new char[] { ',', ';' });
                for (int i = 0; i < arrDPID.Length; i++)
                {
                    try
                    {
                        Convert.ToInt32(arrDPID[i]);
                    }
                    catch
                    {
                        continue;
                    }
                    xml      = Devolve2DP(dpDev, arrDPID[i]);
                    s        = oa2dp.SendDevolve(xml, entity.FormsData, "函件发文");
                    sResult += (s + @"\r\n");
                    try
                    {
                        Convert.ToInt32(s);
                    }
                    catch
                    {
                        throw new Exception(s);
                    }
                    //JScript.ShowMsgBox(Page, MsgType.VbCritical, s);
                }

                string   sOptionDPID = dpDev.GetCfgNodeValues("/Devolve/Process[@Name='" + base.TemplateName + "']/OptionDPID");
                string[] arrOpDPID   = sOptionDPID.Split(new char[] { ',' });
                for (int i = 0; i < arrOpDPID.Length; i++)
                {
                    if (entity.GetVal(arrOpDPID[i]) == null)
                    {
                        continue;
                    }
                    string   sDPID = entity.GetVal(arrOpDPID[i]).ToString();
                    string[] IDs   = sDPID.Split(new char[] { ';', ',' });
                    for (int j = 0; j < IDs.Length; j++)
                    {
                        try
                        {
                            Convert.ToInt32(IDs[j]);
                        }
                        catch
                        {
                            continue;
                        }
                        xml      = Devolve2DP(dpDev, IDs[j]);
                        s        = oa2dp.SendDevolve(xml, entity.FormsData, "函件发文");
                        sResult += (s + @"\r\n");
                        try
                        {
                            Convert.ToInt32(s);
                        }
                        catch
                        {
                            throw new Exception(s);
                        }
                    }
                    //JScript.ShowMsgBox(Page, MsgType.VbCritical, s);
                }
                // 若DevolveConifg.xml配置文件中未配置CategID则根据流程实体中的处室ID归档
            }
            //string rest = oa2dc.CallBack(Convert.ToInt32(s), true, s);
            //string rest = CDevolve.CallBack(Convert.ToInt32(s), true, s, doc.InnerXml);
            //JScript.ShowMsgBox(Page, MsgType.VbCritical, s);
            //IMessage ms = new WebFormMessage(Page, s);
            //ms.Show();
        }
Exemple #18
0
        private string Devolve2DP(FounderSoftware.ADIM.OA.OA2DP.HN_OA2DP hn_oa2dp, string sDPID)
        {
            string sXml = "";

            #region ArchiveNode
            FounderSoftware.ADIM.OA.OA2DP.HNDP_CArchiveNode ar = new HNDP_CArchiveNode();
            List <FounderSoftware.ADIM.OA.OA2DP.DevKVItem>  ls = hn_oa2dp.MapFunction("DP", base.TemplateName);
            EntityLetterSend entity = this.ControlToEntity(false) as EntityLetterSend;
            ar.System = "OA_" + base.IdentityID.ToString();

            #region 根据DevolveConfig.xml配置参数设置Archive归档节点
            for (int i = 0; i < ls.Count; i++)
            {
                string skey  = (ls[i] as FounderSoftware.ADIM.OA.OA2DP.DevKVItem).sKey;
                string sName = (ls[i] as FounderSoftware.ADIM.OA.OA2DP.DevKVItem).sValue;
                string sType = (ls[i] as FounderSoftware.ADIM.OA.OA2DP.DevKVItem).sType;
                ar.SetAttribute(skey, hn_oa2dp.PreHandel(entity, sName, sType, true) /*(entity.GetVal(sName) as string)*/);
            }
            ar.SetOAArchiveNode();
            // 其他节点处理应放置在SetOAArchiveNode方法之后
            ar.FK_DPID = sDPID;
            //return Devolve2DP(oaDev, sDPID, ar);
            #endregion 根据DevolveConfig.xml配置参数设置Archive归档节点

            #region 注释保留

            /*
             * // Pace-缓急程度
             * //ar.Pace = chkJinJi.Checked ? "0" : "1";
             * // 页数
             * ar.DocPages = txtPages.Text;
             * // 通讯渠道号
             * ar.CommunicationChannelCode = txtOurRef.Text;
             #region 签发人 签发日期
             * if (txtSignDate.Text != "")
             * {
             *  if (txtSignDate.Text.Contains(" "))
             *  {
             *      //签发日期-批准日期
             *      ar.AuthorizeTime = txtSignDate.Text.Split(' ')[1];
             *  }
             *  else
             *  {
             *      //签发日期-批准日期
             *      ar.AuthorizeTime = txtSignDate.Text;
             *  }
             *  //签发人-批准者
             *  ar.Authorizer = txtQianFaRen.Text;
             * }
             #endregion
             * // 会签者
             * //ar.Countersigner = txtHuiQianRen.Text;
             * // 会签日期
             * //ar.CountersignedDate = txtHuiQianRenDates.Text;
             #region 核稿人-校核者
             * ////核稿人-校核者
             * //if (txtHeGaoRenDate.Text != "")
             * //{
             * //    if (txtHeGaoRenDate.Text.Contains(" "))
             * //    {
             * //        //核稿日期-校核日期
             * //        ar.CheckDate = txtHeGaoRenDate.Text.Split(' ')[1];
             * //    }
             * //    else
             * //    {
             * //        //核稿日期-校核日期
             * //        ar.CheckDate = txtHeGaoRenDate.Text;
             * //    }
             * //    //核稿人-校核者
             * //    ar.Checkthose = txtHeGaoRenDate.Text;
             * //}
             #endregion
             * // 编制人/编制日期
             * // 编制单位
             * ar.FormationDept = drpSendDept.SelectedItem.Text;
             * // 题名
             * ar.Title = txtSubject.Text;
             * // 主送单位
             * ar.MainDispenseUnit = txtCompany.Text;
             * // 抄送单位
             * ar.RelatedDespenseUnit = txtccCompany.Text;
             * // 备注
             * ar.Remark = txtComment.Text;
             * //ar.FK_CategoryID = "903";
             * // 公共常量
             * //ar.GatherLevel = "件";
             * //ar.D_StorageCarrierType = "纸质";
             * //ar.Amount = "1";
             * //ar.D_Language = "中文";
             * */
            #endregion
            ar.ElectronicDocumentCount = ucAttachment.UCDataList.Count.ToString();
            #endregion
            sXml = hn_oa2dp.GenOAArchiveNode(ar, base.TemplateName);

            FounderSoftware.ADIM.OA.OA2DP.HNDP_CFileNode fl = new HNDP_CFileNode();
            /****开始生成File节点************************************************************************/
            #region 开始生成File节点
            fl.AuthorizeTime   = ar.AuthorizeTime;
            fl.Code            = ar.Code;
            fl.Code19          = ar.Code19;
            fl.D_FileStatus    = ar.D_FileStatus;
            fl.DocCodesExplain = "";
            fl.DocPages        = ar.DocPages;
            fl.ElectronicDocumentTransceiverTime = ar.ElectronicDocumentTransceiverTime;
            fl.Ext_1 = "";
            fl.Ext_2 = ar.Ext_2;
            fl.Ext_3 = ar.Ext_3;
            fl.Ext_4 = ar.Ext_4;
            fl.Ext_5 = ar.Ext_5;
            fl.Title = ar.Title;
            //fl.FK_ArchiveID = ar.FK_Archive;
            fl.FK_CategoryID = ar.FK_CategoryID;
            fl.FormationDept = ar.FormationDept;
            fl.FormationTime = ar.FormationTime;
            fl.Importer      = ar.Importer;
            fl.ImporterTime  = ar.ImporterTime;
            fl.OriginalID    = ar.OriginalID;
            fl.OtherTitle    = ar.OtherTitle;
            fl.PaperDocumentTransceiverTime = ar.PaperDocumentTransceiverTime;
            fl.RelatedCode = ar.RelatedCode;
            fl.Revision    = ar.Revision;
            #endregion
            sXml = hn_oa2dp.GenOAFileNode(fl);
            /****完成生成File节点************************************************************************/

            #region 始生成Attachment节点
            /****开始生成Attachment节点******************************************************************/
            string sServerWeb = hn_oa2dp.GetCfgNodeValues("/Devolve/Other/ServerWeb");
            //"http://172.29.128.239";
            //string sDocumentName = oaDev.GetCfgNodeValues("/Devolve/Other/DocumentName");
            for (int i = 0; i < ucAttachment.UCDataList.Count; i++)
            {
                FounderSoftware.ADIM.OA.OA2DP.HNDP_CAttachmentNode at = new HNDP_CAttachmentNode();
                CFuJian file = ucAttachment.UCDataList[i];

                at.DocumentName  = "函件发文";//file.FileName;
                at.FK_FileID     = "";
                at.MakeDate      = "";
                at.MakeUnit      = "";
                at.PublishedTime = "";
                at.Remark        = "";

                at.ServerWeb = sServerWeb;
                Double iSize = 0;
                string sSize = file.Size.ToUpper();
                if (sSize.Contains("K"))
                {
                    sSize = sSize.Replace("K", "");
                    iSize = Convert.ToDouble(sSize);
                    iSize = iSize * 1024;
                }
                if (sSize.Contains("M"))
                {
                    sSize = sSize.Replace("M", "");
                    iSize = Convert.ToDouble(sSize);
                    iSize = iSize * 1024 * 1024;
                }
                at.Size     = ((int)iSize).ToString();
                at.TimeSize = "";
                at.Title    = file.Alias;
                at.Type     = file.Type;
                at.Url      = file.URL;

                sXml = hn_oa2dp.GenOAAttachmentNode(fl.FK_ArchiveID, at);
            }
            #endregion
            /****完成生成Attachment节点******************************************************************/

            return(sXml);
        }
        /// <summary>
        /// 控件填充实体
        /// </summary>
        /// <param name="IsSave">是否保存</param>
        /// <returns>EntityBase</returns>
        protected override EntityBase ControlToEntity(bool IsSave)
        {
            EntityLetterSend entity = null;

            entity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();


            entity.DocumentTitle = txtSubject.Text;
            entity.ccCompany     = txtccCompany.Text;
            entity.company       = txtCompany.Text;
            entity.company1      = txtCompany.Text;
            //entity.content = SysString.TextToHtmlCode(txtContent.Text);
            entity.content = txtContent.Text;

            entity.pages = txtPages.Text;

            entity.subject      = txtSubject.Text;
            entity.title        = txtTitle.Text;
            entity.to           = txtTo.Text;
            entity.yourRef      = txtYourRef.Text;
            entity.jinJi        = chkJinJi.Checked;
            entity.UrgentDegree = chkJinJi.Checked ? ConstString.CommonStr.Urgent : ConstString.CommonStr.Normal;
            entity.huiZhi       = chkHuiZhi.Checked;
            entity.ccDept       = txtccDept.Text;
            entity.ccDeptIDs    = this.txtccDeptIDs.Text;
            entity.ccLeader     = txtccLeader.Text;
            entity.companyID    = txtCompanyID.Text;

            //流程数据和隐藏数据
            entity.deptLeaderIDs = txtDeptLeaderIDs.Text;

            entity.ccLeaderIDs      = txtccLeaderIDs.Text;
            entity.wfChuanYueRenIDs = wfChuanYueRenIDs.Text;

            if (wfChuanYueRenIDs.Text != "")
            {
                string[] strCYarr = wfChuanYueRenIDs.Text.Split(';');

                for (int i = 0; i < strCYarr.Length; i++)
                {
                    ChuanYues cy    = new ChuanYues();
                    bool      isHas = false;
                    for (int j = 0; j < entity.chuanyues.Count; j++)
                    {
                        if (entity.chuanyues[j].UserID.ToLower() == strCYarr[i].ToLower())
                        {
                            isHas = true;
                        }
                    }
                    if (!isHas)
                    {
                        cy.UserID   = strCYarr[i];
                        cy.UserName = OAUser.GetUserName(strCYarr[i]);
                        cy.Date     = DateTime.Now.ToShortDateString();
                        entity.chuanyues.Add(cy);
                    }
                }
            }
            //附件数据绑定
            entity.FileList = this.ucAttachment.UCDataList;

            //函件类型
            entity.hanJian1   = drpHanJian.SelectedItem == null ? "" : drpHanJian.SelectedItem.Text;
            entity.hanJianID1 = drpHanJian.SelectedValue == null ? "" : drpHanJian.SelectedValue;

            //add
            entity.equipmentCode1 = this.txtEquipmentCode.Text;
            entity.contractNo1    = this.txtContractNo.Text;

            //意见
            if (IsSave == false)
            {
                entity.isSave = false;
                CYiJian so = new CYiJian();
                so.UserID     = entity.ReceiveUserID == string.Empty ? CurrentUserInfo.UserName : entity.ReceiveUserID;
                so.UserName   = entity.ReceiveUserName == string.Empty ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
                so.ViewName   = base.StepName;
                so.FinishTime = DateTime.Now.ToString();
                so.Content    = "(" + base.SubAction + ")" + txtComment.Text;
                entity.yiJian.Add(so);
            }
            else
            {
                entity.isSave  = true;
                entity.syiJian = txtComment.Text;
            }

            switch (base.StepName)
            {
            case ProcessConstString.StepName.LetterSend.发起函件:

                //核稿
                entity.heGaoRen     = txtHeGaoRen.Text;
                entity.wfHeGaoRenID = wfHeGaoRenID.Text;
                //会签
                entity.huiQianRen      = txtHuiQianRen.Text;
                entity.wfHuiQianRenIDs = wfHuiQianRenIDs.Text;
                //签发
                entity.qianFaRen     = txtQianFaRen.Text;
                entity.wfQianFaRenID = wfQianFaRenID.Text;

                if (txtNiGaoRenDate.Text.Trim() == "")     //不是第一次
                {
                    //发起人
                    if (IsSave == false)
                    {
                        entity.UserDate     = DateTime.Now.ToString();
                        entity.niGaoRenDate = (entity.niGaoRenDate == string.Empty ? CurrentUserInfo.DisplayName : entity.ReceiveUserName) + " " + entity.UserDate;
                        entity.DraftDate    = SysConvert.ToDateTime(entity.UserDate);
                    }
                    if (entity.Drafter == string.Empty)
                    {
                        entity.Drafter     = CurrentUserInfo.DisplayName;
                        entity.DrafterID   = CurrentUserInfo.UserName;
                        entity.wfFaQiRenID = CurrentUserInfo.UserName;
                    }
                }
                if (base.SubAction == "提交会签" || base.SubAction == "提交签发")     //如果是被退回的 再次提交会签 不经过核稿 则清空核稿人和核稿日期
                {
                    if (IsSave == false && base.WorkItemID != "" && base.IsFromDraft == false)
                    {
                        entity.heGaoRen     = "";
                        entity.heGaoRenDate = "";
                        entity.wfHeGaoRenID = "";
                        entity.heGaoYiJian  = "";
                    }
                    else
                    {
                        entity.heGaoRen     = txtHeGaoRen.Text;
                        entity.wfHeGaoRenID = wfHeGaoRenID.Text;
                    }
                }
                if (base.SubAction == "提交签发")     //如果是被退回的 再次提交签发 不经过会签 则清空会签人和会签日期
                {
                    if (IsSave == false && base.WorkItemID != "" && base.IsFromDraft == false)
                    {
                        entity.huiqianDates = "";
                        entity.huiQianRen   = "";
                        entity.huiQian.Clear();
                    }
                }

                //发文部门
                entity.sendDept1   = drpSendDept.SelectedItem == null ? "" : drpSendDept.SelectedItem.Text;
                entity.sendDeptID1 = drpSendDept.SelectedValue;

                //是否会签驳回
                entity.isHuiQianBoHui = false;
                if (base.SubAction == "提交会签")
                {
                    entity.iHuiQianCount = entity.iHuiQianCount + 1;
                }
                break;

            case ProcessConstString.StepName.LetterSend.核稿:
                //核稿
                entity.heGaoRen = entity.ReceiveUserName;
                if (IsSave == false)
                {
                    entity.heGaoRenDate = DateTime.Now.ToString();
                }
                entity.heGaoYiJian = txtComment.Text;

                //会签
                entity.huiQianRen      = txtHuiQianRen.Text;
                entity.wfHuiQianRenIDs = wfHuiQianRenIDs.Text;

                //签发
                entity.qianFaRen     = txtQianFaRen.Text;
                entity.wfQianFaRenID = wfQianFaRenID.Text;
                if (base.SubAction == "提交会签")
                {
                    entity.iHuiQianCount = entity.iHuiQianCount + 1;
                }
                if (base.SubAction == "提交签发")     //如果是被核稿退回的 再次提交签发 不经过会签 则清空会签人和会签日期
                {
                    if (IsSave == false && base.WorkItemID != "" && base.IsFromDraft == false)
                    {
                        entity.huiqianDates = "";
                        entity.huiQianRen   = "";
                        entity.huiQian.Clear();
                    }
                }
                break;

            case ProcessConstString.StepName.LetterSend.会签:
                if (IsSave == false)
                {
                    if (entity.huiqianDates == "")
                    {
                        entity.huiqianDates = entity.ReceiveUserName + " " + DateTime.Now.ToString(DateFormat);
                    }
                    else
                    {
                        entity.huiqianDates = entity.huiqianDates + ";" + entity.ReceiveUserName + " " + DateTime.Now.ToString(DateFormat);
                    }

                    HanJianHuiQian hjhq = new HanJianHuiQian();
                    hjhq.UserID   = entity.ReceiveUserID;
                    hjhq.UserName = entity.ReceiveUserName;
                    hjhq.Date     = DateTime.Now;
                    hjhq.YiJian   = txtComment.Text;
                    hjhq.ICount   = entity.iHuiQianCount;
                    entity.huiQian.Add(hjhq);
                }
                //签发
                entity.qianFaRen     = txtQianFaRen.Text;
                entity.wfQianFaRenID = wfQianFaRenID.Text;

                if (base.SubAction == "退回")
                {
                    entity.isHuiQianBoHui = true;
                }
                break;

            case ProcessConstString.StepName.LetterSend.签发:
                if (IsSave == false)
                {
                    if (base.SubAction != "退回")
                    {
                        entity.signDate = DateTime.Now.ToString(DateFormat);
                    }
                }
                entity.HanJianAdminID = OAUser.GetUserByRoleName("函件管理员")[0];
                entity.HanJianAdmin   = OAUser.GetUserByRoleName("函件管理员")[1];
                break;

            case ProcessConstString.StepName.LetterSend.函件分发:
                entity.ourRef     = txtOurRef.Text;
                entity.DocumentNo = txtOurRef.Text;
                break;

            case ProcessConstString.StepName.LetterSend.二次分发:
                break;

            default: break;
            }

            return(entity);
        }
        private bool CheckData(EntityLetterSend entity)
        {
            List <String> arrErr = new List <string>();

            if (entity.DocumentTitle == "")
            {
                arrErr.Add("标题不能为空!");
            }
            if (entity.DocumentTitle.Contains("#") || entity.DocumentTitle.Contains("'"))
            {
                arrErr.Add("含有特殊字符,请替换后再上传");
            }
            if (entity.company == "")
            {
                arrErr.Add("主送单位不能为空!");
            }
            if (entity.pages != "")
            {
                if (!Regex.IsMatch(entity.pages.Trim(), @"^[0-9]*[1-9][0-9]*$", RegexOptions.IgnoreCase))
                {
                    arrErr.Add("页数应为正整数!");
                }
            }

            if (entity.content == "")
            {
                arrErr.Add("正文不能为空!");
            }

            switch (base.StepName)
            {
                #region 发起函件
            case ProcessConstString.StepName.LetterSend.发起函件:
                if (entity.sendDeptID1 == "")
                {
                    arrErr.Add("发文部门不能为空!");
                }

                //根据提交动作做不同的判断
                if (entity.SubmitAction == "提交核稿")
                {
                    if (string.IsNullOrEmpty(entity.wfHeGaoRenID))
                    {
                        arrErr.Add("核稿人不能为空!");
                    }
                }
                if (entity.SubmitAction == "提交会签")
                {
                    if (string.IsNullOrEmpty(wfHeGaoRenID.Text) == false)
                    {
                        arrErr.Add("请先清空核稿人后再提交会签!");
                    }
                    if (string.IsNullOrEmpty(entity.wfHuiQianRenIDs))
                    {
                        arrErr.Add("会签人不能为空!");
                    }
                }
                if (entity.SubmitAction == "提交签发")
                {
                    if (string.IsNullOrEmpty(wfHeGaoRenID.Text) == false)
                    {
                        arrErr.Add("请先清空核稿人后再提交签发!");
                    }
                    if (string.IsNullOrEmpty(wfHuiQianRenIDs.Text) == false)
                    {
                        arrErr.Add("请先清空会签人后再提交签发!");
                    }
                    if (string.IsNullOrEmpty(entity.wfQianFaRenID))
                    {
                        arrErr.Add("签发人不能为空!");
                    }
                }
                if (string.IsNullOrEmpty(entity.wfFaQiRenID))
                {
                    arrErr.Add("发起人不能为空!");
                }
                if (string.IsNullOrEmpty(entity.wfQianFaRenID))
                {
                    arrErr.Add("签发人不能为空!");
                }

                break;
                #endregion

                #region 核稿
            case ProcessConstString.StepName.LetterSend.核稿:
                if (entity.SubmitAction == "提交会签")
                {
                    if (string.IsNullOrEmpty(entity.wfHuiQianRenIDs))
                    {
                        arrErr.Add("会签人不能为空!");
                    }
                    if (string.IsNullOrEmpty(entity.wfQianFaRenID))
                    {
                        arrErr.Add("签发人不能为空!");
                    }
                }
                if (entity.SubmitAction == "提交签发")
                {
                    if (string.IsNullOrEmpty(entity.wfHuiQianRenIDs) == false)
                    {
                        arrErr.Add("请先清空会签人后再提交签发!");
                    }
                }
                break;
                #endregion

                #region 会签
            case ProcessConstString.StepName.LetterSend.会签:
                if (entity.SubmitAction == "提交签发")
                {
                    if (string.IsNullOrEmpty(entity.wfQianFaRenID))
                    {
                        arrErr.Add("签发人不能为空!");
                    }
                }
                break;
                #endregion

                #region 签发

            case ProcessConstString.StepName.LetterSend.签发:
                if (entity.HanJianAdminID == "")
                {
                    arrErr.Add("角色:函件管理员没有成员!");
                }
                break;
                #endregion

                #region 函件分发
            case ProcessConstString.StepName.LetterSend.函件分发:
                if (entity.SubmitAction == "完成")
                {
                    if (entity.pages == "")
                    {
                        arrErr.Add("页数不能为空!");
                    }
                    if (txtOurRef.Text.Trim() == "")
                    {
                        arrErr.Add("我方发文号不能为空!");
                    }
                    if (ucAttachment.UCDataList.Count == 0)
                    {
                        arrErr.Add("附件不能为空!");
                    }
                }
                if (entity.SubmitAction == "退回")
                {
                }
                break;
                #endregion

            case ProcessConstString.StepName.LetterSend.二次分发:
                entity.ourRef     = txtOurRef.Text;
                entity.DocumentNo = txtOurRef.Text;
                break;

            default: break;
            }

            if (arrErr.Count > 0)
            {
                //JScript.ShowErrMsg(Page, arrErr);
                string strMessages = string.Empty;
                if (arrErr.Count > 0)
                {
                    for (int i = 0; i < arrErr.Count; i++)
                    {
                        if (i == 0)
                        {
                            strMessages = arrErr[i];
                        }
                        else
                        {
                            strMessages += "\\n" + arrErr[i];
                        }
                    }
                }
                JScript.Alert(strMessages, false);
                return(false);
            }
            return(true);
        }
 private string EntityToHuiQian(EntityLetterSend entity)
 {
     if (entity.huiQian.Count > 0)//新版从list里取
     {
         string shuiqian = "";
         if (entity.huiQian.Count > 0)
         {
             for (int i = 0; i < entity.huiQian.Count; i++)
             {
                 if (entity.huiQian[i].ICount == entity.iHuiQianCount)
                 {
                     shuiqian += ";" + entity.huiQian[i].UserName + " " + entity.huiQian[i].Date.ToString(DateFormat);
                 }
             }
             if (shuiqian.Length > 0)
             {
                 shuiqian = shuiqian.Substring(1);
             }
         }
         return shuiqian;
     }
     else
     {            //兼容旧版
         if (entity.huiqianDates != "")
         {
             return entity.huiqianDates;
         }
     }
     return "";
 }
        /// <summary>
        /// 复制函件发文
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="p_strStepName"></param>
        /// <param name="receiveUserID"></param>
        /// <param name="p_strProcessID"></param>
        /// <param name="p_strWorkItemID"></param>
        /// <returns></returns>
        private bool CopyLSInfo(String ID, String p_strStepName, String p_strUserID, String p_strProcessID, String p_strWorkItemID, String p_strPoolID)
        {
            try
            {
                EntityLetterSend selectEntity = new EntityLetterSend();
                selectEntity.ID = int.Parse(ID);

                EntityLetterSend newEntity = new EntityLetterSend();
                selectEntity.Clone(newEntity);

                newEntity.WorkItemID = p_strWorkItemID;
                newEntity.StepName = p_strStepName;
                newEntity.ReceiveUserID = p_strUserID;
                newEntity.D_StepStatus = String.IsNullOrEmpty(p_strPoolID) ? "Assign" : "New";//公办:New 其他:Assign
                return newEntity.Save();
            }
            catch (Exception ex)
            {
                return false;
            }
        }
        /// <summary>
        /// 控件初始设置
        /// </summary>
        protected override void SetControlStatus()
        {
            btnSetNo.Visible = false;
            btnCheck.Visible = false;

            lblPages.Visible  = false;
            lblOurRef.Visible = false;

            ucAttachment.UCTemplateName = base.TemplateName;
            ucAttachment.UCProcessID    = base.ProcessID;
            ucAttachment.UCWorkItemID   = base.WorkItemID;
            ucAttachment.UCTBID         = base.IdentityID.ToString();

            OAControl controls = new OAControl();

            OAControl controlsCommon = new OAControl();

            controlsCommon.DisEnableControls = new Control[]
            {
                txtSignDate, txtHuiQianRenDates, txtHeGaoRenDate, txtNiGaoRenDate
            };

            controlsCommon.DisVisibleControls = new Control[]
            {
                //btnSetNo,btnCheck
            };


            if (IsPreview == false)
            {
                //给于用户提示
                txtSubject.ToolTip   = "200字符以内";
                txtSubject.MaxLength = 200;

                txtQianFaRen.ToolTip  = "公司领导";
                txtHuiQianRen.ToolTip = "函件会签组";

                txtSignDate.ToolTip        = "签发后自动生成";
                txtHeGaoRenDate.ToolTip    = "核稿后自动生成";
                txtHuiQianRenDates.ToolTip = "会签后自动生成";
                txtNiGaoRenDate.ToolTip    = "拟稿后自动生成";

                #region 弹出选择
                //签发人
                UCQianFa.UCRoleName        = "函件签发组";
                UCQianFa.UCUserIDControl   = wfQianFaRenID.ClientID;
                UCQianFa.UCUserNameControl = txtQianFaRen.ClientID;
                UCQianFa.UCIsSingle        = true;

                //会签人
                UCHuiQian.UCRoleName        = "函件会签组";
                UCHuiQian.UCUserIDControl   = wfHuiQianRenIDs.ClientID;
                UCHuiQian.UCUserNameControl = txtHuiQianRen.ClientID;
                UCHuiQian.UCIsSingle        = false;

                //抄送部门
                UCDeptcc.UCDeptIDControl   = txtccDeptIDs.ClientID;
                UCDeptcc.UCDeptNameControl = txtccDept.ClientID;
                UCDeptcc.UCDeptShowType    = "1010";
                UCDeptcc.UCSelectType      = "0";
                UCDeptcc.UCLevel           = "2";
                UCDeptcc.UCALLChecked      = "1";

                //抄送领导
                UCccLingDao.UCIsSingle        = false;
                UCccLingDao.UCRoleName        = "公司领导";
                UCccLingDao.UCUserIDControl   = txtccLeaderIDs.ClientID;
                UCccLingDao.UCUserNameControl = txtccLeader.ClientID;

                //主送单位
                UCCompany.UCNoControl   = txtCompanyID.ClientID;
                UCCompany.UCNameControl = txtCompany.ClientID;
                UCCompany.UCIsSingle    = true;

                //抄送单位
                UCCompanycs.UCNameControl = txtccCompany.ClientID;
                UCCompanycs.UCIsSingle    = false;
                ////UCCompanycc.UCNameControl = txtccCompany.ClientID;
                //////UCCompanycc.UCIsSingle = false;
                #endregion

                switch (base.StepName)
                {
                    #region 发起函件
                case ProcessConstString.StepName.LetterSend.发起函件:

                    wfFaQiRen.Text      = CurrentUserInfo.DisplayName;
                    wfFaQiRenID.Text    = CurrentUserInfo.UserName;
                    drpSendDept.ToolTip = "我所属的处室";
                    lblYiJian.Text      = "备注";

                    //核稿人
                    HeGaoRen();

                    controls.EnableControls = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo, drpSendDept,
                        txtSubject, txtContent, txtTo
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtHeGaoRen, txtQianFaRen, txtHuiQianRen, txtCompany, txtccDept, txtccLeader, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtOurRef,
                    };
                    if (string.IsNullOrEmpty(base.WorkItemID))
                    {
                        controls.DisVisibleControls = new Control[]
                        {
                            btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnQianFa, btnWanCheng, btnCancel, btnBack
                        };
                    }
                    else     //是被退回的 可撤销流程
                    {
                        if (base.IsFromDraft == false)
                        {
                            controls.DisVisibleControls = new Control[]
                            {
                                btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnQianFa, btnWanCheng, btnBack
                            };
                            btnCancel.Attributes.Add("onclick", "javascript: if(!confirm('确定要撤销该流程吗?')){return false;}else{DisableButtons();}");
                        }
                        else
                        {
                            controls.DisVisibleControls = new Control[]
                            {
                                btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnQianFa, btnWanCheng, btnBack, btnCancel
                            };
                        }
                    }
                    break;
                    #endregion

                    #region 核稿
                case ProcessConstString.StepName.LetterSend.核稿:
                    controls.EnableControls = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo, drpSendDept,
                        txtSubject, txtContent, txtTo, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtOurRef, txtHeGaoRen, drpSendDept
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtQianFaRen, txtHuiQianRen, txtCompany, txtccDept, txtccLeader
                    };
                    controls.DisVisibleControls = new Control[]
                    {
                        UCHeGao,
                        btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnQianFa, btnWanCheng, btnCancel, btnSubmitHeGao
                    };
                    break;
                    #endregion

                    #region 会签
                case ProcessConstString.StepName.LetterSend.会签:
                    ucAttachment.UCIsEditable = false;
                    btnSumitQianFa.Text       = "同意";
                    controls.EnableControls   = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo,
                        txtSubject, txtContent, txtTo, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtOurRef, txtHeGaoRen, drpSendDept, txtHuiQianRen, txtQianFaRen,
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtQianFaRen, txtHuiQianRen, txtCompany, txtccDept, txtccLeader
                    };
                    controls.DisVisibleControls = new Control[]
                    {
                        UCHuiQian, UCHeGao,
                        btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnCancel, btnSubmitHeGao, btnSubmitHuiQian, btnWanCheng, btnQianFa
                    };
                    break;
                    #endregion

                    #region 签发
                case ProcessConstString.StepName.LetterSend.签发:
                    controls.EnableControls = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo,
                        txtSubject, txtContent, txtTo, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtOurRef, txtHeGaoRen, drpSendDept, txtHuiQianRen, txtQianFaRen,
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtCompany, txtccDept, txtccLeader
                    };
                    controls.DisVisibleControls = new Control[]
                    {
                        UCHuiQian, UCHeGao, UCQianFa,
                        btnAddFenfa, btnCheck, btnGD, btnSencondFenfa, btnSetNo, btnCancel, btnSubmitHeGao, btnSubmitHuiQian, btnSumitQianFa, btnWanCheng
                    };

                    btnQianFa.ToolTip = "提交给函件管理员:" + OAUser.GetUserByRoleName("函件管理员")[1];
                    break;
                    #endregion

                    #region 函件分发
                case ProcessConstString.StepName.LetterSend.函件分发:
                    btnSetNo.Visible = true;
                    btnCheck.Visible = true;

                    lblPages.Visible  = true;
                    lblOurRef.Visible = true;
                    drpHanJian.SelectedIndexChanged += new EventHandler(drpHanJian_SelectedIndexChanged);
                    txtCompanyID.TextChanged        += new EventHandler(txtCompanyID_TextChanged);

                    if (base.IsDevolve)
                    {
                        this.btnGD.Attributes.Add("onclick", "javascript: if(!confirm('该流程已经归档,是否重新归档?')){return false;}else{DisableButtons();}");
                    }
                    controls.EnableControls = new Control[]
                    {
                        chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo,
                        txtSubject, txtContent, txtOurRef, txtTo, txtccCompany
                    };
                    controls.DisEnableControls = new Control[]
                    {
                        txtHeGaoRen, drpSendDept, txtHuiQianRen, txtQianFaRen,
                    };
                    controls.YellowControls = new Control[]
                    {
                        txtCompany, txtccDept, txtccLeader
                    };
                    controls.DisVisibleControls = new Control[]
                    {
                        UCHuiQian, UCHeGao, UCQianFa,
                        btnAddFenfa, btnSencondFenfa, btnCancel, btnSubmitHeGao, btnSubmitHuiQian, btnSumitQianFa, btnQianFa
                    };
                    break;
                    #endregion

                case ProcessConstString.StepName.LetterSend.二次分发:
                    break;

                default: break;
                }

                controlsCommon.SetControls();
                controls.SetControls();
            }
            //历史表单
            else
            {
                EntityLetterSend entity = base.EntityData != null ? base.EntityData as EntityLetterSend : new EntityLetterSend();
                ucAttachment.UCIsEditable  = false;
                controls.DisEnableControls = new Control[]
                {
                    txtOurRef, txtHeGaoRen, drpSendDept, txtHuiQianRen, txtQianFaRen,
                    chkJinJi, chkHuiZhi, txtPages, drpHanJian, txtYourRef, txtEquipmentCode, txtContractNo,
                    txtSubject, txtContent, txtTo,
                    txtCompany, txtccCompany, txtccDept, txtccLeader, txtComment,
                };
                controls.DisVisibleControls = new Control[]
                {
                    UCHeGao, UCHuiQian, UCQianFa, UCCompany, UCCompanycc, UCccLingDao, UCDeptcc,
                    btnSubmitHeGao, btnSubmitHuiQian, btnSumitQianFa, btnSave, btnSencondFenfa, btnSetNo, btnWanCheng, btnGD, btnCancel, btnQianFa, btnBack, btnAddFenfa
                };

                controlsCommon.SetControls();
                controls.SetControls();
                switch (base.StepName)
                {
                    #region 发起函件
                case ProcessConstString.StepName.LetterSend.发起函件:

                    break;
                    #endregion

                    #region 核稿
                case ProcessConstString.StepName.LetterSend.核稿:
                    break;
                    #endregion

                    #region 会签
                case ProcessConstString.StepName.LetterSend.会签:
                    break;
                    #endregion

                    #region 签发
                case ProcessConstString.StepName.LetterSend.签发:
                    break;
                    #endregion

                    #region 函件分发
                case ProcessConstString.StepName.LetterSend.函件分发:
                    if (entity.ReceiveUserID == CurrentUserInfo.UserName)     //自己办理的公办才允许追加分发
                    {
                        btnAddFenfa.Visible     = true;
                        btnSencondFenfa.Visible = true;

                        //抄送部门
                        UCDeptcc.UCDeptIDControl   = txtccDeptIDs.ClientID;
                        UCDeptcc.UCDeptNameControl = txtccDept.ClientID;
                        UCDeptcc.UCDeptShowType    = "1010";
                        UCDeptcc.UCSelectType      = "0";
                        UCDeptcc.UCLevel           = "2";

                        //抄送领导
                        UCccLingDao.UCIsSingle        = false;
                        UCccLingDao.UCRoleName        = "公司领导";
                        UCccLingDao.UCUserIDControl   = txtccLeaderIDs.ClientID;
                        UCccLingDao.UCUserNameControl = txtccLeader.ClientID;

                        UCDeptcc.Visible        = true;
                        UCccLingDao.Visible     = true;
                        base.StepName           = "二次分发";
                        btnSencondFenfa.Visible = true;
                        btnAddFenfa.Visible     = true;

                        ucAttachment.UCIsAgain = "1";
                    }
                    break;

                    #endregion
                default: break;
                }
                if (base.IsCanDevolve)
                {
                    this.btnGD.Visible = true;
                    if (base.IsDevolve)
                    {
                        this.btnGD.Attributes.Add("onclick", "javascript: if(!confirm('该流程已经归档,是否重新归档?')){return false;}else{DisableButtons();}");
                    }
                }
            }
        }
        private bool CheckData(EntityLetterSend entity)
        {
            List<String> arrErr = new List<string>();

            if (entity.DocumentTitle == "")
            {
                arrErr.Add("标题不能为空!");
            }
            if (entity.DocumentTitle.Contains("#") || entity.DocumentTitle.Contains("'"))
            {
                arrErr.Add("含有特殊字符,请替换后再上传");
            }
            if (entity.company == "")
            {
                arrErr.Add("主送单位不能为空!");
            }
            if (entity.pages != "")
            {
                if (!Regex.IsMatch(entity.pages.Trim(), @"^[0-9]*[1-9][0-9]*$", RegexOptions.IgnoreCase))
                {
                    arrErr.Add("页数应为正整数!");
                }
            }

            if (entity.content == "")
            {
                arrErr.Add("正文不能为空!");
            }

            switch (base.StepName)
            {
                #region 发起函件
                case ProcessConstString.StepName.LetterSend.发起函件:
                    if (entity.sendDeptID1 == "")
                    {
                        arrErr.Add("发文部门不能为空!");
                    }

                    //根据提交动作做不同的判断
                    if (entity.SubmitAction == "提交核稿")
                    {
                        if (string.IsNullOrEmpty(entity.wfHeGaoRenID))
                        {
                            arrErr.Add("核稿人不能为空!");
                        }
                    }
                    if (entity.SubmitAction == "提交会签")
                    {
                        if (string.IsNullOrEmpty(wfHeGaoRenID.Text) == false)
                        {
                            arrErr.Add("请先清空核稿人后再提交会签!");
                        }
                        if (string.IsNullOrEmpty(entity.wfHuiQianRenIDs))
                        {
                            arrErr.Add("会签人不能为空!");
                        }
                    }
                    if (entity.SubmitAction == "提交签发")
                    {
                        if (string.IsNullOrEmpty(wfHeGaoRenID.Text) == false)
                        {
                            arrErr.Add("请先清空核稿人后再提交签发!");
                        }
                        if (string.IsNullOrEmpty(wfHuiQianRenIDs.Text) == false)
                        {
                            arrErr.Add("请先清空会签人后再提交签发!");
                        }
                        if (string.IsNullOrEmpty(entity.wfQianFaRenID))
                        {
                            arrErr.Add("签发人不能为空!");
                        }
                    }
                    if (string.IsNullOrEmpty(entity.wfFaQiRenID))
                    {
                        arrErr.Add("发起人不能为空!");
                    }
                    if (string.IsNullOrEmpty(entity.wfQianFaRenID))
                    {
                        arrErr.Add("签发人不能为空!");
                    }

                    break;
                #endregion

                #region 核稿
                case ProcessConstString.StepName.LetterSend.核稿:
                    if (entity.SubmitAction == "提交会签")
                    {
                        if (string.IsNullOrEmpty(entity.wfHuiQianRenIDs))
                        {
                            arrErr.Add("会签人不能为空!");
                        }
                        if (string.IsNullOrEmpty(entity.wfQianFaRenID))
                        {
                            arrErr.Add("签发人不能为空!");
                        }
                    }
                    if (entity.SubmitAction == "提交签发")
                    {
                        if (string.IsNullOrEmpty(entity.wfHuiQianRenIDs) == false)
                        {
                            arrErr.Add("请先清空会签人后再提交签发!");
                        }
                    }
                    break;
                #endregion

                #region 会签
                case ProcessConstString.StepName.LetterSend.会签:
                    if (entity.SubmitAction == "提交签发")
                    {
                        if (string.IsNullOrEmpty(entity.wfQianFaRenID))
                        {
                            arrErr.Add("签发人不能为空!");
                        }
                    }
                    break;
                #endregion

                #region 签发

                case ProcessConstString.StepName.LetterSend.签发:
                    if (entity.HanJianAdminID == "")
                    {
                        arrErr.Add("角色:函件管理员没有成员!");
                    }
                    break;
                #endregion

                #region 函件分发
                case ProcessConstString.StepName.LetterSend.函件分发:
                    if (entity.SubmitAction == "完成")
                    {
                        if (entity.pages == "")
                        {
                            arrErr.Add("页数不能为空!");
                        }
                        if (txtOurRef.Text.Trim() == "")
                        {
                            arrErr.Add("我方发文号不能为空!");
                        }
                        if (ucAttachment.UCDataList.Count == 0)
                        {
                            arrErr.Add("附件不能为空!");
                        }
                    }
                    if (entity.SubmitAction == "退回")
                    {

                    }
                    break;
                #endregion

                case ProcessConstString.StepName.LetterSend.二次分发:
                    entity.ourRef = txtOurRef.Text;
                    entity.DocumentNo = txtOurRef.Text;
                    break;
                default: break;
            }

            if (arrErr.Count > 0)
            {
                //JScript.ShowErrMsg(Page, arrErr);
                string strMessages = string.Empty;
                if (arrErr.Count > 0)
                {
                    for (int i = 0; i < arrErr.Count; i++)
                    {
                        if (i == 0)
                        {
                            strMessages = arrErr[i];
                        }
                        else
                        {
                            strMessages += "\\n" + arrErr[i];
                        }
                    }
                }
                JScript.Alert(strMessages, false);
                return false;
            }
            return true;
        }
        public void SetPrintBeginExport(UC_Print ucPrint, EntityLetterSend cEntity)
        {
            switch (ucPrint.FileName)
            {
                case "函件发文表单":

                    ucPrint.ExportData.Add(cEntity.company1);  //<col>主送单位:|right</col>
                    ucPrint.ExportData.Add(cEntity.ourRef);    //<col>我方发文号:|right</col>
                    ucPrint.ExportData.Add(cEntity.to);       //<col>主送人:|right</col>
                    ucPrint.ExportData.Add(cEntity.yourRef);   //<col>对方发文号:|right</col>

                    ucPrint.ExportData.Add(cEntity.ccCompany); //<col>抄送单位:|right</col>
                    ucPrint.ExportData.Add(cEntity.ccDept + "\r\n" + cEntity.ccLeader);   //<col>内部抄送:|right</col>
                    ucPrint.ExportData.Add(cEntity.pages);     //<col>页数:|right</col>

                    //string str = string.Empty;

                    //System.Drawing.Font font = new Font("Wingdings 2", 10);

                    //if (cEntity.jinJi)
                    //{
                    //    //str = "紧急";
                    //    //ucPrint.FontStyle.FontName = "Wingdings 2";
                    //    //str += (char)0x0052;
                    //    //ucPrint.FontStyle.FontName = "仿宋";
                    //}
                    //else
                    //{
                    //    str = "紧急□";
                    //}
                    //ucPrint.ExportData.Add(str);
                    //if (cEntity.huiZhi)
                    //{
                    //    //str = "回复";
                    //    //ucPrint.FontStyle.FontName = "Wingdings 2";
                    //    //str += (char)0x0052;
                    //    //ucPrint.FontStyle.FontName = "仿宋";
                    //}
                    //else
                    //{
                    //    str = "回复□";
                    //}
                    //ucPrint.ExportData.Add(str);
                    if (ucPrint.IsCN(cEntity.signDate) == true)
                        ucPrint.ExportData.Add(cEntity.signDate);           //<col>签发/日期:|right</col>
                    else
                        ucPrint.ExportData.Add(cEntity.qianFaRen+"\n"+ucPrint.CheckDateTime(cEntity.signDate));

                    ucPrint.ExportData.Add(cEntity.DocumentTitle);            ////<col>主题:|right</col>//.subject
                    //string tmp = cEntity.content.Replace("<br/>", "\r\n");  //<col>内容|shift</col>
                    //tmp = tmp.Replace("&nbsp", " ");
                    //tmp = tmp.Replace("&lt", "<");
                    //tmp = tmp.Replace("&gt", ">");
                    //tmp = tmp.Replace("&quot", "\"");
                    //string tmp = SysString.HtmlToTextCode(cEntity.content);
                    string tmp = cEntity.content;//renjinquan+
                    if (!string.IsNullOrEmpty(tmp))
                    {
                        ucPrint.ExportData.Add(tmp);
                    }
                    else
                    {
                        ucPrint.ExportData.Add("");
                    }
                    ucPrint.ExportData.Add(cEntity.Drafter + "\n" + ucPrint.CheckDateTime(cEntity.DraftDate.ToString()));       //<col>拟稿/日期:|right</col>

                    if (ucPrint.IsCN(cEntity.heGaoRenDate)==false)
                        ucPrint.ExportData.Add(cEntity.heGaoRen+"\n"+ ucPrint.CheckDateTime(cEntity.heGaoRenDate));       //<col>核稿/日期:|right</col>
                    else
                        ucPrint.ExportData.Add(ucPrint.CheckDateTime(cEntity.heGaoRenDate));
                    string result1 = FormatSplit(EntityToHuiQian(cEntity), new char[] { ';' });
                    result1 = FormatSplit(result1, new char[] { ' ' });
                    ucPrint.ExportData.Add(result1);                   //<col>会签/日期:|right</col>
                    //ucPrint.ExportData.Add(ucPrint.AttachFilesList(cEntity.FileList));                   //<col>附件:|down</col>

                    //ucPrint.AttachFileList = cEntity.FileList;
                    ucPrint.Position = "拟稿/日期:";
                    ucPrint.Mode = WriteMode.Up;
                    break;
            }
        }
        public int SaveNewList(string UCProcessType, string workItemID, List <CFuJian> newList, string TBID)
        {
            if (workItemID == "" && TBID == "")
            {
                return(1);
            }
            string tableName = TableName.GetWorkItemsTableName(UCProcessType);

            DataTable dt = new DataTable();

            if (workItemID != "")
            {
                string sql = string.Format("SELECT FormsData FROM {0} WHERE WorkItemID='{1}'", tableName, workItemID);
                dt = SQLHelper.GetDataTable1(sql);
            }
            else
            {
                string sql = string.Format("SELECT FormsData FROM {0} WHERE ID='{1}'", tableName, TBID);
                dt = SQLHelper.GetDataTable1(sql);
            }

            if (dt.Rows.Count > 0)
            {
                string xml    = dt.Rows[0][0].ToString();
                string newXml = "";
                if (UCProcessType.Contains("新版"))
                {
                    UCProcessType = UCProcessType.Substring(2);
                }
                switch (UCProcessType)
                {
                    #region 获得新实体
                    #region 发文
                    //case "公司发文":
                    //    EntitySend entity1 = XmlUtility.DeSerializeXml<EntitySend>(xml);
                    //    if (entity1 != null)
                    //    {
                    //        entity1.FileList = newList;

                    //        newXml = XmlUtility.SerializeXml<EntitySend>(entity1);
                    //    }
                    //    break;
                    //case "党委发文":
                    //    EntitySend entity2 = XmlUtility.DeSerializeXml<EntitySend>(xml);
                    //    if (entity2 != null)
                    //    {
                    //        entity2.FileList = newList;
                    //        newXml = XmlUtility.SerializeXml<EntitySend>(entity2);
                    //    }
                    //    break;
                    //case "工会发文":
                    //    EntitySend entity3 = XmlUtility.DeSerializeXml<EntitySend>(xml);
                    //    if (entity3 != null)
                    //    {
                    //        entity3.FileList = newList;
                    //        newXml = XmlUtility.SerializeXml<EntitySend>(entity3);
                    //    }
                    //    break;
                    //case "纪委发文":
                    //    EntitySend entity4 = XmlUtility.DeSerializeXml<EntitySend>(xml);
                    //    if (entity4 != null)
                    //    {
                    //        entity4.FileList = newList;
                    //        newXml = XmlUtility.SerializeXml<EntitySend>(entity4);
                    //    }
                    //    break;
                    //case "团委发文":
                    //    M_TWF_WorkItems entity5 = XmlUtility.DeSerializeXml<M_TWF_WorkItems>(xml);
                    //    if (entity5 != null)
                    //    {
                    //        entity5.FileList = newList;
                    //        newXml = XmlUtility.SerializeXml<M_TWF_WorkItems>(entity5);
                    //    }
                    //    break;
                    #endregion

                    #region 收文
                case "公司收文":
                    B_GS_WorkItems entity6 = XmlUtility.DeSerializeXml <B_GS_WorkItems>(xml);
                    if (entity6 != null)
                    {
                        entity6.FileList = newList;
                        newXml           = XmlUtility.SerializeXml <B_GS_WorkItems>(entity6);
                    }
                    break;
                    //case "工会收文":
                    //    B_GHS_WorkItems entity7 = XmlUtility.DeSerializeXml<B_GHS_WorkItems>(xml);
                    //    if (entity7 != null)
                    //    {
                    //        entity7.FileList = newList;
                    //        newXml = XmlUtility.SerializeXml<B_GHS_WorkItems>(entity7);
                    //    }
                    //    break;
                    //case "团委收文":
                    //    B_TWS_WorkItems entity8 = XmlUtility.DeSerializeXml<B_TWS_WorkItems>(xml);
                    //    if (entity8 != null)
                    //    {
                    //        entity8.FileList = newList;
                    //        newXml = XmlUtility.SerializeXml<B_TWS_WorkItems>(entity8);
                    //    }
                    //    break;
                    //case "党委纪委收文":
                    //    B_DJS_WorkItems entity9 = XmlUtility.DeSerializeXml<B_DJS_WorkItems>(xml);
                    //    if (entity9 != null)
                    //    {
                    //        entity9.FileList = newList;
                    //        newXml = XmlUtility.SerializeXml<B_DJS_WorkItems>(entity9);
                    //    }
                    break;
                    #endregion

                case "工作联系单":
                    B_WorkRelation entity10 = XmlUtility.DeSerializeXml <B_WorkRelation>(xml);
                    if (entity10 != null)
                    {
                        entity10.FileList = newList;
                        newXml            = XmlUtility.SerializeXml <B_WorkRelation>(entity10);
                    }
                    break;

                //case "请示报告":
                //    B_RequestReport entity11 = XmlUtility.DeSerializeXml<B_RequestReport>(xml);
                //    if (entity11 != null)
                //    {
                //        entity11.FileList = newList;
                //        newXml = XmlUtility.SerializeXml<B_RequestReport>(entity11);
                //    }
                //    break;
                //case "程序文件":
                //    B_PF entity12 = XmlUtility.DeSerializeXml<B_PF>(xml);
                //    if (entity12 != null)
                //    {
                //        entity12.FileList = newList;
                //        newXml = XmlUtility.SerializeXml<B_PF>(entity12);
                //    }
                //    break;
                case "函件发文":
                    EntityLetterSend entity13 = XmlUtility.DeSerializeXml <EntityLetterSend>(xml);
                    if (entity13 != null)
                    {
                        entity13.FileList = newList;
                        newXml            = XmlUtility.SerializeXml <EntityLetterSend>(entity13);
                    }
                    break;

                //case "函件收文":
                //    B_LetterReceive entity14 = XmlUtility.DeSerializeXml<B_LetterReceive>(xml);
                //    if (entity14 != null)
                //    {
                //        entity14.FileList = newList;
                //        newXml = XmlUtility.SerializeXml<B_LetterReceive>(entity14);
                //    }
                //    break;
                default: newXml = ""; break;
                    #endregion
                }
                if (newXml != "")
                {
                    //更新新实体
                    int ret = UpdateNewFormsData(tableName, workItemID, newXml, TBID);
                    return(ret);
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                //throw new Exception(UCProcessType + workItemID + tableName + "未找到对应的记录!");
                return(1);
            }
        }
        public void SetPrintBeginExport(UC_Print ucPrint, EntityLetterSend cEntity)
        {
            switch (ucPrint.FileName)
            {
            case "函件发文表单":

                ucPrint.ExportData.Add(cEntity.company1);                           //<col>主送单位:|right</col>
                ucPrint.ExportData.Add(cEntity.ourRef);                             //<col>我方发文号:|right</col>
                ucPrint.ExportData.Add(cEntity.to);                                 //<col>主送人:|right</col>
                ucPrint.ExportData.Add(cEntity.yourRef);                            //<col>对方发文号:|right</col>

                ucPrint.ExportData.Add(cEntity.ccCompany);                          //<col>抄送单位:|right</col>
                ucPrint.ExportData.Add(cEntity.ccDept + "\r\n" + cEntity.ccLeader); //<col>内部抄送:|right</col>
                ucPrint.ExportData.Add(cEntity.pages);                              //<col>页数:|right</col>

                //string str = string.Empty;

                //System.Drawing.Font font = new Font("Wingdings 2", 10);

                //if (cEntity.jinJi)
                //{
                //    //str = "紧急";
                //    //ucPrint.FontStyle.FontName = "Wingdings 2";
                //    //str += (char)0x0052;
                //    //ucPrint.FontStyle.FontName = "仿宋";
                //}
                //else
                //{
                //    str = "紧急□";
                //}
                //ucPrint.ExportData.Add(str);
                //if (cEntity.huiZhi)
                //{
                //    //str = "回复";
                //    //ucPrint.FontStyle.FontName = "Wingdings 2";
                //    //str += (char)0x0052;
                //    //ucPrint.FontStyle.FontName = "仿宋";
                //}
                //else
                //{
                //    str = "回复□";
                //}
                //ucPrint.ExportData.Add(str);
                if (ucPrint.IsCN(cEntity.signDate) == true)
                {
                    ucPrint.ExportData.Add(cEntity.signDate);               //<col>签发/日期:|right</col>
                }
                else
                {
                    ucPrint.ExportData.Add(cEntity.qianFaRen + "\n" + ucPrint.CheckDateTime(cEntity.signDate));
                }

                ucPrint.ExportData.Add(cEntity.DocumentTitle);                ////<col>主题:|right</col>//.subject
                //string tmp = cEntity.content.Replace("<br/>", "\r\n");  //<col>内容|shift</col>
                //tmp = tmp.Replace("&nbsp", " ");
                //tmp = tmp.Replace("&lt", "<");
                //tmp = tmp.Replace("&gt", ">");
                //tmp = tmp.Replace("&quot", "\"");
                //string tmp = SysString.HtmlToTextCode(cEntity.content);
                string tmp = cEntity.content;    //renjinquan+
                if (!string.IsNullOrEmpty(tmp))
                {
                    ucPrint.ExportData.Add(tmp);
                }
                else
                {
                    ucPrint.ExportData.Add("");
                }
                ucPrint.ExportData.Add(cEntity.Drafter + "\n" + ucPrint.CheckDateTime(cEntity.DraftDate.ToString()));           //<col>拟稿/日期:|right</col>

                if (ucPrint.IsCN(cEntity.heGaoRenDate) == false)
                {
                    ucPrint.ExportData.Add(cEntity.heGaoRen + "\n" + ucPrint.CheckDateTime(cEntity.heGaoRenDate));        //<col>核稿/日期:|right</col>
                }
                else
                {
                    ucPrint.ExportData.Add(ucPrint.CheckDateTime(cEntity.heGaoRenDate));
                }
                string result1 = FormatSplit(EntityToHuiQian(cEntity), new char[] { ';' });
                result1 = FormatSplit(result1, new char[] { ' ' });
                ucPrint.ExportData.Add(result1);                       //<col>会签/日期:|right</col>
                //ucPrint.ExportData.Add(ucPrint.AttachFilesList(cEntity.FileList));                   //<col>附件:|down</col>

                //ucPrint.AttachFileList = cEntity.FileList;
                ucPrint.Position = "拟稿/日期:";
                ucPrint.Mode     = WriteMode.Up;
                break;
            }
        }
        private string GetCYNames(EntityLetterSend entity)
        {
            string chuanYueIDs = "";
            if (entity.ccLeaderIDs != "")
            {
                chuanYueIDs += entity.ccLeaderIDs + ";";
            }
            if (entity.deptLeaderIDs != "") //旧版才有
            {
                chuanYueIDs += entity.deptLeaderIDs + ";";
            }
            if (entity.DrafterID != "") // 发起人
            {
                chuanYueIDs += entity.DrafterID + ";";
            }
            if (entity.wfHeGaoRenID != "") //核稿人
            {
                chuanYueIDs += entity.wfHeGaoRenID + ";";
            }
            if (entity.wfHuiQianRenIDs != "") //会签人
            {
                chuanYueIDs += entity.wfHuiQianRenIDs + ";";
            }
            if (entity.wfQianFaRenID != "") //签发人
            {
                chuanYueIDs += entity.wfQianFaRenID + ";";
            }

            return chuanYueIDs;
        }