Exemplo n.º 1
0
 //选择附件,判定是否可移除
 private void bindingSource1_CurrentChanged(object sender, EventArgs e)
 {
     if (this.action != "view")
     {
         MailAccessoriesHelper mah = this.bindingSource1.Current as MailAccessoriesHelper;
         if (mah.FromExpType == "郵件本身附件")
         {
             this.btnDelAccessories.Enabled = true;
         }
         else
         {
             this.btnDelAccessories.Enabled = false;
         }
     }
 }
Exemplo n.º 2
0
        private void btnAddAccessories_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = "C:\\";  //初始化查询路径
            ofd.Multiselect      = true;
            if (ofd.ShowDialog(this) == DialogResult.OK)
            {
                foreach (string fn in ofd.FileNames)
                {
                    MailAccessoriesHelper mbh = new MailAccessoriesHelper();
                    mbh.FileFullName = fn;
                    mbh.FileName     = fn.Substring(fn.LastIndexOf("\\") + 1);
                    FileInfo fi = new FileInfo(fn);
                    mbh.FileSize    = fi.Length.ToString();
                    mbh.FromExpType = "郵件本身附件";
                    this._mailAccessorList.Add(mbh);
                }
                this.gridControl1.RefreshDataSource();
            }
        }
Exemplo n.º 3
0
        //点击附件名称,打开附件
        private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e)
        {
            MailAccessoriesHelper mah = this.bindingSource1.Current as MailAccessoriesHelper;

            System.Diagnostics.Process.Start(mah.FileFullName);
        }
Exemplo n.º 4
0
        //获得所有附件列表
        private void ConstructAccessoriesData()
        {
            this._mailAccessorList.Clear();
            string[] hasAccessories = null;     //记录已发送附件
            if (!string.IsNullOrEmpty(this._ESM.AccessoriesList))
            {
                hasAccessories = this._ESM.AccessoriesList.Split(new char[] { ';' });
            }


            if (this._pcExport != null)
            {
                IList <Model.PCExportReportANSIDetail> details = this._pcExprotANSIDetailManager.SelectByCusXoIdAndProId(this._pcExport.InvoiceCusXOId, this._pcExport.ProductId);

                #region 获得子报表附件
                if (details != null && details.Count > 0)
                {
                    foreach (Model.PCExportReportANSIDetail d in details)
                    {
                        //查看附件,通过主键路径查找,如果没有则数据为空
                        if (Directory.Exists(this._ServerSavePath + "\\" + d.PCExportReportANSIDetailId))
                        {
                            string[] filenames = Directory.GetFiles(this._ServerSavePath + "\\" + d.PCExportReportANSIDetailId);
                            foreach (string fn in filenames)
                            {
                                MailAccessoriesHelper mah = new MailAccessoriesHelper();
                                mah.FromExpType  = this.htFormName[d.FromPC].ToString();   //附件来源单据
                                mah.FileName     = fn.Substring(fn.LastIndexOf("\\") + 1); //这里直接使用文件名.不包含路径
                                mah.FileFullName = fn;
                                FileInfo fi = new FileInfo(mah.FileFullName);
                                mah.FileSize = fi.Length.ToString();
                                //判断是否选中
                                if (hasAccessories != null && hasAccessories.Length != 0)
                                {
                                    foreach (string s in hasAccessories)
                                    {
                                        if (mah.IsCheck = s.Equals(mah.FileName, StringComparison.OrdinalIgnoreCase))
                                        {
                                            break;
                                        }
                                    }
                                }
                                this._mailAccessorList.Add(mah);
                            }
                        }
                    }
                }
                #endregion
            }


            #region 获取外销报告打印附件及发送邮件本身附件
            IList <string> otherFile = new List <string>();
            if (!string.IsNullOrEmpty(this._ESM.ExportId))   //外销报告单号
            {
                otherFile.Add(this._ESM.ExportId);
            }
            if (this._ESM != null && !string.IsNullOrEmpty(this._ESM.ExportSendMailId)) //邮件附件地址
            {
                otherFile.Add(this._ESM.ExportSendMailId);
            }
            foreach (string of in otherFile)
            {
                //查看附件,通过主键路径查找,如果没有则数据为空
                if (Directory.Exists(this._ServerSavePath + "\\" + of))
                {
                    string[] filenames = Directory.GetFiles(this._ServerSavePath + "\\" + of);
                    foreach (string fn in filenames)
                    {
                        MailAccessoriesHelper mah = new MailAccessoriesHelper();
                        mah.FromExpType  = of.Contains("ESM") ? "郵件本身附件" : this._pcExport.ExpType; //附件来源单据
                        mah.FileName     = fn.Substring(fn.LastIndexOf("\\") + 1);                 //这里直接使用文件名.不包含路径
                        mah.FileFullName = fn;
                        FileInfo fi = new FileInfo(mah.FileFullName);
                        mah.FileSize = fi.Length.ToString();
                        //判断是否选中
                        if (hasAccessories != null && hasAccessories.Length != 0)
                        {
                            foreach (string s in hasAccessories)
                            {
                                if (mah.IsCheck = s.Equals(mah.FileName, StringComparison.OrdinalIgnoreCase))
                                {
                                    break;
                                }
                            }
                        }
                        this._mailAccessorList.Add(mah);
                    }
                }
            }
            #endregion

            this.bindingSource1.DataSource = this._mailAccessorList;
            this.gridControl1.RefreshDataSource();
        }
