public void Delete(Model.TechonlogyHeader techonlogyHeader) { // // todo:add other logic here // accessor.Delete(techonlogyHeader.TechonlogyHeaderId); }
void _update(Model.TechonlogyHeader header) { IList <string> str = new List <string>(); foreach (Model.Technologydetails tecdetail in header.detail) { if (tecdetail.TechnologydetailsNo == null) { continue; } if (str.Contains(tecdetail.TechnologydetailsNo)) { throw new Helper.RequireValueException(Model.Technologydetails.PROPERTY_TECHNOLOGYDETAILSNO); } str.Add(tecdetail.TechnologydetailsNo); } header.UpdateTime = DateTime.Now; accessor.Update(header); foreach (Model.Technologydetails detail in header.detail) { if (string.IsNullOrEmpty(detail.ProceduresId)) { continue; } //if (accessorDetails.IsExists_TechnologydetailsNo(detail)) // throw new Helper.InvalidValueException(Model.Technologydetails.PROPERTY_TECHNOLOGYDETAILSNO); detail.TechonlogyHeaderId = header.TechonlogyHeaderId; accessorDetails.Insert(detail); } }
private void btn_OK_Click(object sender, EventArgs e) { this.gridView1.PostEditor(); this.gridView1.UpdateCurrentRow(); var checkDatas = TechonlogyHeader.detail.Where(d => d.IsChecked); //原來的工藝全部選中,意思為 直接用原來的,否則按照選中數據新增一筆 if (checkDatas.Count() != TechonlogyHeader.detail.Count()) { Model.TechonlogyHeader header = new Book.Model.TechonlogyHeader(); header.TechonlogyHeaderId = Guid.NewGuid().ToString(); header.Id = this.techonlogyHeaderManager.GetId(DateTime.Now); header.Statrdate = global::Helper.DateTimeParse.NullDate; header.Enddate = global::Helper.DateTimeParse.EndDate; header.detail = new List <Model.Technologydetails>(); header.TechonlogyHeadername = TechonlogyHeader.TechonlogyHeadername + "-" + techonlogyHeaderManager.GetSameNameCount(TechonlogyHeader.TechonlogyHeadername); foreach (var item in checkDatas) { item.TechnologydetailsID = Guid.NewGuid().ToString(); item.TechonlogyHeaderId = header.TechonlogyHeaderId; item.TechnologydetailsNo = (header.detail.Count() + 1).ToString(); header.detail.Add(item); } techonlogyHeaderManager.Insert(header); TechonlogyHeader = header; } this.DialogResult = DialogResult.OK; }
protected override void Delete() { if (this.techonlogyHeader == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK) { return; } try { this.techonlogyHeaderManager.Delete(this.techonlogyHeader.TechonlogyHeaderId); this.techonlogyHeader = this.techonlogyHeaderManager.GetNext(this.techonlogyHeader); if (this.techonlogyHeader == null) { this.techonlogyHeader = this.techonlogyHeaderManager.GetLast(); } this.treeList1.DeleteSelectedNodes(); // this.band(); } catch { throw new Exception(""); } return; }
public bool ExistsExcept(Model.TechonlogyHeader e) { Hashtable paras = new Hashtable(); paras.Add("newId", e.Id); paras.Add("oldId", Get(e.TechonlogyHeaderId).Id); return(sqlmapper.QueryForObject <bool>("TechonlogyHeader.existsexcept", paras)); }
/// <summary> /// 数据源改变触发事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BomProcedurebindingSource_CurrentChanged(object sender, EventArgs e) { Model.TechonlogyHeader technology = this.BomBomTechonlogyHeaderSource.Current as Model.TechonlogyHeader; if (technology == null) { return; } this.bindingSource1.DataSource = this.proceduresManager.Select(technology); }
public Model.TechonlogyHeader GetDetail(string TechonlogyHeaderId) { Model.TechonlogyHeader TechonlogyHeader = accessor.Get(TechonlogyHeaderId); if (TechonlogyHeader != null) { TechonlogyHeader.detail = accessorDetails.Select(TechonlogyHeader); } return(TechonlogyHeader); }
public ChooseSubProcedures(string techonlogyHeaderId) { InitializeComponent(); this.StartPosition = FormStartPosition.CenterParent; TechonlogyHeader = techonlogyHeaderManager.GetDetail(techonlogyHeaderId); this.bindingSource1.DataSource = TechonlogyHeader.detail; }
protected override void MovePrev() { Model.TechonlogyHeader techonlogyHeader = this.techonlogyHeaderManager.GetPrev(this.techonlogyHeader); if (techonlogyHeader == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.techonlogyHeader = techonlogyHeader; }
public void MyClick(ref ChooseItem item) { ChooseTechonlogyForm f = new ChooseTechonlogyForm(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.TechonlogyHeader techonlogyHeader = f.SelectedItem as Model.TechonlogyHeader; item = new ChooseItem(techonlogyHeader, techonlogyHeader.Id, techonlogyHeader.TechonlogyHeadername); } }
public EidtForm(Model.TechonlogyHeader techonlogyHeader, string action) : this() { this.techonlogyHeader = techonlogyHeader; this.bindingSourceProcedures.DataSource = this.proceduresManager.Select(); this.action = action; if (this.action == "view") { LastFlag = 1; } }
private void Validate(Model.TechonlogyHeader techonlogyHeader) { if (string.IsNullOrEmpty(techonlogyHeader.Id)) { throw new Helper.RequireValueException(Model.TechonlogyHeader.PROPERTY_ID); } if (string.IsNullOrEmpty(techonlogyHeader.TechonlogyHeadername)) { throw new Helper.RequireValueException(Model.TechonlogyHeader.PROPERTY_TECHONLOGYHEADERNAME); } }
public EidtForm(string id) : this() { this.techonlogyHeader = this.techonlogyHeaderManager.GetDetail(id); this.bindingSourceProcedures.DataSource = this.proceduresManager.Select(); this.action = "view"; if (this.action == "view") { LastFlag = 1; } }
protected override void MoveNext() { if (LastFlag == 1) { LastFlag = 0; return; } Model.TechonlogyHeader techonlogyHeader = this.techonlogyHeaderManager.GetNext(this.techonlogyHeader); if (techonlogyHeader == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.techonlogyHeader = techonlogyHeader; }
public void MyLeave(ref ChooseItem item) { BL.TechonlogyHeaderManager manager = new Book.BL.TechonlogyHeaderManager(); Model.TechonlogyHeader techonlogyHeader = manager.GetById(item.ButtonText); if (techonlogyHeader != null) { item.EditValue = techonlogyHeader; item.LabelText = techonlogyHeader.TechonlogyHeadername; item.ButtonText = techonlogyHeader.Id; } else { item.ErrorMessage = "工藝路線頭出錯"; } }
/// <summary> /// Update a TechonlogyHeader. /// </summary> public void Update(Model.TechonlogyHeader techonlogyHeader) { // // todo: add other logic here. // Validate(techonlogyHeader); if (this.ExistsExcept(techonlogyHeader)) { throw new Helper.InvalidValueException(Model.TechonlogyHeader.PROPERTY_ID); } //foreach (Model.Technologydetails detail in techonlogyHeader.detail) //{ accessorDetails.Delete(techonlogyHeader); // } _update(techonlogyHeader); }
protected override void AddNew() { //flag1 = 1; this.techonlogyHeader = new Model.TechonlogyHeader(); this.techonlogyHeader.TechonlogyHeaderId = Guid.NewGuid().ToString(); this.techonlogyHeader.Id = this.techonlogyHeaderManager.GetId(DateTime.Now); this.techonlogyHeader.detail = new List <Model.Technologydetails>(); //if (this.action == "insert") //{ // Model.Procedures detail = new Model.Procedures(); // detail.WorkHouse = new Model.WorkHouse(); // detail.ProceduresId = ""; // //detail.InvoiceCJDetailNote = ""; // //detail.InvoiceCJDetailPrice = 0; // //detail.InvoiceCJDetailQuantity = 0; // //detail.InvoiceProductUnit = ""; // //detail.Product = new Book.Model.Product(); // this.techonlogyHeader.detail.Add(detail); // this.bindingSource1.Position = this.bindingSource1.IndexOf(detail); //} }
private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { if (flag == 0) { //if (flag1 == 0) //{ if (e.Node != null && e.Node.ParentNode == null) { this.techonlogyHeader = techonlogyHeaderManager.GetDetail(e.Node.Tag.ToString()); this.action = "view"; this.Refresh(); } if (e.Node != null && e.Node.ParentNode != null) { flag = 1; treeList1.SetFocusedNode(e.Node.ParentNode); } // } // flag1 = 0; } flag = 0; }
public void Delete(Model.TechonlogyHeader techonlogyHeader) { accessor.Delete(techonlogyHeader); }
protected override void MoveLast() { this.techonlogyHeader = this.techonlogyHeaderManager.GetLast(); }
public IList <Model.Procedures> Select(Model.TechonlogyHeader techonlogyHeader) { return(accessor.Select(techonlogyHeader)); }
public bool ExistsExcept(Model.TechonlogyHeader e) { return(accessor.ExistsExcept(e)); }
public Model.TechonlogyHeader GetNext(Model.TechonlogyHeader e) { return(accessor.GetNext(e)); }
public Model.TechonlogyHeader GetPrev(Model.TechonlogyHeader e) { return(accessor.GetPrev(e)); }
public bool HasRowsAfter(Model.TechonlogyHeader e) { return(accessor.HasRowsAfter(e)); }
public bool HasRowsBefore(Model.TechonlogyHeader e) { return(accessor.HasRowsBefore(e)); }
public ROBOM(Model.BomParentPartInfo bomParentPartInfo) : this() { this.lblCompanyName.Text = BL.Settings.CompanyChineseName; this.lblReportName.Text = "物料清單"; this.lblBomId.Text = bomParentPartInfo.Id; if (bomParentPartInfo.Product != null) { lblProductId.Text = bomParentPartInfo.Product.Id; lblProductName.Text = bomParentPartInfo.Product.ProductName; if (bomParentPartInfo.Product.OutSourcing != null && bomParentPartInfo.Product.OutSourcing.Value) { lblSource.Text = Properties.Resources.IsOutSourcing; } if (bomParentPartInfo.Product.Consume != null && bomParentPartInfo.Product.Consume.Value) { lblSource.Text = "耗用"; } if (bomParentPartInfo.Product.TrustOut != null && bomParentPartInfo.Product.TrustOut.Value) { lblSource.Text = "委外"; if (bomParentPartInfo.Product.IsProcee != null && bomParentPartInfo.Product.IsProcee.Value) { this.lblSource.Text = "委外半成品加工"; } } if (bomParentPartInfo.Product.HomeMade != null && bomParentPartInfo.Product.HomeMade.Value) { lblSource.Text = Properties.Resources.IsHomeMade; if (bomParentPartInfo.Product.IsProcee != null && bomParentPartInfo.Product.IsProcee.Value) { this.lblSource.Text = "自製半成品加工"; } } } IList <Model.BomComponentInfo> list = new List <Model.BomComponentInfo>(); //IList<Model.BomComponentInfo> bomcomList1 = null; IList <Model.BomComponentInfo> bomcomList2 = null; IList <Model.BomComponentInfo> bomcomList3 = null; IList <Model.BomComponentInfo> bomcomList4 = null; IList <Model.BomComponentInfo> bomcomList5 = null; IList <Model.BomComponentInfo> bomcomList6 = null; IList <Model.BomComponentInfo> bomcomList7 = null; IList <Model.BomComponentInfo> bomcomList8 = null; IList <Model.BomComponentInfo> bomcomList9 = null; foreach (var item1 in bomParentPartInfo.Components) //第一层子件 { item1.ReportInumber = (bomParentPartInfo.Components.IndexOf(item1) + 1).ToString(); list.Add(item1); bomcomList2 = comManager.SelectByProductId(item1.ProductId); foreach (var item2 in bomcomList2) //第二层 { item2.ReportInumber = item1.ReportInumber + "-" + (bomcomList2.IndexOf(item2) + 1).ToString(); list.Add(item2); bomcomList3 = comManager.SelectByProductId(item2.ProductId); foreach (var item3 in bomcomList3) //第三层 { item3.ReportInumber = item2.ReportInumber + "-" + (bomcomList3.IndexOf(item3) + 1).ToString(); list.Add(item3); bomcomList4 = comManager.SelectByProductId(item3.ProductId); foreach (var item4 in bomcomList4) //第四层 { item4.ReportInumber = item3.ReportInumber + "-" + (bomcomList4.IndexOf(item4) + 1).ToString(); list.Add(item4); bomcomList5 = comManager.SelectByProductId(item4.ProductId); foreach (var item5 in bomcomList5) //第五层 { item5.ReportInumber = item4.ReportInumber + "-" + (bomcomList5.IndexOf(item5) + 1).ToString(); list.Add(item5); bomcomList6 = comManager.SelectByProductId(item5.ProductId); foreach (var item6 in bomcomList6) //第六层 { item6.ReportInumber = item5.ReportInumber + "-" + (bomcomList6.IndexOf(item6) + 1).ToString(); list.Add(item6); bomcomList7 = comManager.SelectByProductId(item6.ProductId); foreach (var item7 in bomcomList7) //第七层 { item7.ReportInumber = item6.ReportInumber + "-" + (bomcomList7.IndexOf(item7) + 1).ToString(); list.Add(item7); bomcomList8 = comManager.SelectByProductId(item7.ProductId); foreach (var item8 in bomcomList8) //第八层 { item8.ReportInumber = item7.ReportInumber + "-" + (bomcomList8.IndexOf(item8) + 1).ToString(); list.Add(item8); } } } } } } } } this.DataSource = list; this.TCInumber.DataBindings.Add("Text", this.DataSource, Model.BomComponentInfo.PRO_ReportInumber); this.TCProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName); this.TCMaterial.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification); this.TCProductUnit.DataBindings.Add("Text", this.DataSource, Model.BomComponentInfo.PROPERTY_UNIT); this.TCUseQuantity.DataBindings.Add("Text", this.DataSource, Model.BomComponentInfo.PROPERTY_USEQUANTITY); this.TCSunhaolv.DataBindings.Add("Text", this.DataSource, Model.BomComponentInfo.PROPERTY_SUBLOSERATE); this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_ProductDescription); this.TCMaterial.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification); this.TCProId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id); Model.TechonlogyHeader TechonlogyHeader = this.techonlogyHeaderManager.Get(bomParentPartInfo.TechonlogyHeaderId); IList <Model.Technologydetails> Technologydetails = new List <Model.Technologydetails>(); if (TechonlogyHeader != null) { Technologydetails = this.technologydetailsManager.Select(TechonlogyHeader); } //ROBOMProcess ROBOMProcess = new ROBOMProcess(Technologydetails); this.xrSubreport2.ReportSource = new ROBOMProcess(Technologydetails); IList <Model.BomPackageDetails> packList = this.packageManager.Select(bomParentPartInfo.BomId); //ROBOMPackage ROBOMPackage = new ROBOMPackage(packList); this.xrSubreport1.ReportSource = new ROBOMPackage(packList); }
public override void Refresh() { //flag = 0; if (this.action == "view" && (treeList1.Selection[0] == null || treeList1.Selection[0].Tag == null || treeList1.Selection[0].Tag.ToString() != this.techonlogyHeader.TechonlogyHeaderId)) { foreach (TreeListNode node in treeList1.Nodes) { if (node.Tag.ToString() == this.techonlogyHeader.TechonlogyHeaderId) { treeList1.SetFocusedNode(node); } } //treeList1.SetFocusedNode(treeList1.FindNodeByFieldValue("treeListColumn1", this.techonlogyHeader.TechonlogyHeadername)); } if (this.techonlogyHeader == null) { this.techonlogyHeader = new Book.Model.TechonlogyHeader(); this.techonlogyHeader.Id = this.techonlogyHeaderManager.GetId(DateTime.Now); this.action = "insert"; } else { if (this.action == "view") { this.techonlogyHeader = this.techonlogyHeaderManager.GetDetail(this.techonlogyHeader.TechonlogyHeaderId); } } this.bindingSource1.DataSource = this.techonlogyHeader.detail; this.textTechonlogyHeaderid.Text = this.techonlogyHeader.Id; this.textTechonlogyHeadername.Text = this.techonlogyHeader.TechonlogyHeadername; if (global::Helper.DateTimeParse.DateTimeEquls(this.techonlogyHeader.Statrdate, global::Helper.DateTimeParse.NullDate)) { this.dateStatrdate.EditValue = null; } else { this.dateStatrdate.EditValue = this.techonlogyHeader.Statrdate; } if (global::Helper.DateTimeParse.DateTimeEquls(this.techonlogyHeader.Enddate, global::Helper.DateTimeParse.NullDate)) { this.dateEnddate.EditValue = null; } else { this.dateEnddate.EditValue = this.techonlogyHeader.Enddate; } this.textEditDescription.Text = this.techonlogyHeader.Techonlogydescription; if (this.techonlogyHeader.TechonlogyState != null) { this.comboBoxTechonlogyState.EditValue = this.techonlogyHeader.TechonlogyState; } switch (this.action) { case "insert": this.barButtonItem1.Enabled = false; this.textTechonlogyHeaderid.Properties.ReadOnly = false; this.textTechonlogyHeadername.Properties.ReadOnly = false; this.textEditDescription.Properties.ReadOnly = false; this.dateStatrdate.Properties.ReadOnly = false; this.dateEnddate.Properties.ReadOnly = false; this.dateStatrdate.Properties.Buttons[0].Enabled = true; this.dateEnddate.Properties.Buttons[0].Enabled = true; this.comboBoxTechonlogyState.Properties.ReadOnly = false; this.comboBoxTechonlogyState.Properties.Buttons[0].Enabled = true; this.simpleButton1.Enabled = true; this.simpleButton2.Enabled = true; this.gridView1.OptionsBehavior.Editable = true; this.repositoryItemLookUpEdit1.Buttons[0].Visible = true; this.repositoryItemLookUpEdit2.Buttons[0].Visible = true; break; case "update": this.barButtonItem1.Enabled = false; this.textTechonlogyHeaderid.Properties.ReadOnly = false; this.textTechonlogyHeadername.Properties.ReadOnly = false; this.textEditDescription.Properties.ReadOnly = false; this.dateStatrdate.Properties.ReadOnly = false; this.dateEnddate.Properties.ReadOnly = false; this.dateStatrdate.Properties.Buttons[0].Enabled = true; this.dateEnddate.Properties.Buttons[0].Enabled = true; this.comboBoxTechonlogyState.Properties.ReadOnly = false; this.comboBoxTechonlogyState.Properties.Buttons[0].Enabled = true; this.simpleButton1.Enabled = true; this.simpleButton2.Enabled = true; this.gridView1.OptionsBehavior.Editable = true; this.repositoryItemLookUpEdit1.Buttons[0].Visible = true; this.repositoryItemLookUpEdit2.Buttons[0].Visible = true; break; case "view": this.barButtonItem1.Enabled = true; this.textTechonlogyHeaderid.Properties.ReadOnly = true; this.textTechonlogyHeadername.Properties.ReadOnly = true; this.textEditDescription.Properties.ReadOnly = true; this.dateStatrdate.Properties.ReadOnly = true; this.dateEnddate.Properties.ReadOnly = true; this.dateStatrdate.Properties.Buttons[0].Enabled = false; this.dateEnddate.Properties.Buttons[0].Enabled = false; this.comboBoxTechonlogyState.Properties.ReadOnly = true; this.comboBoxTechonlogyState.Properties.Buttons[0].Enabled = false; this.simpleButton1.Enabled = false; this.simpleButton2.Enabled = false; this.gridView1.OptionsBehavior.Editable = false; this.repositoryItemLookUpEdit1.Buttons[0].Visible = false; this.repositoryItemLookUpEdit2.Buttons[0].Visible = false; break; default: break; } base.Refresh(); this.bindingSourceSunhao.DataSource = this.sunhaoList; if ((this.bindingSource1.Current as Model.Technologydetails) != null) { this.AnalyticalSunhaoRage((this.bindingSource1.Current as Model.Technologydetails).SunhaoRange); } }
/// <summary> /// Insert a TechonlogyHeader. /// </summary> public void Insert(Model.TechonlogyHeader techonlogyHeader) { // // todo:add other logic here // Validate(techonlogyHeader); if (this.Exists(techonlogyHeader.Id)) { //throw new Helper.InvalidValueException(Model.Product.PRO_Id); techonlogyHeader.Id = this.GetId(DateTime.Now); } //if (this.Exists(techonlogyHeader.Id)) //{ // throw new Helper.InvalidValueException(Model.TechonlogyHeader.PROPERTY_ID); //} try { techonlogyHeader.InsertTime = DateTime.Now; techonlogyHeader.UpdateTime = DateTime.Now; string invoiceKind = this.GetInvoiceKind().ToLower(); string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, techonlogyHeader.InsertTime.Value.Year); string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, techonlogyHeader.InsertTime.Value.Year, techonlogyHeader.InsertTime.Value.Month); string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, techonlogyHeader.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); IList <string> str = new List <string>(); foreach (Model.Technologydetails detail in techonlogyHeader.detail) { if (detail.TechnologydetailsNo == null) { continue; } if (str.Contains(detail.TechnologydetailsNo)) { throw new Helper.InvalidValueException(Model.Technologydetails.PROPERTY_TECHNOLOGYDETAILSNO); } str.Add(detail.TechnologydetailsNo); } BL.V.BeginTransaction(); //techonlogyHeader.TechonlogyHeaderId = GetNewId(); accessor.Insert(techonlogyHeader); foreach (Model.Technologydetails detail in techonlogyHeader.detail) { if (string.IsNullOrEmpty(detail.ProceduresId)) { continue; } if (string.IsNullOrEmpty(detail.TechnologydetailsNo)) { throw new Helper.RequireValueException(Model.Technologydetails.PROPERTY_TECHNOLOGYDETAILSNO); } //if (accessorDetails.IsExists_TechnologydetailsNo(detail)) // throw new Helper.InvalidValueException(Model.Technologydetails.PROPERTY_TECHNOLOGYDETAILSNO); detail.TechonlogyHeaderId = techonlogyHeader.TechonlogyHeaderId; accessorDetails.Insert(detail); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
public IList <Book.Model.Technologydetails> Select(Model.TechonlogyHeader TechonlogyHeader) { return(accessor.Select(TechonlogyHeader)); }