private void Validate(Model.ExportSendMail mPCExpANSI)
 {
     if (string.IsNullOrEmpty(mPCExpANSI.ExportSendMailId))
     {
         throw new Helper.RequireValueException(Model.ExportSendMail.PRO_ExportSendMailId);
     }
 }
Example #2
0
 protected override void MovePrev()
 {
     Model.ExportSendMail esm = this._ESMManager.GetPrev(this._ESM);
     if (esm == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._ESM = esm;
 }
Example #3
0
        protected override void AddNew()
        {
            this._ESM = new Book.Model.ExportSendMail();
            this._ESM.ExportSendMailId   = this._ESMManager.GetId();
            this._ESM.SenderMail         = this._DefSenderAddress;
            this._ESM.ExportSendMailDate = DateTime.Now;

            //清除原有
            this._pcExport = null;
            this._mailAccessorList.Clear();
            this.gridControl1.RefreshDataSource();
        }
        public void Insert(Model.ExportSendMail exportSendMail)
        {
            Validate(exportSendMail);
            try
            {
                BL.V.BeginTransaction();

                exportSendMail.InsertTime = DateTime.Now;
                exportSendMail.UpdateTime = DateTime.Now;
                TiGuiExists(exportSendMail);


                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, exportSendMail.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, exportSendMail.InsertTime.Value.Year, exportSendMail.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, exportSendMail.InsertTime.Value.ToString("yyyy-MM-dd"));
                string sequencekey   = string.Format(invoiceKind);
                SequenceManager.Increment(sequencekey_y);
                SequenceManager.Increment(sequencekey_m);
                SequenceManager.Increment(sequencekey_d);
                SequenceManager.Increment(sequencekey);

                accessor.Insert(exportSendMail);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }

            //操作附件
            if (!string.IsNullOrEmpty(exportSendMail.AccessoriesList))
            {
                string sfdir = this.ServerSavePath + "\\" + exportSendMail.ExportSendMailId;
                try
                {
                    System.IO.Directory.CreateDirectory(sfdir);
                }
                catch (Exception ex)
                { throw new Helper.MessageValueException(ex.Message); }
                foreach (string fn in exportSendMail.AccessoriesList.Split('|'))
                {
                    if (!fn.Contains(this.ServerSavePath))
                    {
                        System.IO.File.Copy(fn, sfdir + "\\" + fn.Substring(fn.LastIndexOf("\\") + 1), true);
                    }
                }
            }
        }
Example #5
0
        private void barBtn_Search_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SendMailList f = new SendMailList();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.ExportSendMail mESM = f.SelectItem as Model.ExportSendMail;
                if (mESM != null)
                {
                    this._ESM = mESM;
                    this.Refresh();
                }
            }
            f.Dispose();
            GC.Collect();
        }
 private void TiGuiExists(Model.ExportSendMail model)
 {
     if (this.ExistsPrimary(model.ExportSendMailId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));
         string sequencekey   = string.Format(invoiceKind);
         SequenceManager.Increment(sequencekey_y);
         SequenceManager.Increment(sequencekey_m);
         SequenceManager.Increment(sequencekey_d);
         SequenceManager.Increment(sequencekey);
         model.ExportSendMailId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
     }
 }
Example #7
0
        protected override void Delete()
        {
            if (this._ESM == null)
            {
                return;
            }
            if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
            {
                return;
            }
            this._ESMManager.Delete(this._ESM.ExportSendMailId);

            this._ESM = this._ESMManager.GetNext(this._ESM);

            if (this._ESM == null)
            {
                this._ESM = this._ESMManager.GetLast();
            }
        }
Example #8
0
 protected override void MoveLast()
 {
     this._ESM = this._ESMManager.GetLast();
 }
Example #9
0
 public bool HasRowsAfter(Model.ExportSendMail e)
 {
     return(accessor.HasRowsAfter(e));
 }
Example #10
0
 public Model.ExportSendMail GetNext(Model.ExportSendMail e)
 {
     return(sqlmapper.QueryForObject <Model.ExportSendMail>("ExportSendMail.get_next", e));
 }
Example #11
0
 public bool HasRowsAfter(Model.ExportSendMail e)
 {
     return(sqlmapper.QueryForObject <bool>("ExportSendMail.has_rows_after", e));
 }
Example #12
0
 public bool HasRowsBefore(Model.ExportSendMail e)
 {
     return(sqlmapper.QueryForObject <bool>("ExportSendMail.has_rows_before", e));
 }
Example #13
0
 public void Update(Model.ExportSendMail e)
 {
     this.Update <Model.ExportSendMail>(e);
 }
Example #14
0
 public void Insert(Model.ExportSendMail e)
 {
     this.Insert <Model.ExportSendMail>(e);
 }
Example #15
0
 public Model.ExportSendMail GetNext(Model.ExportSendMail e)
 {
     return(accessor.GetNext(e));
 }
Example #16
0
 public Model.ExportSendMail GetPrev(Model.ExportSendMail e)
 {
     return(accessor.GetPrev(e));
 }
Example #17
0
 public Model.ExportSendMail GetPrev(Model.ExportSendMail e)
 {
     return(sqlmapper.QueryForObject <Model.ExportSendMail>("ExportSendMail.get_prev", e));
 }
Example #18
0
 protected override void MoveFirst()
 {
     this._ESM = this._ESMManager.GetFirst();
 }
        public void Update(Model.ExportSendMail exportSendMail)
        {
            if (exportSendMail != null)
            {
                Validate(exportSendMail);

                exportSendMail.UpdateTime = DateTime.Now;
                accessor.Update(exportSendMail);

                //上传修改文件
                string sfdir = this.ServerSavePath + "\\" + exportSendMail.ExportSendMailId;
                if (!System.IO.Directory.Exists(sfdir))
                {
                    System.IO.Directory.CreateDirectory(sfdir);
                }

                string[] newfilenames = exportSendMail.AccessoriesList.Split('|'); //上传而来
                string[] hasfilenames = System.IO.Directory.GetFiles(sfdir);       //原本有的

                //--添加新附件
                if (!string.IsNullOrEmpty(exportSendMail.AccessoriesList))
                {
                    foreach (string newfile in newfilenames)
                    {
                        if (newfile.Contains(this.ServerSavePath))
                        {
                            continue;
                        }
                        bool flag = true;
                        foreach (string hasfile in hasfilenames)
                        {
                            //if (hasfile.Equals(newfile.Substring(newfile.LastIndexOf("\\") + 1), StringComparison.OrdinalIgnoreCase))
                            if (hasfile.Equals(newfile, StringComparison.OrdinalIgnoreCase))
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (flag && newfile != "")
                        {
                            System.IO.File.Copy(newfile, sfdir + "\\" + newfile.Substring(newfile.LastIndexOf("\\") + 1), true);
                        }
                    }
                }

                //删除旧附件
                foreach (string hasfile in hasfilenames)
                {
                    //if (hasfile.Contains(this.ServerSavePath))
                    //    continue;
                    bool flag = true;
                    foreach (string newfile in newfilenames)
                    {
                        string IstrueName = newfile.Substring(newfile.LastIndexOf("\\") + 1);
                        if (IstrueName.Equals(hasfile.Substring(hasfile.LastIndexOf("\\") + 1), StringComparison.OrdinalIgnoreCase))
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        System.IO.File.Delete(hasfile);
                    }
                }
            }
        }
Example #20
0
 public bool HasRowsBefore(Model.ExportSendMail e)
 {
     return(accessor.HasRowsBefore(e));
 }