Exemplo n.º 5
0
        public override void Refresh()
        {
            if (this._ESM == null)
            {
                this.AddNew();
                this.action = "insert";
            }

            this.txtExportSendMailId.Text   = this._ESM.ExportSendMailId;
            this.txtExportId.Text           = this._ESM.ExportId;
            this.txtExportType.Text         = this._ESM.ExportType;
            this.txtExportSendMailDate.Text = this._ESM.ExportSendMailDate.HasValue ? this._ESM.ExportSendMailDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : _SendTimeOrStatus;
            this.txtMailSubject.Text        = this._ESM.MailSubject;
            this.txtMailContent.Text        = this._ESM.MailContent;
            this.txtSenderMail.Text         = this._ESM.SenderMail;
            this.txtReceiverMail.Text       = this._ESM.ReceiverMail;

            if (!string.IsNullOrEmpty(this._ESM.ExportId))
            {
                this._pcExport = new BL.PCExportReportANSIManager().Get(this._ESM.ExportId);
            }
            else
            {
                this._pcExport = null;
            }
            //获取附件列表
            this.ConstructAccessoriesData();

            base.Refresh();
            switch (this.action)
            {
            case "insert":
                this.barBtn_ChooseExp.Enabled = true;
                this.barBtn_Search.Enabled    = false;
                break;

            case "update":
                this.barBtn_ChooseExp.Enabled = true;
                this.barBtn_Search.Enabled    = false;
                break;

            case "view":
                this.barBtn_ChooseExp.Enabled = false;
                this.barBtn_Search.Enabled    = true;
                break;
            }


            this.txtExportSendMailId.Enabled   = false;
            this.txtExportSendMailDate.Enabled = false;
            this.txtExportType.Enabled         = false;
            this.txtExportId.Enabled           = false;
            this.txtSenderMail.Enabled         = false;
            this.btn_Send.Enabled = true;
            this.gridView1.OptionsBehavior.Editable = true;

            if (this.action != "view")
            {
                MailAccessoriesHelper mah = this.bindingSource1.Current as MailAccessoriesHelper;
                if (mah != null)
                {
                    if (mah.FromExpType == "郵件本身附件")
                    {
                        this.btnDelAccessories.Enabled = true;
                    }
                    else
                    {
                        this.btnDelAccessories.Enabled = false;
                    }
                }
            }
        }