/// <summary> /// Delete ProduceOtherExitDetail by header. /// </summary> public void Delete(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { // // todo:add other logic here // accessor.Delete(produceOtherExitMaterial); }
private void Validate(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { //if (string.IsNullOrEmpty(produceOtherExitMaterial.ProduceOtherExitMaterialId)) //{ // throw new Helper.RequireValueException(Model.ProduceOtherExitMaterial.PRO_ProduceOtherExitMaterialId); //} if (produceOtherExitMaterial.Depot == null) { throw new Helper.RequireValueException(Model.ProduceOtherExitMaterial.PRO_DepotId); } //if (string.IsNullOrEmpty(produceOtherExitMaterial.WorkHouseId)) //{ // throw new Helper.RequireValueException(Model.ProduceOtherExitMaterial.PROPERTY_WORKHOUSEID); //} foreach (Model.ProduceOtherExitDetail produceOtherExitDetail in produceOtherExitMaterial.Details) { if (produceOtherExitDetail.Product == null || string.IsNullOrEmpty(produceOtherExitDetail.Product.ProductId)) { continue; } if (produceOtherExitDetail.DepotPositionId == null) { throw new Helper.RequireValueException(Model.ProduceOtherExitDetail.PRO_DepotPositionId); } } }
public EditForm(Model.ProduceOtherExitMaterial produceOtherExitMaterial, string action) : this() { this.produceOtherExitMaterial = produceOtherExitMaterial; this.produceOtherExitMaterial.Details = this.produceOtherExitDetailManager.Select(produceOtherExitMaterial); this.action = action; }
/// <summary> /// Insert a ProduceOtherExitMaterial. /// </summary> public void Insert(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { // // todo:add other logic here // Validate(produceOtherExitMaterial); try { BL.V.BeginTransaction(); produceOtherExitMaterial.InsertTime = DateTime.Now; TiGuiExists(produceOtherExitMaterial); string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, produceOtherExitMaterial.InsertTime.Value.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, produceOtherExitMaterial.InsertTime.Value.Year, produceOtherExitMaterial.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, produceOtherExitMaterial.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(produceOtherExitMaterial); addDetail(produceOtherExitMaterial); BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
protected override void MoveLast() { // if (produceOtherExitMaterial == null) { this.produceOtherExitMaterial = this.produceOtherExitMaterialManager.Get(this.produceOtherExitMaterialManager.GetLast() == null ? "" : this.produceOtherExitMaterialManager.GetLast().ProduceOtherExitMaterialId); } }
public EditForm(Model.ProduceOtherExitMaterial produceOtherExitMaterial) : this() { this.produceOtherExitMaterial = produceOtherExitMaterial; this.produceOtherExitMaterial.Details = this.produceOtherExitDetailManager.Select(produceOtherExitMaterial); this.action = "update"; this.flag = 1; }
protected override void MoveLast() { if (this.flag == 1) { this.flag = 0; return; } this.produceOtherExitMaterial = this.produceOtherExitMaterialManager.Get(this.produceOtherExitMaterialManager.GetLast() == null ? "" : this.produceOtherExitMaterialManager.GetLast().ProduceOtherExitMaterialId); }
protected override void MovePrev() { Model.ProduceOtherExitMaterial produceOtherExitMaterial = this.produceOtherExitMaterialManager.GetPrev(this.produceOtherExitMaterial); if (produceOtherExitMaterial == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.produceOtherExitMaterial = this.produceOtherExitMaterialManager.Get(produceOtherExitMaterial.ProduceOtherExitMaterialId); }
public override void Refresh() { if (this.produceOtherExitMaterial == null) { this.AddNew(); this.action = "insert"; } else { if (this.action == "view") { this.produceOtherExitMaterial = this.produceOtherExitMaterialManager.GetDetails(produceOtherExitMaterial.ProduceOtherExitMaterialId); } } this.newChooseContorlSipu.EditValue = this.produceOtherExitMaterial.Supplier; this.textEditProduceOtherExitMaterialId.Text = this.produceOtherExitMaterial.ProduceOtherExitMaterialId; this.textEditProduceOtherExitMaterialDesc.Text = this.produceOtherExitMaterial.ProduceOtherExitMaterialDesc; //this.newChooseWorkHorseId.EditValue = this.produceOtherExitMaterial.WorkHouse; if (global::Helper.DateTimeParse.DateTimeEquls(this.produceOtherExitMaterial.ProduceOtherExitMaterialDate, global::Helper.DateTimeParse.NullDate)) { this.dateEditProduceOtherExitMaterialDate.EditValue = null; } else { this.dateEditProduceOtherExitMaterialDate.EditValue = this.produceOtherExitMaterial.ProduceOtherExitMaterialDate; } this.newChooseEmployee0.EditValue = this.produceOtherExitMaterial.Employee0; this.newChooseEmployee1.EditValue = this.produceOtherExitMaterial.Employee1; this.newChooseContorlDepot.EditValue = this.produceOtherExitMaterial.Depot; this.textEditCompact.EditValue = this.produceOtherExitMaterial.ProduceOtherCompactId; this.textEditCusXOId.EditValue = this.produceOtherExitMaterial.InvoiceCusId; this.bindingSourceDetails.DataSource = this.produceOtherExitMaterial.Details; this.EmpAudit.EditValue = this.produceOtherExitMaterial.AuditEmp; this.textEditAuditState.Text = this.GetAuditName(this.produceOtherExitMaterial.AuditState); base.Refresh(); this.newChooseEmployee0.Enabled = false; switch (this.action) { case "insert": case "update": this.barButtonItem1.Enabled = true; this.gridView1.OptionsBehavior.Editable = true; break; case "view": this.barButtonItem1.Enabled = false; this.gridView1.OptionsBehavior.Editable = false; break; } this.textEditProduceOtherExitMaterialId.Properties.ReadOnly = true; }
private void cancelAffect(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { foreach (Model.ProduceOtherExitDetail oldDetail in produceOtherExitMaterial.Details) { if (oldDetail.Product == null || oldDetail.Product.ProductId == null) { continue; } oldDetail.DepotPosition = depotPositionAccessor.Get(oldDetail.DepotPositionId); stockAccessor.Decrement(oldDetail.DepotPosition, oldDetail.Product, oldDetail.ProduceQuantity); } }
/// <summary> /// Delete ProduceOtherExitMaterial by primary key. /// </summary> public void Delete(string produceOtherExitMaterialId) { // // todo:add other logic here // Model.ProduceOtherExitMaterial model = this.Get(produceOtherExitMaterialId); string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd")); SequenceManager.Decrement(sequencekey_d); accessor.Delete(produceOtherExitMaterialId); }
private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ListForm form = new ListForm(); if (form.ShowDialog(this) == DialogResult.OK) { Model.ProduceOtherExitMaterial currentModel = form.SelectItem as Model.ProduceOtherExitMaterial; if (currentModel != null) { this.produceOtherExitMaterial = currentModel; this.produceOtherExitMaterial = this.produceOtherExitMaterialManager.Get(this.produceOtherExitMaterial.ProduceOtherExitMaterialId); this.Refresh(); } } form.Dispose(); GC.Collect(); }
protected override void Delete() { if (this.produceOtherExitMaterial == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) { return; } this.produceOtherExitMaterialManager.Delete(this.produceOtherExitMaterial); this.produceOtherExitMaterial = this.produceOtherExitMaterialManager.GetNext(this.produceOtherExitMaterial); if (this.produceOtherExitMaterial == null) { this.produceOtherExitMaterial = this.produceOtherExitMaterialManager.GetLast(); } }
private void addDetail(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { foreach (Model.ProduceOtherExitDetail produceOtherExitDetail in produceOtherExitMaterial.Details) { if (produceOtherExitDetail.Product == null || string.IsNullOrEmpty(produceOtherExitDetail.Product.ProductId) || produceOtherExitDetail.ProduceQuantity == 0) { continue; } produceOtherExitDetail.ProduceOtherExitMaterialId = produceOtherExitMaterial.ProduceOtherExitMaterialId; ProduceOtherExitDetailAccessor.Insert(produceOtherExitDetail); // Model.Stock temp = stockAccessor.GetStockByProductIdAndDepotPositionId(produceOtherExitDetail.ProductId, produceOtherExitDetail.DepotPositionId); //if (temp!=null&&temp.StockQuantity1 < produceOtherExitDetail.ProduceQuantity) // throw new Helper.MessageValueException("出庫數量大於庫存!"); stockAccessor.Increment(depotPositionAccessor.Get(produceOtherExitDetail.DepotPositionId), produceOtherExitDetail.Product, produceOtherExitDetail.ProduceQuantity); productAccessor.UpdateProduct_Stock(produceOtherExitDetail.Product); } }
public RO(string produceOtherExitMaterialId) { InitializeComponent(); this.produceOtherExitMaterial = this.produceOtherExitMaterialManager.Get(produceOtherExitMaterialId); if (this.produceOtherExitMaterial == null) { return; } this.produceOtherExitMaterial.Details = this.produceOtherExitDetailManager.Select(this.produceOtherExitMaterial); this.DataSource = this.produceOtherExitMaterial.Details; //CompanyInfo this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName; this.xrLabelDataName.Text = Properties.Resources.ProduceOtherExitDetail; this.xrLabelPrintDate.Text += DateTime.Now.ToString("yyyy-MM-dd"); //外包退料 this.xrLabelProduceOtherExitMaterialId.Text = this.produceOtherExitMaterial.ProduceOtherExitMaterialId; this.xrLabelProduceOtherExitMaterialDate.Text = this.produceOtherExitMaterial.ProduceOtherExitMaterialDate.Value.ToString("yyyy-MM-dd"); this.xrLabelCompact.Text = this.produceOtherExitMaterial.ProduceOtherCompactId; if (this.produceOtherExitMaterial.Employee0 != null) { this.xrLabelEmployee0.Text = this.produceOtherExitMaterial.Employee0.EmployeeName; } if (this.produceOtherExitMaterial.Supplier != null) { this.xrLabelDepartment.Text = this.produceOtherExitMaterial.Supplier.ToString(); } this.xrLabelProduceOtherMaterialDesc.Text = this.produceOtherExitMaterial.ProduceOtherExitMaterialDesc; //if (this.produceOtherExitMaterial.ProduceOtherCompactId != null) //{ // Model.ProduceOtherCompact produceOtherCompact = produceOtherCompactManager.Get(this.produceOtherExitMaterial.ProduceOtherCompactId); // if (produceOtherCompact != null) // this.xrLabelCusXOId.Text = produceOtherCompact.CustomerInvoiceXOId; //} //明细 this.xrLabelCusXOId.Text = this.produceOtherExitMaterial.InvoiceCusId; this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName); this.xrTableCellOtherMaterialQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherExitDetail.PRO_ProduceQuantity); this.xrTableUnit.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherExitDetail.PRO_ProductUnit); this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_ProductDescription); }
private void TiGuiExists(Model.ProduceOtherExitMaterial model) { if (this.ExistsPrimary(model.ProduceOtherExitMaterialId)) { //设置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.ProduceOtherExitMaterialId = this.GetId(model.InsertTime.Value); TiGuiExists(model); //throw new Helper.InvalidValueException(Model.Product.PRO_Id); } }
/// <summary> /// Update a ProduceOtherExitMaterial. /// </summary> public void Update(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { // // todo: add other logic here. // Validate(produceOtherExitMaterial); try { BL.V.BeginTransaction(); produceOtherExitMaterial.UpdateTime = DateTime.Now; accessor.Update(produceOtherExitMaterial); Model.ProduceOtherExitMaterial oldModel = this.GetDetails(produceOtherExitMaterial.ProduceOtherExitMaterialId); cancelAffect(oldModel); ProduceOtherExitDetailAccessor.Delete(produceOtherExitMaterial); this.addDetail(produceOtherExitMaterial); BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
protected override void AddNew() { this.bindingSourceDepotPositionId.DataSource = null; this.produceOtherExitMaterial = new Model.ProduceOtherExitMaterial(); this.produceOtherExitMaterial.ProduceOtherExitMaterialDate = DateTime.Now; this.produceOtherExitMaterial.Employee0 = BL.V.ActiveOperator.Employee; this.produceOtherExitMaterial.ProduceOtherExitMaterialId = this.produceOtherExitMaterialManager.GetId();// Guid.NewGuid().ToString(); this.produceOtherExitMaterial.Details = new List <Model.ProduceOtherExitDetail>(); if (this.action == "insert") { Model.ProduceOtherExitDetail detail = new Model.ProduceOtherExitDetail(); detail.ProduceOtherExitDetailId = Guid.NewGuid().ToString(); detail.ProduceQuantity = 0; detail.ProduceAllUserQuantity = 0; detail.CriterionUserQuantity = 0; detail.ProductStock = 0; detail.ProductSpecification = ""; detail.Product = new Book.Model.Product(); this.produceOtherExitMaterial.Details.Add(detail); this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail); } }
public void Insert(Model.ProduceOtherExitMaterial e) { this.Insert <Model.ProduceOtherExitMaterial>(e); }
public IList <Book.Model.ProduceOtherExitDetail> Select(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { return(sqlmapper.QueryForList <Model.ProduceOtherExitDetail>("ProduceOtherExitDetail.select_byProduceOtherExitMaterialId", produceOtherExitMaterial.ProduceOtherExitMaterialId)); }
public void Delete(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { sqlmapper.Delete("ProduceOtherExitDetail.delete_byheader", produceOtherExitMaterial.ProduceOtherExitMaterialId); }
public IList <Book.Model.ProduceOtherExitDetail> Select(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { return(accessor.Select(produceOtherExitMaterial)); }
protected override void MoveFirst() { this.produceOtherExitMaterial = this.produceOtherExitMaterialManager.Get(this.produceOtherExitMaterialManager.GetFirst() == null ? "" : this.produceOtherExitMaterialManager.GetFirst().ProduceOtherExitMaterialId); }
public Model.ProduceOtherExitMaterial GetPrev(Model.ProduceOtherExitMaterial e) { return(sqlmapper.QueryForObject <Model.ProduceOtherExitMaterial>("ProduceOtherExitMaterial.get_prev", e)); }
public Model.ProduceOtherExitMaterial GetNext(Model.ProduceOtherExitMaterial e) { return(accessor.GetNext(e)); }
public void Delete(Model.ProduceOtherExitMaterial produceOtherExitMaterial) { cancelAffect(produceOtherExitMaterial); accessor.Delete(produceOtherExitMaterial.ProduceOtherExitMaterialId); }
public Model.ProduceOtherExitMaterial GetDetails(string produceOtherExitMaterialId) { Model.ProduceOtherExitMaterial produceOtherExitMaterial = accessor.Get(produceOtherExitMaterialId); produceOtherExitMaterial.Details = ProduceOtherExitDetailAccessor.Select(produceOtherExitMaterial); return(produceOtherExitMaterial); }
public void Update(Model.ProduceOtherExitMaterial e) { this.Update <Model.ProduceOtherExitMaterial>(e); }
public bool HasRowsAfter(Model.ProduceOtherExitMaterial e) { return(sqlmapper.QueryForObject <bool>("ProduceOtherExitMaterial.has_rows_after", e)); }
public bool HasRowsAfter(Model.ProduceOtherExitMaterial e) { return(accessor.HasRowsAfter(e)); }