protected override void AddNew() { this._BGHandbookRange = new Book.Model.BGHandbookRange(); this._BGHandbookRange.BGHandbookRangeId = Guid.NewGuid().ToString(); this._BGHandbookRange.BGHandbookRangeDate = DateTime.Now; this.action = "insert"; }
protected override void MovePrev() { Model.BGHandbookRange model = this._manager.GetPrev(this._BGHandbookRange); if (model == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this._BGHandbookRange = model; }
public override void Refresh() { if (this._BGHandbookRange == null) { AddNew(); } else { if (this.action == "view") { this._BGHandbookRange = this._manager.Get(this._BGHandbookRange.BGHandbookRangeId); } } this.txt_CompanyNameAndId.EditValue = this._BGHandbookRange.CompanyNameAndId; this.date_Invoice.EditValue = this._BGHandbookRange.BGHandbookRangeDate; this.txt_Employee.EditValue = this._BGHandbookRange.EmployeeId; this.txt_Tel.EditValue = this._BGHandbookRange.Tel; //this.cobProductType.EditValue = this._BGHandbookRange.ProductType; this.richTextBoxOpinion.Rtf = this._BGHandbookRange.Opinion; this.newChooseContorlAuditEmp.EditValue = this._BGHandbookRange.AuditEmp; this.txt_AuditState.EditValue = this.GetAuditName(this._BGHandbookRange.AuditState); this._BGHandbookRange.DetailProducts = this._detailManager.SelectByBGHandbookId(this._BGHandbookRange.BGHandbookRangeId, "成品"); this._BGHandbookRange.DetailMaterials = this._detailManager.SelectByBGHandbookId(this._BGHandbookRange.BGHandbookRangeId, "料件"); this.bindingSourceProduct.DataSource = this._BGHandbookRange.DetailProducts; this.bindingSourceMaterial.DataSource = this._BGHandbookRange.DetailMaterials; if (this._BGHandbookRange.DetailProducts.Count > 0) { this.xtraTabControl1.SelectedTabPageIndex = 0; this.xtraTabPage1.PageVisible = true; this.xtraTabPage2.PageVisible = false; } if (this._BGHandbookRange.DetailMaterials.Count > 0) { this.xtraTabControl1.SelectedTabPageIndex = 1; this.xtraTabPage1.PageVisible = false; this.xtraTabPage2.PageVisible = true; } base.Refresh(); switch (this.action) { case "view": this.gridView1.OptionsBehavior.Editable = false; this.gridView2.OptionsBehavior.Editable = false; break; default: this.gridView1.OptionsBehavior.Editable = true; this.gridView2.OptionsBehavior.Editable = true; break; } }
private void barSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ListForm f = new ListForm(); if (f.ShowDialog(this) == DialogResult.OK) { Model.BGHandbookRange model = f.SelectItem as Model.BGHandbookRange; if (model != null) { this._BGHandbookRange = model; this.Refresh(); } } }
protected override void Delete() { if (this._BGHandbookRange == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this._manager.Delete(this._BGHandbookRange.BGHandbookRangeId); this._BGHandbookRange = this._manager.GetNext(this._BGHandbookRange); if (this._BGHandbookRange == null) { this._BGHandbookRange = this._manager.GetLast(); } }
/// <summary> /// Update a BGHandbookRange. /// </summary> public void Update(Model.BGHandbookRange bGHandbookRange) { try { BL.V.BeginTransaction(); bGHandbookRange.UpdateTime = DateTime.Now; new BL.BGHandbookRangeDetailManager().DeleteByBGHandbookId(bGHandbookRange.BGHandbookRangeId); foreach (Model.BGHandbookRangeDetail detail in bGHandbookRange.Details) { detail.BGHandbookRangeId = bGHandbookRange.BGHandbookRangeId; detail.ProductType = bGHandbookRange.ProductType; new BL.BGHandbookRangeDetailManager().Insert(detail); } BL.V.CommitTransaction(); } catch { BL.V.RollbackTransaction(); throw; } }
/// <summary> /// Insert a BGHandbookRange. /// </summary> public void Insert(Model.BGHandbookRange bGHandbookRange) { //try //{ // BL.V.BeginTransaction(); bGHandbookRange.InsertTime = DateTime.Now; bGHandbookRange.UpdateTime = DateTime.Now; accessor.Insert(bGHandbookRange); foreach (Model.BGHandbookRangeDetail detail in bGHandbookRange.Details) { detail.BGHandbookRangeId = bGHandbookRange.BGHandbookRangeId; detail.ProductType = bGHandbookRange.ProductType; new BL.BGHandbookRangeDetailManager().Insert(detail); } //BL.V.CommitTransaction(); //} //catch //{ // BL.V.RollbackTransaction(); // throw; //} }
public override void Refresh() { if (this._BGHandbookRange == null) { AddNew(); } else { if (this.action == "view") { this._BGHandbookRange = this._manager.Get(this._BGHandbookRange.BGHandbookRangeId); } } this.txt_CompanyNameAndId.EditValue = this._BGHandbookRange.CompanyNameAndId; this.date_Invoice.EditValue = this._BGHandbookRange.BGHandbookRangeDate; this.newChooseContorlEmployee.EditValue = this._BGHandbookRange.Employee; this.txt_Tel.EditValue = this._BGHandbookRange.Tel; this.cobProductType.EditValue = this._BGHandbookRange.ProductType; this.richTextBoxOpinion.Rtf = this._BGHandbookRange.Opinion; this.newChooseContorlAuditEmp.EditValue = this._BGHandbookRange.AuditEmp; this.txt_AuditState.EditValue = this.GetAuditName(this._BGHandbookRange.AuditState); this._BGHandbookRange.Details = this._detailManager.SelectByBGHandbookId(this._BGHandbookRange.BGHandbookRangeId); this.bindingSource1.DataSource = this._BGHandbookRange.Details; base.Refresh(); switch (this.action) { case "view": this.gridView1.OptionsBehavior.Editable = false; break; default: this.gridView1.OptionsBehavior.Editable = true; break; } }
private void barIn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { ExcelClass.ExcelClass1 ec = new Book.UI.ExcelClass.ExcelClass1(); ec.Open(openFileDialog1.FileName); try { BL.V.BeginTransaction(); Model.BGHandbookRange bGHandbookRange = null; this.action = "insert"; Model.BGHandbookRangeDetail detail = null; for (int i = 1; i <= ec.wb.Worksheets.Count; i++) { bGHandbookRange = new Book.Model.BGHandbookRange(); bGHandbookRange.DetailProducts = new List <Model.BGHandbookRangeDetail>(); bGHandbookRange.DetailMaterials = new List <Model.BGHandbookRangeDetail>(); bGHandbookRange.BGHandbookRangeId = Guid.NewGuid().ToString(); bGHandbookRange.BGHandbookRangeDate = DateTime.Now; Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)ec.wb.Worksheets[i]; bGHandbookRange.CompanyNameAndId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[3, 1]).Text.ToString().Substring(((Microsoft.Office.Interop.Excel.Range)ws.Cells[3, 1]).Text.ToString().IndexOf(':') + 1); if (openFileDialog1.FileName.Contains("成品")) { //if (ws.Name != "草稿") //{ for (int j = 6; j < 10000; j++) { if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() == "经办关员意见:" || (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() == "" && ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString() == "")) { break; } detail = new Book.Model.BGHandbookRangeDetail(); detail.BGHandbookRangeDetailId = Guid.NewGuid().ToString(); detail.BGHandbookRangeId = bGHandbookRange.BGHandbookRangeId; if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() != "") { detail.Id = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString() != "") { detail.ProductName = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 3]).Text.ToString() != "") { detail.ProductSpecification = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 3]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 4]).Text.ToString() != "") { detail.ProductUnit = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 4]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 5]).Text.ToString() != "") { detail.CompanyProductId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 5]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 6]).Text.ToString() != "") { detail.CustomProductId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 6]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 7]).Text.ToString() != "") { detail.Note = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 7]).Text.ToString(); } detail.ProductType = "成品"; bGHandbookRange.DetailProducts.Add(detail); } //} //else //{ // for (int j = 6; j < 10000; j++) // { // if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() == "经办关员意见:" || (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() == "" && ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString() == "")) // { // break; // } // detail = new Book.Model.BGHandbookRangeDetail(); // detail.BGHandbookRangeDetailId = Guid.NewGuid().ToString(); // detail.BGHandbookRangeId = bGHandbookRange.BGHandbookRangeId; // if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() != "") // detail.Id = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString(); // if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString() != "") // detail.CustomId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString(); // if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 3]).Text.ToString() != "") // detail.ProductName = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 3]).Text.ToString(); // if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 4]).Text.ToString() != "") // detail.ProductSpecification = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 4]).Text.ToString(); // if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 5]).Text.ToString() != "") // detail.ProductUnit = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 5]).Text.ToString(); // if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 6]).Text.ToString() != "") // detail.CompanyProductId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 6]).Text.ToString(); // if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 7]).Text.ToString() != "") // detail.CustomProductId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 7]).Text.ToString(); // if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 8]).Text.ToString() != "") // detail.Note = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 8]).Text.ToString(); // detail.ProductType = "成品"; // bGHandbookRange.DetailProducts.Add(detail); // } //} } else if (openFileDialog1.FileName.Contains("料件")) { if (ws.Name == "Sheet4") { continue; } else if (ws.Name == "申报要素") { continue; } else { for (int j = 6; j < 10000; j++) { if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() == "经办关员意见:" || (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() == "" && ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString() == "")) { break; } detail = new Book.Model.BGHandbookRangeDetail(); detail.BGHandbookRangeDetailId = Guid.NewGuid().ToString(); detail.BGHandbookRangeId = bGHandbookRange.BGHandbookRangeId; if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() != "") { detail.Id = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString() != "") { detail.ProductName = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 3]).Text.ToString() != "") { detail.ProductSpecification = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 3]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 4]).Text.ToString() != "") { detail.ProductUnit = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 4]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 5]).Text.ToString() != "") { detail.CompanyProductId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 5]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 6]).Text.ToString() != "") { detail.CustomProductId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 6]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 7]).Text.ToString() != "") { detail.Note = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 7]).Text.ToString(); } detail.ProductType = "料件"; bGHandbookRange.DetailMaterials.Add(detail); } } } bGHandbookRange.EmployeeId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[4, 1]).Text.ToString().Substring(((Microsoft.Office.Interop.Excel.Range)ws.Cells[4, 1]).Text.ToString().IndexOf(":") + 1, 4).Trim(); bGHandbookRange.Tel = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[4, 1]).Text.ToString().Trim().Substring(((Microsoft.Office.Interop.Excel.Range)ws.Cells[4, 1]).Text.ToString().Trim().Length - 11); this._manager.Insert(bGHandbookRange); } BL.V.CommitTransaction(); //this.bindingSourceProduct.DataSource = bGHandbookRange.DetailProducts; //this.bindingSourceMaterial.DataSource = bGHandbookRange.DetailMaterials; //this.gridControl1.RefreshDataSource(); //this.gridControl2.RefreshDataSource(); this.MoveLast(); this.action = "view"; this.Refresh(); } catch { BL.V.RollbackTransaction(); ec.Close(); throw; } ec.Close(); } }
public void Delete(Model.BGHandbookRange model) { this.Delete(model.BGHandbookRangeId); }
public Model.BGHandbookRange GetPrev(Model.BGHandbookRange e) { return(accessor.GetPrev(e)); }
public bool HasRowsBefore(Model.BGHandbookRange e) { return(accessor.HasRowsBefore(e)); }
public bool HasRowsAfter(Model.BGHandbookRange e) { return(sqlmapper.QueryForObject <bool>("BGHandbookRange.has_rows_after", e)); }
public bool HasRowsBefore(Model.BGHandbookRange e) { return(sqlmapper.QueryForObject <bool>("BGHandbookRange.has_rows_before", e)); }
public void Update(Model.BGHandbookRange e) { this.Update <Model.BGHandbookRange>(e); }
public void Insert(Model.BGHandbookRange e) { this.Insert <Model.BGHandbookRange>(e); }
public Model.BGHandbookRange GetNext(Model.BGHandbookRange e) { return(accessor.GetNext(e)); }
protected override void MoveLast() { this._BGHandbookRange = this._manager.GetLast(); }
public Model.BGHandbookRange GetNext(Model.BGHandbookRange e) { return(sqlmapper.QueryForObject <Model.BGHandbookRange>("BGHandbookRange.get_next", e)); }
public bool HasRowsAfter(Model.BGHandbookRange e) { return(accessor.HasRowsAfter(e)); }
public Model.BGHandbookRange GetPrev(Model.BGHandbookRange e) { return(sqlmapper.QueryForObject <Model.BGHandbookRange>("BGHandbookRange.get_prev", e)); }
private void barIn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { ExcelClass.ExcelClass1 ec = new Book.UI.ExcelClass.ExcelClass1(); ec.Open(openFileDialog1.FileName); try { BL.V.BeginTransaction(); Model.BGHandbookRange bGHandbookRange = null; this.action = "insert"; Model.BGHandbookRangeDetail detail; for (int i = 1; i < ec.wb.Worksheets.Count; i++) { bGHandbookRange = new Book.Model.BGHandbookRange(); bGHandbookRange.Details = new List <Model.BGHandbookRangeDetail>(); bGHandbookRange.BGHandbookRangeId = Guid.NewGuid().ToString(); bGHandbookRange.BGHandbookRangeDate = DateTime.Now; Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)ec.wb.Worksheets[i]; bGHandbookRange.CompanyNameAndId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[3, 1]).Text.ToString().Substring(((Microsoft.Office.Interop.Excel.Range)ws.Cells[3, 1]).Text.ToString().IndexOf(':') + 1); if (openFileDialog1.FileName.Contains("成品")) { this.cobProductType.EditValue = "成品"; if (ws.Name != "草稿") { for (int j = 6; j < 200; j++) { if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() == "经办关员意见:" || (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() == "" && ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString() == "")) { break; } detail = new Book.Model.BGHandbookRangeDetail(); detail.BGHandbookRangeDetailId = Guid.NewGuid().ToString(); if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString() != "") { detail.Id = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 1]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString() != "") { detail.ProductName = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 2]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 3]).Text.ToString() != "") { detail.ProductSpecification = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 3]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 5]).Text.ToString() != "") { detail.ProductUnit = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 5]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 6]).Text.ToString() != "") { detail.CompanyProductId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 6]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 7]).Text.ToString() != "") { detail.CustomProductId = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 7]).Text.ToString(); } if (((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 9]).Text.ToString() != "") { detail.Note = ((Microsoft.Office.Interop.Excel.Range)ws.Cells[j, 9]).Text.ToString(); } } } } else if (openFileDialog1.FileName.Contains("料件")) { this.cobProductType.EditValue = "料件"; } bGHandbookRange.Employee = (new BL.EmployeeManager()).GetByOperatorName(((Microsoft.Office.Interop.Excel.Range)ws.Cells[4, 1]).Text.ToString().Substring(((Microsoft.Office.Interop.Excel.Range)ws.Cells[4, 1]).Text.ToString().IndexOf(':') + 1, 4).Trim()); bGHandbookRange.EmployeeId = bGHandbookRange.Employee.EmployeeId; } } catch { BL.V.RollbackTransaction(); ec.Close(); throw; } ec.Close(); } }