private void Validate(Model.ExportSendMail mPCExpANSI) { if (string.IsNullOrEmpty(mPCExpANSI.ExportSendMailId)) { throw new Helper.RequireValueException(Model.ExportSendMail.PRO_ExportSendMailId); } }
protected override void MovePrev() { Model.ExportSendMail esm = this._ESMManager.GetPrev(this._ESM); if (esm == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._ESM = esm; }
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); } } } }
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); } }
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(); } }
protected override void MoveLast() { this._ESM = this._ESMManager.GetLast(); }
public bool HasRowsAfter(Model.ExportSendMail e) { return(accessor.HasRowsAfter(e)); }
public Model.ExportSendMail GetNext(Model.ExportSendMail e) { return(sqlmapper.QueryForObject <Model.ExportSendMail>("ExportSendMail.get_next", e)); }
public bool HasRowsAfter(Model.ExportSendMail e) { return(sqlmapper.QueryForObject <bool>("ExportSendMail.has_rows_after", e)); }
public bool HasRowsBefore(Model.ExportSendMail e) { return(sqlmapper.QueryForObject <bool>("ExportSendMail.has_rows_before", e)); }
public void Update(Model.ExportSendMail e) { this.Update <Model.ExportSendMail>(e); }
public void Insert(Model.ExportSendMail e) { this.Insert <Model.ExportSendMail>(e); }
public Model.ExportSendMail GetNext(Model.ExportSendMail e) { return(accessor.GetNext(e)); }
public Model.ExportSendMail GetPrev(Model.ExportSendMail e) { return(accessor.GetPrev(e)); }
public Model.ExportSendMail GetPrev(Model.ExportSendMail e) { return(sqlmapper.QueryForObject <Model.ExportSendMail>("ExportSendMail.get_prev", e)); }
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); } } } }
public bool HasRowsBefore(Model.ExportSendMail e) { return(accessor.HasRowsBefore(e)); }