protected override void MoveLast() { if (this.LastFlag == 1) { this.LastFlag = 0; return; } this._PCOtherCheck = this._PCOtherCM.Get(this._PCOtherCM.GetLast() == null ? "" : this._PCOtherCM.GetLast().PCOtherCheckId); }
protected override void MovePrev() { Model.PCOtherCheck mPCOC = this._PCOtherCM.GetPrev(this._PCOtherCheck); if (mPCOC == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._PCOtherCheck = this._PCOtherCM.Get(mPCOC.PCOtherCheckId); }
protected override void AddNew() { this._PCOtherCheck = new Model.PCOtherCheck(); this._PCOtherCheck.PCOtherCheckDate = DateTime.Now; this._PCOtherCheck.PCOtherCheckId = this._PCOtherCM.GetId(); //this._PCOtherCheck.Employee0 = BL.V.ActiveOperator.Employee; this._PCOtherCheck.FromPCType = -1; this._PCOtherCheck.Detail = new List <Model.PCOtherCheckDetail>(); this._PCOtherCheck.Employee0 = BL.V.ActiveOperator.Employee; }
public EditForm(Model.PCOtherCheck mPCOtherCheck, string action) : this() { this._PCOtherCheck = mPCOtherCheck; this.action = action; if (this.action == "view") { LastFlag = 1; } }
private void barBtn_Search_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ListForm lf = new ListForm(); if (lf.ShowDialog(this) == DialogResult.OK) { this._PCOtherCheck = lf.SelectItem as Model.PCOtherCheck; this.action = "view"; this.Refresh(); } }
public EditForm(Model.PCOtherCheck mPCOtherCheck) : this() { if (mPCOtherCheck == null) { throw new ArithmeticException("invoiceid"); } this._PCOtherCheck = mPCOtherCheck; this.action = "view"; if (this.action == "view") { LastFlag = 1; } }
public EditForm(string invoiceId) : this() { this._PCOtherCheck = this._PCOtherCM.GetDetails(invoiceId); if (this._PCOtherCheck == null) { throw new ArithmeticException("invoiceid"); } this.action = "view"; if (this.action == "view") { LastFlag = 1; } }
private void Validate(Model.PCOtherCheck _pcoc) { if (string.IsNullOrEmpty(_pcoc.PCOtherCheckId)) { throw new Helper.RequireValueException(Model.PCOtherCheck.PRO_PCOtherCheckId); } if (string.IsNullOrEmpty(_pcoc.PCOtherCheckDate.ToString())) { throw new Helper.RequireValueException(Model.PCOtherCheck.PRO_PCOtherCheckDate); } if (string.IsNullOrEmpty(_pcoc.Employee0Id)) { throw new Helper.RequireValueException(Model.PCOtherCheck.PRO_Employee0Id); } }
protected override void Delete() { if (this._PCOtherCM == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this._PCOtherCM.Delete(this._PCOtherCheck); this._PCOtherCheck = this._PCOtherCM.GetNext(this._PCOtherCheck); if (this._PCOtherCheck == null) { this._PCOtherCheck = this._PCOtherCM.GetLast(); } }
public void Delete(Model.PCOtherCheck model) { try { BL.V.BeginTransaction(); foreach (var item in model.Detail) { //采购单已做过进料检验的数量 if (item.PCOtherCheckDetailFromPC == "1") { Model.InvoiceCODetail codetail = this.codetailManager.Get(item.FromInvoiceDetailID); if (codetail != null) { codetail.HasCheckQuantity = Convert.ToDecimal(codetail.HasCheckQuantity) - Convert.ToDecimal(item.InQuantity); codetail.HasCheckQuantity = codetail.HasCheckQuantity < 0 ? 0 : codetail.HasCheckQuantity; this.codetailManager.Update(codetail); } } //委外合同 if (item.PCOtherCheckDetailFromPC == "0") { Model.ProduceOtherCompactDetail pocdetail = this.pocdetailManager.Get(item.FromInvoiceDetailID); if (pocdetail != null) { pocdetail.HasCheckQuantity = Convert.ToDecimal(pocdetail.HasCheckQuantity) - Convert.ToDecimal(item.InQuantity); pocdetail.HasCheckQuantity = pocdetail.HasCheckQuantity < 0 ? 0 : pocdetail.HasCheckQuantity; this.pocdetailManager.Update(pocdetail); } } } PCOtherCheckDetailAccessor.DeleteByPCOCId(model.PCOtherCheckId); this.Delete(model.PCOtherCheckId); BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public void Delete(Model.PCOtherCheck model) { try { BL.V.BeginTransaction(); PCOtherCheckDetailAccessor.DeleteByPCOCId(model.PCOtherCheckId); this.Delete(model.PCOtherCheckId); BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
/// <summary> /// Update a PCOtherCheck. /// </summary> public void Update(Model.PCOtherCheck pCOtherCheck) { Validate(pCOtherCheck); if (pCOtherCheck != null) { //修改头 pCOtherCheck.UpdateTime = DateTime.Now; accessor.Update(pCOtherCheck); //删除详细 PCOtherCheckDetailAccessor.DeleteByPCOCId(pCOtherCheck.PCOtherCheckId); //添加详细 foreach (Model.PCOtherCheckDetail details in pCOtherCheck.Detail) { details.PCOtherCheckId = pCOtherCheck.PCOtherCheckId; PCOtherCheckDetailAccessor.Insert(details); } } }
public void Delete(Model.PCOtherCheck model) { try { BL.V.BeginTransaction(); //排單狀態修改 Model.InvoiceCGDetail cgDetail; Model.ProduceOtherInDepotDetail po; foreach (var item in model.Detail) { if (item.PCOtherCheckDetailFromPC == "1") { cgDetail = cgdetailManager.Get(item.FromInvoiceDetailID); if (cgDetail != null) { cgDetail.GenerateInputCheck = ""; cgdetailManager.Update(cgDetail); } } if (item.PCOtherCheckDetailFromPC == "0") { po = podetailManager.Get(item.FromInvoiceDetailID); if (po != null) { po.GenerateInputCheck = ""; podetailManager.Update(po); } } } PCOtherCheckDetailAccessor.DeleteByPCOCId(model.PCOtherCheckId); this.Delete(model.PCOtherCheckId); BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
private void TiGuiExists(Model.PCOtherCheck model) { if (this.ExistsPrimary(model.PCOtherCheckId)) { //设置KEY值 string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.PCOtherCheckDate.Value.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.PCOtherCheckDate.Value.Year, model.PCOtherCheckDate.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.PCOtherCheckDate.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.PCOtherCheckId = this.GetId(model.PCOtherCheckDate.Value); TiGuiExists(model); //throw new Helper.InvalidValueException(Model.Product.PRO_Id); } }
/// <summary> /// Insert a PCOtherCheck. /// </summary> public void Insert(Model.PCOtherCheck pCOtherCheck) { Validate(pCOtherCheck); try { BL.V.BeginTransaction(); TiGuiExists(pCOtherCheck); pCOtherCheck.InsertTime = DateTime.Now; pCOtherCheck.UpdateTime = DateTime.Now; string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, pCOtherCheck.InsertTime.Value.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, pCOtherCheck.InsertTime.Value.Year, pCOtherCheck.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, pCOtherCheck.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(pCOtherCheck); foreach (Model.PCOtherCheckDetail PcotherCheckDetail in pCOtherCheck.Detail) { if (PcotherCheckDetail.Product == null || string.IsNullOrEmpty(PcotherCheckDetail.Product.ProductId)) { continue; } PcotherCheckDetail.PCOtherCheckId = pCOtherCheck.PCOtherCheckId; PCOtherCheckDetailAccessor.Insert(PcotherCheckDetail); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
private void Validate(Model.PCOtherCheck _pcoc) { if (string.IsNullOrEmpty(_pcoc.PCOtherCheckId)) { throw new Helper.RequireValueException(Model.PCOtherCheck.PRO_PCOtherCheckId); } if (string.IsNullOrEmpty(_pcoc.PCOtherCheckDate.ToString())) { throw new Helper.RequireValueException(Model.PCOtherCheck.PRO_PCOtherCheckDate); } if (string.IsNullOrEmpty(_pcoc.Employee0Id)) { throw new Helper.RequireValueException(Model.PCOtherCheck.PRO_Employee0Id); } foreach (var item in _pcoc.Detail) { if (item.PCOtherCheckDetailQuantity > item.InQuantity) { throw new Helper.InvalidValueException(Model.PCOtherCheckDetail.PRO_PCOtherCheckDetailQuantity); } } }
public Model.PCOtherCheck GetPrev(Model.PCOtherCheck e) { return accessor.GetPrev(e); }
public bool HasRowsBefore(Model.PCOtherCheck e) { return accessor.HasRowsBefore(e); }
public bool HasRowsAfter(Model.PCOtherCheck e) { return accessor.HasRowsAfter(e); }
public bool HasRowsAfter(Model.PCOtherCheck e) { return(sqlmapper.QueryForObject <bool>("PCOtherCheck.has_rows_after", e)); }
public bool HasRowsBefore(Model.PCOtherCheck e) { return(sqlmapper.QueryForObject <bool>("PCOtherCheck.has_rows_before", e)); }
public Model.PCOtherCheck GetDetails(string PCOtherCheckId) { Model.PCOtherCheck _Pcoc = accessor.Get(PCOtherCheckId); _Pcoc.Detail = PCOtherCheckDetailAccessor.Selct(_Pcoc); return(_Pcoc); }
public Model.PCOtherCheck GetNext(Model.PCOtherCheck e) { return(sqlmapper.QueryForObject <Model.PCOtherCheck>("PCOtherCheck.get_next", e)); }
public Model.PCOtherCheck GetPrev(Model.PCOtherCheck e) { return(sqlmapper.QueryForObject <Model.PCOtherCheck>("PCOtherCheck.get_prev", e)); }
protected override void MoveLast() { this._PCOtherCheck = this._PCOtherCM.Get(this._PCOtherCM.GetLast() == null ? "" : this._PCOtherCM.GetLast().PCOtherCheckId); }
/// <summary> /// Insert a PCOtherCheck. /// </summary> public void Insert(Model.PCOtherCheck pCOtherCheck) { Validate(pCOtherCheck); try { BL.V.BeginTransaction(); TiGuiExists(pCOtherCheck); pCOtherCheck.InsertTime = DateTime.Now; pCOtherCheck.UpdateTime = DateTime.Now; string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, pCOtherCheck.InsertTime.Value.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, pCOtherCheck.InsertTime.Value.Year, pCOtherCheck.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, pCOtherCheck.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(pCOtherCheck); Model.InvoiceCGDetail cgDetail; Model.ProduceOtherInDepotDetail po; foreach (Model.PCOtherCheckDetail PcotherCheckDetail in pCOtherCheck.Detail) { if (PcotherCheckDetail.Product == null || string.IsNullOrEmpty(PcotherCheckDetail.Product.ProductId)) { continue; } PcotherCheckDetail.PCOtherCheckId = pCOtherCheck.PCOtherCheckId; PCOtherCheckDetailAccessor.Insert(PcotherCheckDetail); //排單狀態修改 if (PcotherCheckDetail.PCOtherCheckDetailFromPC == "1") { cgDetail = cgdetailManager.Get(PcotherCheckDetail.FromInvoiceDetailID); if (cgDetail != null) { cgDetail.GenerateInputCheck = "已生成進料檢驗單"; cgdetailManager.Update(cgDetail); } } if (PcotherCheckDetail.PCOtherCheckDetailFromPC == "0") { po = podetailManager.Get(PcotherCheckDetail.FromInvoiceDetailID); if (po != null) { po.GenerateInputCheck = "已生成進料檢驗單"; podetailManager.Update(po); } } } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public Model.PCOtherCheck GetNext(Model.PCOtherCheck e) { return accessor.GetNext(e); }
/// <summary> /// Update a PCOtherCheck. /// </summary> public void Update(Model.PCOtherCheck pCOtherCheck) { Validate(pCOtherCheck); if (pCOtherCheck != null) { //修改头 pCOtherCheck.UpdateTime = DateTime.Now; accessor.Update(pCOtherCheck); IList <Model.PCOtherCheckDetail> oldDetail = PCOtherCheckDetailAccessor.Selct(pCOtherCheck); //排單狀態修改 Model.InvoiceCGDetail cgDetail; Model.ProduceOtherInDepotDetail po; foreach (var item in oldDetail) { if (item.PCOtherCheckDetailFromPC == "1") { cgDetail = cgdetailManager.Get(item.FromInvoiceDetailID); if (cgDetail != null) { cgDetail.GenerateInputCheck = ""; cgdetailManager.Update(cgDetail); } } if (item.PCOtherCheckDetailFromPC == "0") { po = podetailManager.Get(item.FromInvoiceDetailID); if (po != null) { po.GenerateInputCheck = ""; podetailManager.Update(po); } } } //删除详细 PCOtherCheckDetailAccessor.DeleteByPCOCId(pCOtherCheck.PCOtherCheckId); //添加详细 Model.InvoiceCGDetail cgDetail2; Model.ProduceOtherInDepotDetail po2; foreach (Model.PCOtherCheckDetail details in pCOtherCheck.Detail) { details.PCOtherCheckId = pCOtherCheck.PCOtherCheckId; PCOtherCheckDetailAccessor.Insert(details); //排單狀態修改 if (details.PCOtherCheckDetailFromPC == "1") { cgDetail2 = cgdetailManager.Get(details.FromInvoiceDetailID); if (cgDetail2 != null) { cgDetail2.GenerateInputCheck = "已生成進料檢驗單"; cgdetailManager.Update(cgDetail2); } } if (details.PCOtherCheckDetailFromPC == "0") { po2 = podetailManager.Get(details.FromInvoiceDetailID); if (po2 != null) { po2.GenerateInputCheck = "已生成進料檢驗單"; podetailManager.Update(po2); } } } } }
public Ro(Model.PCOtherCheck _PCOC) { InitializeComponent(); if (_PCOC == null) { return; } this.DataSource = _PCOC.Detail; //CompanyInfo this.lblCompanyInfoName.Text = BL.Settings.CompanyChineseName; this.lblDataName.Text = Properties.Resources.PCOtherCheck; this.lblPrintDate.Text += DateTime.Now.ToShortDateString(); ////Control this.lblPCOtherCheckId.Text = _PCOC.PCOtherCheckId; this.lblPCOtherCheckDate.Text = _PCOC.PCOtherCheckDate.Value.ToShortDateString(); this.lblSupplier.Text = _PCOC.Supplier == null ? "" : _PCOC.Supplier.ToString(); this.lblEmployee1.Text = _PCOC.Employee1 == null ? "" : _PCOC.Employee1.ToString(); this.lblEmployee0.Text = _PCOC.Employee0 == null ? "" : _PCOC.Employee0.ToString(); this.lblPCOtherCheckDesc.Text = _PCOC.PCOtherCheckDesc; //Detail #region ×¢ÊÍ //foreach (Model.PCOtherCheckDetail d in _PCOC.Detail) //{ // foreach (var a in d.GetType().GetProperties()) // { // if (a.Name != "") // { // switch (a.GetValue().ToString()) // { // case "0": // a.SetValue(d, "¡ð", null); ; // break; // case "1": // a.SetValue(d, "¡÷", null); // break; // case "2": // a.SetValue(d, "X", null); // break; // } // } // } //} #endregion this.xrTCPCOtherCheckDetailId.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_FromInvoiceID); this.xrTCProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName); this.xrTCProceduresId.DataBindings.Add("Text", this.DataSource, "Procedures." + Model.Procedures.PRO_Procedurename); this.RTproductDesc.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_ProductDescription); this.xrTCPCOtherCheckDetailQuantity.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_PCOtherCheckDetailQuantity); this.xrTCProductUnit.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_ProductUnit); this.xrTCPerspectiveRate.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_PerspectiveRate); this.xrTCDeliveryDate.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_DeliveryDate, "{0:yyyy-MM-dd}"); //this.xrTCOutQuantity.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_OutQuantity); this.xrTCInQuantity.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_InQuantity); this.xrTCDeterminant.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_DeterminantDis); this.xrTCPCOtherCheckDetailDesc.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_PCOtherCheckDetailDesc1); //¿Í‘ôÓ††Î¾ŽÌ– this.xrInvoiceCusXoId.DataBindings.Add("Text", this.DataSource, Model.PCOtherCheckDetail.PRO_InvoiceCusXOId); }
public override void Refresh() { if (this._PCOtherCheck == null) { this.AddNew(); this.action = "insert"; } else { if (this.action == "view") { this._PCOtherCheck = this._PCOtherCM.GetDetails(_PCOtherCheck.PCOtherCheckId); } } this.textPCOtherCheckId.Text = this._PCOtherCheck.PCOtherCheckId; if (global::Helper.DateTimeParse.DateTimeEquls(this._PCOtherCheck.PCOtherCheckDate, global::Helper.DateTimeParse.NullDate)) { this.dateEdit_PCOtherCheckDate.EditValue = null; } else { this.dateEdit_PCOtherCheckDate.EditValue = this._PCOtherCheck.PCOtherCheckDate; } //this.textInvoiceCusXOId.Text = this._PCOtherCheck.InvoiceCusXOId; this.textPCOtherCheckDesc.Text = this._PCOtherCheck.PCOtherCheckDesc; this.Ncc_Employee0.EditValue = this._PCOtherCheck.Employee0; this.Ncc_Employee1.EditValue = this._PCOtherCheck.Employee1; this.Ncc_Supplier.EditValue = this._PCOtherCheck.Supplier; this.newChooseContorlAuditEmp.EditValue = this._PCOtherCheck.AuditEmp; this.txt_AuditState.EditValue = this.GetAuditName(this._PCOtherCheck.AuditState); #region LookUpEdit DataTable dt = new DataTable(); DataColumn dc = new DataColumn("id", typeof(string)); DataColumn dc1 = new DataColumn("name", typeof(string)); dt.Columns.Add(dc); dt.Columns.Add(dc1); DataRow dr; dr = dt.NewRow(); dr[0] = "-1"; dr[1] = string.Empty; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = "0"; dr[1] = "√"; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = "1"; dr[1] = "△"; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = "2"; dr[1] = "X"; dt.Rows.Add(dr); for (int i = 0; i < this.gridView1.Columns.Count - 1; i++) { if (this.gridView1.Columns[i].ColumnEdit is DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit) { ((DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit) this.gridView1.Columns[i].ColumnEdit).DataSource = dt; ((DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit) this.gridView1.Columns[i].ColumnEdit).Columns.Clear(); ((DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit) this.gridView1.Columns[i].ColumnEdit).Columns.AddRange(new DevExpress.XtraEditors.Controls.LookUpColumnInfo[] { new DevExpress.XtraEditors.Controls.LookUpColumnInfo("name", 25, "Sign"), }); ((DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit) this.gridView1.Columns[i].ColumnEdit).DisplayMember = "name"; ((DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit) this.gridView1.Columns[i].ColumnEdit).ValueMember = "id"; } } #endregion this.bindingSourceDetails.DataSource = this._PCOtherCheck.Detail; base.Refresh(); switch (this.action) { case "insert": this.gridView1.OptionsBehavior.Editable = true; break; case "update": this.gridView1.OptionsBehavior.Editable = true; break; case "view": this.gridView1.OptionsBehavior.Editable = false; break; } this.textPCOtherCheckId.Properties.ReadOnly = true; //if (this._PCOtherCheck.FromPCType < 0) //{ // this.lcDanJuId.Text = "委外單編號:"; //} //else //{ // this.lcDanJuId.Text = "採購單編號:"; //} }