private void btnChangeName_Click(object sender, EventArgs e) { if (txtdescriptionForSupplier.Text != null) { if (this.IsPoz) { Poz poz = PozProvider.Instance.GetItem(this.currentPozOBFId); poz.DescriptionForSupplier = txtdescriptionForSupplier.Text.Trim(); PozProvider.Instance.Save(poz); } else { IhalematikProBL.Entity.OBF obf = OBFProvider.Instance.GetItem(this.currentPozOBFId); obf.DescriptionForSupplier = txtdescriptionForSupplier.Text.Trim(); OBFProvider.Instance.Save(obf); } this.PozOBF.DescriptionForSupplier = txtdescriptionForSupplier.Text.Trim(); this._owner.LoadMaterialGrid(); UIPopupManager.Instance.ShowPopup(); this.Close(); } //else //{ // MessageBox.Show("Lütfen Malzeme Adını Belirtiniz..."); // txtNewMeterialName.Focus(); //} }
private void btnEvet_Click(object sender, EventArgs e) { if (this.MaterialListItems.Where(p => p.PozOBFUnitePrice == 0).Count() != 0) { MessageBox.Show("Birim Fiyatı 0 olan malzeme bıraktınız. Lütfen Birim Fiyat belirtiniz?"); grdMaterialList.DataSource = null; grdMaterialList.DataSource = this.MaterialListItems.OrderBy(p => p.PozOBFUnitePrice).ToList(); return; } this.Enabled = false; LoadingManager.Instance.Show(this); foreach (var item in this.MaterialListItems) { MaterialListProvider.Instance.Save(item); if (UICurrentManager.Instance.CurrentTender.MaterialList.Where(p => p.Id == item.Id).Count() == 0) { UICurrentManager.Instance.CurrentTender.MaterialList.Add(item); } Poz currentPoz = PozProvider.Instance.GetItem(item.PozOBFId); if (currentPoz != null) { currentPoz.UnitPrice = item.PozOBFUnitePrice; PozProvider.Instance.Save(currentPoz); } } LoadingManager.Instance.Hide(); this.Enabled = true; this._owner.LoadTenderGroupGrid(); UIPopupManager.Instance.ShowPopup(); this.Close(); }
public PozModel(Poz Entity) { this.Number = Entity.Number; this.Unit = Entity.Unit; this.UnitPrice = Entity.UnitPrice; this.Description = Entity.Description; this.Id = Entity.Id; this.IsActive = Entity.IsActive; }
public override EntityBase ToEntity() { Poz poz = new Poz(); poz.Description = this.Description; if (this.Id.HasValue) { poz.Id = this.Id.Value; } poz.Number = this.Number; poz.Unit = this.Unit; poz.UnitPrice = this.UnitPrice; poz.IsActive = this.IsActive; return(poz); }
private void gridViewMaterialList_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column == colUnitPrice) { int id = SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <int>(gridViewMaterialList.GetFocusedRowCellValue("PozOBFId")); Poz currentPoz = PozProvider.Instance.GetItem(id); if (currentPoz != null) { double unitPrice = SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <double>(e.Value); currentPoz.UnitPrice = unitPrice; // } } }
private void btnPasive_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { DialogResult result = MessageBox.Show("Pasif yapmak istediginzden emin misiniz?", "Pasif Yap", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result.Equals(DialogResult.OK)) { this.FocusedRowHandle = gridViewPozList.FocusedRowHandle; int id = SimpleApplicationBase.Toolkit.Helpers.GetValueFromObject <int>(gridViewPozList.GetFocusedRowCellValue("Id")); Poz selectedVehicle = PozProvider.Instance.GetItem(id); selectedVehicle.IsActive = false; PozProvider.Instance.Save(selectedVehicle); this.LoadPozGrid(); } else { } }
public void getExcel() { pozItems = new List <Poz>(); OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Excel Files(*.xls;*.xlsx)|*.xls;*.xlsx"; if (dialog.ShowDialog() == DialogResult.OK) { DialogResult result = MessageBox.Show("Yüklemek istediğinizden emin misiniz?", "Yükleme Dosya içeriğine göre biraz zaman alabilir", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { try { pnlYuke.Visible = false; string filename = System.IO.Path.GetFileName(dialog.FileName); FileStream stream = System.IO.File.Open(dialog.FileName, FileMode.Open, FileAccess.Read); IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream); int i = 0; while (excelReader.Read()) { if (i > 0) { string pozno = string.Empty; try { pozno = excelReader.GetString(0); } catch (Exception ex) { double poznodouble = excelReader.GetDouble(0); pozno = poznodouble.ToString(); //LoggingManager.Instance.SaveErrorLog(ex); } string description = excelReader.GetString(1); string unit = excelReader.GetString(2); double unitprice = 0; try { unitprice = excelReader.GetDouble(3); } catch (Exception ex) { //LoggingManager.Instance.SaveErrorLog(ex); } if (!string.IsNullOrEmpty(pozno) && !string.IsNullOrEmpty(description) && !string.IsNullOrEmpty(unit)) { List <PozModel> existingPozs = UIPozManager.Instance.GetPozs(pozno, description); if (existingPozs != null && existingPozs.Count != 0) { listBox1.Items.Add(existingPozs.First().Number); listBox1.Items.Add(existingPozs.First().Description); listBox1.Items.Add(existingPozs.First().Unit); listBox1.Items.Add(existingPozs.First().UnitPrice); } else { Poz poz = new Poz(); poz.Number = pozno; poz.Description = description; poz.Unit = unit; poz.UnitPrice = unitprice; poz.Year = DateTime.Now.Year; poz.IsActive = true; Application.DoEvents(); lblPosSayisi.Text = i.ToString(); pozItems.Add(poz); listBox1.Items.Add(poz.Number); listBox1.Items.Add(poz.Description); listBox1.Items.Add(poz.Unit); listBox1.Items.Add(poz.UnitPrice); } listBox1.Items.Add("-------------------------------------------------------------"); listBox1.TopIndex = listBox1.Items.Count - 1; } } i++; } if (pozItems == null || pozItems.Count == 0) { pnlYuke.Visible = false; MessageBox.Show("Yüklenecek yeni poz bulunamadı."); this.Close(); return; } LoadingManager.Instance.Hide(); this.Hide(); frm_TopluPozTemp pozTemp = new frm_TopluPozTemp(this._owner); pozTemp.pozItems = pozItems; pozTemp.ShowDialog(); frm_MesajFormu mesaj = new frm_MesajFormu(); mesaj.lblMesaj.Text = "Pozlar başarıyla yüklendi..."; mesaj.Close(); } catch (Exception ex) { LoadingManager.Instance.Hide(); pnlYuke.Visible = true; MessageBox.Show("Beklenmedik bir sorunla karşılaşıldı.."); } } else { pnlYuke.Visible = true; } } }
public void getExcel() { materialListItems = new List <MaterialList>(); OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Excel Files(*.xls;*.xlsx)|*.xls;*.xlsx"; if (dialog.ShowDialog() == DialogResult.OK) { DialogResult result = MessageBox.Show("Yüklemek istediğinizden emin misiniz?", "Yükleme Dosya içeriğine göre biraz zaman alabilir", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result.Equals(DialogResult.Yes)) { try { pnlYuke.Visible = false; string filename = System.IO.Path.GetFileName(dialog.FileName); FileStream stream = System.IO.File.Open(dialog.FileName, FileMode.Open, FileAccess.Read); IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream); int i = 0; while (excelReader.Read()) { if (i > 0) { int pozId = 0; string pozno = string.Empty; try { pozno = excelReader.GetString(0); } catch (Exception ex) { double poznodouble = excelReader.GetDouble(0); pozno = poznodouble.ToString(); } string description = excelReader.GetString(1); string unit = excelReader.GetString(2); if (!string.IsNullOrEmpty(pozno) && !string.IsNullOrEmpty(description)) { List <Poz> existingPozs = UIPozManager.Instance.GetExistingPozs(pozno, description); if (existingPozs != null && existingPozs.Count != 0) { //poz = existingPozs.First(); pozId = existingPozs.First().Id; listBox1.Items.Add(existingPozs.First().Number); listBox1.Items.Add(existingPozs.First().Description); listBox1.Items.Add(existingPozs.First().Unit); lblPosSayisi.Text = i.ToString(); } else { Poz poz = new Poz(); poz.Number = pozno; poz.Description = description; poz.Unit = unit; poz.UnitPrice = 0; poz.Year = DateTime.Now.Year; poz.IsActive = true; PozProvider.Instance.Save(poz); pozId = poz.Id; lblPosSayisi.Text = i.ToString(); listBox1.Items.Add(poz.Number); listBox1.Items.Add(poz.Description); listBox1.Items.Add(poz.Unit); } double quantity = 0; try { quantity = excelReader.GetDouble(3); } catch (Exception ex) { } listBox1.Items.Add(quantity.ToString()); listBox1.Items.Add("-------------------------------------------------------------"); listBox1.TopIndex = listBox1.Items.Count - 1; if (pozId != 0) { MaterialList materialList = new MaterialList(); materialList.IsPoz = true; materialList.PozOBFId = pozId; materialList.Quantity = (float)quantity; materialList.KDVPercentage = 18; materialList.Tender = UICurrentManager.Instance.CurrentTender; materialList.TenderGroupId = this._owner.SelectedGroupId; materialListItems.Add(materialList); } } } i++; } stream.Close(); this.Hide(); if (this.materialListItems == null || this.materialListItems.Count == 0) { pnlYuke.Visible = true; MessageBox.Show("Yüklenecek Poz bulunamadı."); this.Close(); return; } frm_TopluPozIhaleTemp pozTemp = new frm_TopluPozIhaleTemp(this._owner); pozTemp.MaterialListItems = materialListItems; pozTemp.ShowDialog(); frm_MesajFormu mesaj = new frm_MesajFormu(); mesaj.lblMesaj.Text = "Pozlar başarıyla yüklendi..."; mesaj.Close(); } catch (Exception ex) { pnlYuke.Visible = true; MessageBox.Show("Beklenmedik bir sorunla karşılaşıldı.."); } } else { pnlYuke.Visible = true; } } }
private void buildmodel() { getFaseOrder(); // Poz = 0; objectsCount = 0; textBox4.Text = Poz.ToString(); var minX = Points[0].X; var minY = Points[0].Y; var maxX = Points[0].X; var maxY = Points[0].Y; foreach (var pt in Points) { if (minX > pt.X) { minX = pt.X; } if (minY > pt.Y) { minY = pt.Y; } if (maxX < pt.X) { maxX = pt.X; } if (maxY < pt.Y) { maxY = pt.Y; } } var width = maxX - minX; float height = maxY - minY; var imgH = (float)captureImageBox.Image.Bitmap.Height; var imgW = (float)captureImageBox.Image.Bitmap.Width; var cofWPre = (minX) / height; var cofWSuf = (imgW - maxX) / height; var cofHPre = (minY) / imgH; var cofHSuf = (imgH - maxY) / imgH; if (textBox5.Text != "") { cofWPre = float.Parse(textBox5.Text); } else { textBox5.Text = cofWPre.ToString(); } if (textBox6.Text != "") { cofWSuf = float.Parse(textBox6.Text); } else { textBox6.Text = cofWSuf.ToString(); } if (textBox7.Text != "") { cofHPre = float.Parse(textBox7.Text); } else { textBox7.Text = cofHPre.ToString(); } if (textBox8.Text != "") { cofHSuf = float.Parse(textBox8.Text); } else { textBox8.Text = cofHSuf.ToString(); } cof = width / imgH / 2.0f; pointCounts = Points.Count; _body = new Point3d[pointCounts]; textureMatrix = new PointF[pointCounts]; var count = Points.Count; if (checkUseProf.Checked) { int min = Zpos.Min(); for (int i = 0; i < count; i++) { _body[i] = new Point3d( ((Points[i].X - minX) / imgH) - cof, 0.5f - ((Points[i].Y - minY) / imgH), (Zpos[i] - min) / imgH ); textureMatrix[i] = new PointF( cofWPre + (Points[i].X - minX) / height, -(cofHPre) - ((Points[i].Y - minY) / imgH)); } } else { var rZ = new StreamReader("my_Z.txt"); rZ.ReadLine(); for (var i = 0; i < count; i++) { _body[i] = new Point3d( ((Points[i].X - minX) / imgH) - cof, 0.5f - ((Points[i].Y - minY) / imgH), float.Parse(rZ.ReadLine()) / 1.0f ); textureMatrix[i] = new PointF( cofWPre + (Points[i].X - minX) / height, -(cofHPre) - ((Points[i].Y - minY) / imgH)); } rZ.Close(); } }