private void imgAddProduct_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { var window = new W_AddProductForOrder() { Title = "Siparise Urun Ekle", ShowInTaskbar = false, Topmost = true, ResizeMode = ResizeMode.CanMinimize, Owner = Application.Current.MainWindow, }; if (window.ShowDialog() == false) { BLL.Product AddedProduct = window.AddedProduct; if (AddedProduct != null) { if (IfExistsSameProductOrNot(AddedProduct)) { MessageBox.Show("Seçmiş olduğunuz yay zaten siparişte mevcut!!"); } else { this.oNewAddedProductList.Add(AddedProduct); this.oProductList.Add(AddedProduct); dgOrderProduct.Items.Add(AddedProduct); CalculateTotalProductionTimeForNewProduct(AddedProduct); dgOrderProduct.Items.Refresh(); } } } } }
public W_AddProductForOrder(BLL.Product _oproduct) { InitializeComponent(); LoadData(); m_SelectedProduct = _oproduct; LoadDetail(); cmbProduct.SelectionChanged += CmbProduct_SelectionChanged; cmbColor.SelectionChanged += CmbColor_SelectionChanged; }
private void CmbProduct_SelectionChanged(object sender, SelectionChangedEventArgs e) { m_SelectedProduct = new BLL.Product(Int32.Parse(cmbProduct.SelectedValue.ToString()), OzyaysanBusinessEngine.Enumarations.State.Aktif); if (cmbColor.SelectedValue.ToString() != "0") { ColoredStock = new BLL.Stock(m_SelectedProduct.ID, Int32.Parse(cmbColor.SelectedValue.ToString())); txtStockColored.Text = ColoredStock.Count.ToString(); } NonColoredStock = new BLL.Stock(m_SelectedProduct.ID); txtStockNonColored.Text = NonColoredStock.Count.ToString(); }
bool IfExistsSameProductOrNot(BLL.Product SelectedProduct) { foreach (BLL.Product item in this.oProductList) { if (SelectedProduct.ID == item.ID) { return(true); } } return(false); }
bool IfExistsSameProductOrNot(BLL.Product SelectedProduct) { foreach (BLL.Product item in dgOrderProduct.Items) { if (SelectedProduct.ID == item.ID) { return(true); } } return(false); }
private void CalculateTotalProductionTime(BLL.Product P) { DataTable dt = BLL.Product.CalculateProductionTimeByPIDAndCount(P.ID, P.ProductionCount); if (dt.Rows.Count > 0) { if (dt.Rows[0]["ProductionTime"] != null && dt.Rows[0]["ProductionTime"].ToString() != "") { totalProductionTime += Int32.Parse(dt.Rows[0]["ProductionTime"].ToString()) / 420; string DayValue = (totalProductionTime).ToString(); lblTotalProductionTime.Content = DayValue; } } }
private void imgProductSearch_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { var window = new W_PickProductForOrder() { Title = "Yay Seçme Formu", ShowInTaskbar = false, Topmost = true, ResizeMode = ResizeMode.NoResize, Owner = Application.Current.MainWindow, }; if (window.ShowDialog() == false) { BLL.Product PickedProduct = window.SelectedProduct; cmbProduct.SelectedValue = PickedProduct.ID; } } }
private void LoadData() { LoadDDLs(); if (this.PID != 0) { BLL.Product oProduct = new BLL.Product(PID, BLL.Enumarations.State.Aktif); txtCode.Text = oProduct.Code; txtDiameter.Text = oProduct.Diameter.ToString(); txtWireDiameter.Text = oProduct.WireDiameter.ToString(); //txtNumForms.Text = oProduct.NumberOfForm.ToString(); txtNumTurns.Text = oProduct.NumberOfTurns.ToString(); txtRawMatarialCharacters.Text = oProduct.RawMaterialsCharacteristic; txtStraighteningLength.Text = oProduct.StraighteningLength.ToString(); //txtPrice.Text = oProduct.Price.ToString(); txtWeight.Text = oProduct.Weight.ToString(); cmbCategory.SelectedValue = oProduct.CategoryID; //cmbState.SelectedValue = (int)oProduct.State; } }
private void btnAddProductToOrder_Click(object sender, RoutedEventArgs e) { string strVal = ValidationMethot(); if (strVal == "") { this.m_AddedProduct = new BLL.Product(Int32.Parse(cmbProduct.SelectedValue.ToString()), BLL.Enumarations.State.Aktif); this.m_AddedProduct.OrderCount = Int32.Parse(txtOrderCount.Text); this.m_AddedProduct.CColor = new BLL.Color(Int32.Parse(cmbColor.SelectedValue.ToString()), OzyaysanBusinessEngine.Enumarations.State.Aktif); this.m_AddedProduct.CurrentPackageType = txtPackageType.Text; this.m_AddedProduct.CurrentOPStatus = (int)BLL.Enumarations.OrderStatus.İmalataHazır; this.m_AddedProduct.UsedStockCountColored = Int32.Parse((txtStockColoredUse.Text.Trim() == "")?0.ToString():txtStockColoredUse.Text.Trim()); this.m_AddedProduct.UsedStockCountNonColored = Int32.Parse((txtStockNonColoredUse.Text.Trim() == "") ? 0.ToString() : txtStockNonColoredUse.Text.Trim()); this.m_AddedProduct.ProductionCount = Int32.Parse((txtProductionCount.Text.Trim() == "") ? 0.ToString() : txtProductionCount.Text.Trim()); this.Close(); } else { MessageBox.Show(strVal); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { string strVal = ValidationMethot(); if (strVal == "") { BLL.Product oProduct = new BLL.Product(Int32.Parse(cmbProduct.SelectedValue.ToString()), BLL.Enumarations.State.Aktif); // oProduct.Stock += Int32.Parse(txtAddedStockAmount.Text); if (oProduct.Save() == 0) { MessageBox.Show("İşlem başarılı"); } else { MessageBox.Show("Kayıt esnasında bir hata oluştu"); } } else { MessageBox.Show(strVal); } }
private void LoadData() { DataTable dtCustomer = BLL.Customer.GetCustomerListForDDL(); cmbCustomer.ItemsSource = dtCustomer.DefaultView; cmbCustomer.DisplayMemberPath = dtCustomer.Columns["CName"].ToString(); cmbCustomer.SelectedValuePath = dtCustomer.Columns["CID"].ToString(); cmbCustomer.SelectedIndex = 0; dtDetailedOrder = BLL.Order.GetOrderDetailListByOrderID(this.OID); ListBoxItem lbItem; foreach (DataRow oRow in dtDetailedOrder.Rows) { BLL.Product _product = new BLL.Product(Int32.Parse(oRow["PID"].ToString()), BLL.Enumarations.State.Aktif); _product.OrderCount = Int32.Parse(oRow["OrderCount"].ToString()); _product.UsedStockCountColored = Int32.Parse(oRow["UsedStockCountColored"].ToString()); _product.UsedStockCountNonColored = Int32.Parse(oRow["UsedStockCountNonColored"].ToString()); _product.ProductionCount = Int32.Parse(oRow["ProductionCount"].ToString()); _product.CColor = new BLL.Color(Int32.Parse(oRow["Color"].ToString()), OzyaysanBusinessEngine.Enumarations.State.Aktif); _product.CurrentPackageType = oRow["PackageType"].ToString(); this.oProductList.Add(_product); dgOrderProduct.Items.Add(_product); } //DataTable dtColor = BLL.Color.GetColorListForDDL(); //cmbColor.ItemsSource = dtColor.DefaultView; //cmbColor.DisplayMemberPath = dtColor.Columns["CName"].ToString(); //cmbColor.SelectedValuePath = dtColor.Columns["CID"].ToString(); //cmbColor.SelectedIndex = 0; //DataTable dtState = BLL.Utility.GetStateListForDDLWithoutChose(); //cmbState.ItemsSource = dtState.DefaultView; //cmbState.DisplayMemberPath = dtState.Columns["SName"].ToString(); //cmbState.SelectedValuePath = dtState.Columns["SID"].ToString(); //cmbState.SelectedIndex = 1; }
private void btnSave_Click(object sender, RoutedEventArgs e) { try { string strVal = ValidationMethot(); if (strVal == "") { BLL.Product oProduct = new BLL.Product(); if (this.PID == 0) { oProduct.ID = 0; } else { oProduct.ID = PID; } oProduct.Code = txtCode.Text; oProduct.ExtraCode1 = txtExtraKod1.Text; oProduct.ExtraCode2 = txtExtraKod2.Text; oProduct.ExtraCode3 = txtExtraKod3.Text; oProduct.ExtraCode4 = txtExtraKod4.Text; oProduct.Picture1 = "None.png"; oProduct.Picture2 = "None.png"; oProduct.Picture3 = "None.png"; oProduct.Picture4 = "None.png"; oProduct.TecniquePicture = "None.png"; foreach (TempPicture item in PictureList) { switch (item.PictureIndex) { case 1: oProduct.Picture1 = item.SavedFileName; break; case 2: oProduct.Picture2 = item.SavedFileName; break; case 3: oProduct.Picture3 = item.SavedFileName; break; case 4: oProduct.Picture4 = item.SavedFileName; break; case 5: oProduct.TecniquePicture = item.SavedFileName; break; default: break; } } oProduct.Diameter = float.Parse((txtDiameter.Text.Trim() == "")?0.ToString():txtDiameter.Text.Trim()); oProduct.WireDiameter = float.Parse((txtWireDiameter.Text.Trim() == "") ? 0.ToString() : txtWireDiameter.Text.Trim()); oProduct.Name = txtCode.Text; //oProduct.NumberOfForm = Int32.Parse(txtNumForms.Text); oProduct.NumberOfTurns = Int32.Parse((txtNumTurns.Text.Trim() == "") ? 0.ToString() : txtNumTurns.Text.Trim()); oProduct.RawMaterialsCharacteristic = txtRawMatarialCharacters.Text; oProduct.State = BLL.Enumarations.State.Aktif; oProduct.StraighteningLength = float.Parse((txtStraighteningLength.Text.Trim() == "") ? 0.ToString() : txtStraighteningLength.Text.Trim()); oProduct.Price = 0;// kaldırıldı oProduct.Weight = float.Parse((txtWeight.Text.Trim() == "") ? 0.ToString() : txtWeight.Text.Trim()); BLL.Category oCategory = new BLL.Category(); oProduct.Category = oCategory; oProduct.Category.ID = Int32.Parse(cmbCategory.SelectedValue.ToString()); //if ( oProduct.Category.ID==1) //{ // oProduct.HatveArasi = Int32.Parse(txtHatve.Text); // oProduct.ToplamBoy = Int32.Parse(txtToplamBoy.Text); //} //else if (oProduct.Category.ID==2) //{ // oProduct.KancaArasi = Int32.Parse(txtKancaArasi.Text); // oProduct.Ictenice = Int32.Parse(txtIctenice.Text); // oProduct.KancaYonu = txtkancaYon.Text; //} // oProduct.Stock = Int32.Parse(txtStock.Text); int nResult = oProduct.Save(); if (nResult == 0) { foreach (TempPicture item in PictureList) { if (item.IsTecniqueImage) { CopyTecniqueImageToSharedImageFolder(item.FilePath, item.FileName, item.SavedFileName); } else { CopyImageToSharedImageFolder(item.FilePath, item.FileName, item.SavedFileName); } } MessageBox.Show("Yeni yay ekleme işlemi başarılı bir şekilde tamamlandı.Şimdi yay için üretim aşaması ekleme formuna yönlendiriliyorsunuz."); var window = new W_AddProductionPhase(oProduct.ID) { Title = "Üretim Aşaması Ekle", ShowInTaskbar = false, Topmost = true, ResizeMode = ResizeMode.CanMinimize, Owner = Application.Current.MainWindow, WindowStartupLocation = WindowStartupLocation.CenterScreen }; if (window.ShowDialog() == false) { (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentSearchProduct.Visibility = Visibility.Hidden; (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentAddProduct.Visibility = Visibility.Hidden; (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentProductDetail.Visibility = Visibility.Visible; Ozyaysan.UserControls.UCProductDetail oWindowsProductDetail = new UserControls.UCProductDetail(oProduct.ID); (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentProductDetail.Children.Clear(); (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentProductDetail.Children.Add(oWindowsProductDetail); } } else if (nResult == 3) { MessageBox.Show("Bu OEM kodlu yay daha önce eklenmiş !!"); } else { MessageBox.Show("Kayıt esnasında bir hata oluştu !!"); } } else { MessageBox.Show(strVal); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void Button_Click(object sender, RoutedEventArgs e) { this.SelectedProduct = new BLL.Product(Int32.Parse((sender as Button).CommandParameter.ToString()), BLL.Enumarations.State.Aktif); this.Close(); }
private void LoadDetail() { BLL.Product oProduct = new BLL.Product(this.PID, BLL.Enumarations.State.Aktif); // lblStock.Content = oProduct.Stock; // kontrol edilecek lblStotalCount.Content = this.TotalCount; }