private void SaveProduct() { if (ProductName.Text != "") { using (invetoryEntities db = new invetoryEntities()) { product_master product_Master = new product_master { product = ProductName.Text, category_id = 1, //item_group_id = Convert.ToInt32(ItemGroup.SelectedValue), unit_id = Convert.ToInt32(Unit.SelectedValue), alternat_unit_id = Convert.ToInt32(AlternetUnit.SelectedValue), mrp = Convert.ToDecimal(MRP.Text), rate_on = 1, tax_type = 1, sale_rate_on = 1, rate_persantage = 1, discount_consumer = 1, discount_other = 1, discount_on_qty = 1, brokerage = 1, min_qty = 1, order_qty = 1, status = 1, created_on = DateTime.Now, }; db.product_master.Add(product_Master); db.SaveChanges(); product_expenses_master product_Expenses_Master = new product_expenses_master { adhat = (Adhat.Text == ""?0:Convert.ToDecimal(Adhat.Text)), adhat_unit_id = Convert.ToInt32(AdhatPer.SelectedValue), taulai = (Taulai.Text == "" ? 0 : Convert.ToDecimal(Taulai.Text)), taulai_unit_id = Convert.ToInt32(TaulaiPer.SelectedValue), majoori = (Majoori.Text == "" ? 0 : Convert.ToDecimal(Majoori.Text)), majoori_unit_id = Convert.ToInt32(MajooriPer.SelectedValue), packing = (Packing.Text == "" ? 0 : Convert.ToDecimal(Packing.Text)), packing_unit_id = Convert.ToInt32(PackingPer.SelectedValue), mandi_sulk = (MundiSulk.Text == "" ? 0 : Convert.ToDecimal(MundiSulk.Text)), mandi_sulk_unit_id = Convert.ToInt32(MundiSulkPer.SelectedValue), vikash_sesh = (VikashSesh.Text == "" ? 0 : Convert.ToDecimal(VikashSesh.Text)), vikash_sesh_unit_id = Convert.ToInt32(VikashSeshPer.SelectedValue), packing_less = (PackingLess.Text == "" ? 0 : Convert.ToDecimal(VikashSesh.Text)), packing_less_unit_id = Convert.ToInt32(PackingLessPer.SelectedValue), product_id = product_Master.id, created_on = DateTime.Now, status = 1 }; db.product_expenses_master.Add(product_Expenses_Master); db.SaveChanges(); MessageBox.Show("Product save successfully."); //Clear_Form(); } } else { MessageBox.Show("Please fill compulsory data."); } }
private void Button_Click_Modify(object sender, RoutedEventArgs e) { if (StockGroupName.Text != "") { using (invetoryEntities db = new invetoryEntities()) { var StockGroupID = Convert.ToInt32(StockGroupId.Text); if (db.stock_group_master.Where(x => x.id == StockGroupID).ToList().Count > 0) { var stockgroup = db.stock_group_master.Where(x => x.id == StockGroupID).FirstOrDefault(); stockgroup.name = StockGroupName.Text; db.SaveChanges(); MessageBox.Show("Stock Group updated successfully."); Clear_Form(); } else { MessageBox.Show("Something went wrong please try again."); } } } else { MessageBox.Show("Please fill compulsory data."); } }
private void Button_Click_Delete(object sender, RoutedEventArgs e) { MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure?", "Delete Confirmation", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) // error is here { if (datagrid.SelectedIndex >= 0) { under_master under = datagrid.SelectedItem as under_master; using (invetoryEntities db = new invetoryEntities()) { if (db.under_master.Where(x => x.id == under.id).ToList().Count > 0) { db.under_master.Remove(db.under_master.Find(under.id)); db.SaveChanges(); MessageBox.Show("Under deleted successfully."); LoadGrid(); } else { MessageBox.Show("Something went wrong please try again."); } } } } else { MessageBox.Show("Delete operation Terminated"); } }
private void Button_Click_Save(object sender, RoutedEventArgs e) { if (ProductName.Text != "" && TransactionType.SelectedValue.ToString() != "" && Price.Text != "" && Quantity.Text != "") { using (invetoryEntities db = new invetoryEntities()) { db.stock_detail.Add(new stock_detail { product_id = Convert.ToInt32(ProductName.SelectedValue), transaction_type = Convert.ToInt32(TransactionType.SelectedValue), quantity = Convert.ToInt32(Quantity.Text), price = Convert.ToDecimal(Price.Text), created_date = DateTime.Now, company_id = 1 }); db.SaveChanges(); MessageBox.Show("Stock Added successfully."); Clear_Form(); } } else { MessageBox.Show("Please fill compulsory data."); } }
private void Button_Click_Modify(object sender, RoutedEventArgs e) { if (GodownName.Text != "" && GodownName.Text != "") { using (invetoryEntities db = new invetoryEntities()) { var GodownID = Convert.ToInt32(GodownId.Text); if (db.godown_master.Where(x => x.id == GodownID).ToList().Count > 0) { var godown = db.godown_master.Where(x => x.id == GodownID).FirstOrDefault(); godown.name = GodownName.Text; godown.Address = Address.Text; db.SaveChanges(); MessageBox.Show("Godown updated successfully."); Clear_Form(); } else { MessageBox.Show("Something went wrong please try again."); } } } else { MessageBox.Show("Please fill compulsory data."); } }
private void Button_Click_Modify(object sender, RoutedEventArgs e) { if (UnitName.Text != "" && ShortCode.Text != "") { using (invetoryEntities db = new invetoryEntities()) { var UnitID = Convert.ToInt32(UnitId.Text); if (db.unit_master.Where(x => x.id == UnitID).ToList().Count > 0) { var unit = db.unit_master.Where(x => x.id == UnitID).FirstOrDefault(); unit.name = UnitName.Text; unit.code = ShortCode.Text; db.SaveChanges(); MessageBox.Show("Unit updated successfully."); Clear_Form(); } else { MessageBox.Show("Something went wrong please try again."); } } } else { MessageBox.Show("Please fill compulsory data."); } }
private void Delete() { MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure?", "Delete Confirmation", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) // error is here { if (datagrid.SelectedIndex >= 0) { company_master company = datagrid.SelectedItem as company_master; using (invetoryEntities db = new invetoryEntities()) { if (db.company_master.Where(x => x.id == company.id).ToList().Count > 0) { db.company_master.Remove(db.company_master.Find(company.id)); db.SaveChanges(); MessageBox.Show("Company deleted successfully."); LoadGrid(); } else { MessageBox.Show("Something went wrong please try again."); } } } } else { MessageBox.Show("Delete operation Terminated"); } }
private void Button_Click_Save(object sender, RoutedEventArgs e) { using (invetoryEntities db = new invetoryEntities()) { db.company_master.Add(new company_master { name = Name.Text, address = Address.Text, finanacial_year = Financialyear.SelectedDate.Value, pin_no = PINNo.Text }); db.SaveChanges(); MessageBox.Show("Company save successfully."); Creal_Form(); } }
private void Save() { try { if (LedgerName.Text != "") { using (invetoryEntities db = new invetoryEntities()) { ledger_master ledger_Master = new ledger_master { name = LedgerName.Text, under_id = Convert.ToInt32(UnderName.SelectedValue), billing_style = BillingStyle.Text, opening_balance = Convert.ToDecimal(OpeningBalance.Text), credit_debit_type = Convert.ToInt32(CreditDebitType.SelectedValue), print_name = PrintName.Text, owner_name = OwnerName.Text, address = Address.Text, state = 1, pin_code = PinCode.Text, mobile = Mobile.Text, aadhar_no = AadharNo.Text, email = EmailID.Text, area = Area.Text, agent = 1, interest = Convert.ToBoolean(Interest.SelectedValue), credit_priod = 1, less_priod = 1, interest_rate = 1, description = Description.Text, company_id = 1, created_on = DateTime.Now, }; db.ledger_master.Add(ledger_Master); db.SaveChanges(); MessageBox.Show("Ledger saved successfully."); } } else { MessageBox.Show("Please fill compulsory data."); } } catch (Exception ex) { } }
private void Button_Click_Save(object sender, RoutedEventArgs e) { if (StockGroupName.Text != "") { using (invetoryEntities db = new invetoryEntities()) { db.stock_group_master.Add(new stock_group_master { name = StockGroupName.Text }); db.SaveChanges(); MessageBox.Show("Stock Group save successfully."); Clear_Form(); } } else { MessageBox.Show("Please fill compulsory data."); } }
private void Button_Click_Save(object sender, RoutedEventArgs e) { if (GodownName.Text != "" && GodownName.Text != "") { using (invetoryEntities db = new invetoryEntities()) { db.godown_master.Add(new godown_master { name = GodownName.Text, Address = Address.Text }); db.SaveChanges(); MessageBox.Show("Godown save successfully."); Clear_Form(); } } else { MessageBox.Show("Please fill compulsory data."); } }
private void Button_Click_Save(object sender, RoutedEventArgs e) { if (UnitName.Text != "" && ShortCode.Text != "") { using (invetoryEntities db = new invetoryEntities()) { db.unit_master.Add(new unit_master { name = UnitName.Text, code = ShortCode.Text }); db.SaveChanges(); MessageBox.Show("Unit save successfully."); Clear_Form(); } } else { MessageBox.Show("Please fill compulsory data."); } }
private void Save() { if (SerialNo.Text != null && SerialNo.Text != "") { using (invetoryEntities db = new invetoryEntities()) { purchase_master purchase_master = new purchase_master { serial_no = Convert.ToInt32(SerialNo.Text), book_no = Convert.ToInt32(BookNo.Text), purchase_date = PurchaseInvoiceDate.SelectedDate, party_name_id = Convert.ToInt32(PartyName.SelectedValue), supplier_invoice_no = Convert.ToInt32(SupplierInvoiceNo.Text), purchase_date1 = Date.SelectedDate, gross_amount = Convert.ToDecimal(GrossAmount.Text), paking_amount = Convert.ToDecimal(Paking.Text), dis_amount = Convert.ToDecimal(Dis.Text), other_charges = Convert.ToDecimal(OtherCharges.Text), round_off = Convert.ToDecimal(RoundOff.Text), net_amount = Convert.ToDecimal(NetAmount.Text), status = 1, created_by = 1, company_id = 1, created_on = DateTime.Now, }; db.purchase_master.Add(purchase_master); db.SaveChanges(); db.purchase_expenses.Add(new purchase_expenses { purchase_id = purchase_master.purchase_id, adhat = Convert.ToDecimal(Adhat.Text), taulai = Convert.ToDecimal(Taulai.Text), majoori = Convert.ToDecimal(Majdoori.Text), packing = Convert.ToDecimal(Packing.Text), mandi_sulk = Convert.ToDecimal(MandiSulk.Text), vikash_sesh = Convert.ToDecimal(VikashSesh.Text), other = Convert.ToDecimal(Other.Text), status = 1, company_id = 1, created_by = 1, created_on = DateTime.Now }); db.SaveChanges(); List <SalesInvoiceCollectionViewModel> salesInvoiceCollectionViewModels = (List <SalesInvoiceCollectionViewModel>)PurchaseInvoiceDataGrid.ItemsSource; for (int i = 0; i < salesInvoiceCollectionViewModels.Count - 1; i++) { purchase_details purchase_details = new purchase_details { purchase_id = purchase_master.purchase_id, product_id = Convert.ToInt32(salesInvoiceCollectionViewModels[i].name), sr_no = Convert.ToInt32(salesInvoiceCollectionViewModels[i].sr), alternate_qty = salesInvoiceCollectionViewModels[i].qty.ToString(), gross_weight = Convert.ToDecimal(salesInvoiceCollectionViewModels[i].grossnet), less = Convert.ToDecimal(salesInvoiceCollectionViewModels[i].less), net_weight = salesInvoiceCollectionViewModels[i].netweight.ToString(), rate = Convert.ToDecimal(salesInvoiceCollectionViewModels[i].rate), per = salesInvoiceCollectionViewModels[i].per, amount = Convert.ToDecimal(salesInvoiceCollectionViewModels[i].amount), created_by = 1, company_id = 1, created_on = DateTime.Now, status = 1 }; db.purchase_details.Add(purchase_details); db.SaveChanges(); } MessageBox.Show("Purchase save successfully."); //Clear_Form(); } } else { MessageBox.Show("Please fill compulsory data."); } }