Пример #1
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtName.Text))
     {
         DialogResult dialogResult = MessageBox.Show("Kaydı Eklemek İstediğinize Emin misiniz?", "Yeni Kayıt", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (dialogResult == DialogResult.Yes)
         {
             Tools      tools      = new Tools();
             UnitofWork unitofWork = new UnitofWork(ctx);
             CateringCompanies_Service cateringCompanies_Service = new CateringCompanies_Service(unitofWork);
             CateringCompanies         cateringCompanies         = new CateringCompanies();
             cateringCompanies.Name         = txtName.Text;
             cateringCompanies.Descriptions = txtDescriptions.Text;
             cateringCompanies.Code         = tools.CreateCode();
             if (cateringCompanies_Service.Insert(cateringCompanies))
             {
                 txtName.Text         = "";
                 txtDescriptions.Text = "";
                 MessageBox.Show("İşlem Başarılı", "");
             }
             else
             {
                 MessageBox.Show("Hata Oluştu", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("Boş Geçilemez.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #2
0
        private void btnCateringAssets_Click(object sender, EventArgs e)
        {
            DailyCastingEntryType = 3;

            #region Left Menu Color Change
            btnCateringAssets.BackColor   = Color.LightGray;
            btnRestaurantCash.BackColor   = Color.WhiteSmoke;
            btnCatering.BackColor         = Color.WhiteSmoke;
            btnPersonal.BackColor         = Color.WhiteSmoke;
            btnRestaurantCredit.BackColor = Color.WhiteSmoke;
            btnRestaurantFood.BackColor   = Color.WhiteSmoke;
            #endregion

            #region Catering Assets Control Items
            pnlInput.Controls.Clear();
            Label(pnlInput, "Firma", 38, 20);
            cmbCateringCustomer = Combobox(pnlInput, "cmbCateringCustomer", 40, 45);

            cmbCateringCustomer.SelectedIndexChanged += new EventHandler(cmbCateringCustomer_SelectedIndexChanged);

            UnitofWork unitofWork = new UnitofWork(ctx);
            CateringCompanies_Service cateringCompanies_Service = new CateringCompanies_Service(unitofWork);
            List <CateringCompanies>  CateringCompanyList       = new List <CateringCompanies>();
            CateringCompanyList.Add(new CateringCompanies()
            {
                Code = "", Name = "Firma Seçiniz..."
            });
            CateringCompanyList.AddRange(cateringCompanies_Service.GetAllCateringCompanies());
            cmbCateringCustomer.DataSource    = CateringCompanyList;
            cmbCateringCustomer.DisplayMember = "Name";
            cmbCateringCustomer.ValueMember   = "Code";

            Label(pnlInput, "Ödenmemiş Günler", 38, 75);
            checkedListBox = CheckedListBox(pnlInput, "clbAssetDays", 40, 100, 220);

            #endregion
        }
Пример #3
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            #region General Services
            UnitofWork unitofWork = new UnitofWork(ctx);
            DailyCastingEntry_TotalRevenue_Service dailyCastingEntry_TotalRevenue_Service = new DailyCastingEntry_TotalRevenue_Service(unitofWork);
            #endregion

            if (DailyCastingEntryType == 1)
            {
                DateTime CastingDate = Convert.ToDateTime(string.Format("{0: dd/MM/yyyy 00:00:00}", DateTime.Now));
                decimal  Price       = nudPrice.Value;
                string   Desciptions = txtDesciptions.Text;
                if (Price > 0)
                {
                    DialogResult dialogResult = MessageBox.Show("Kaydı Eklemek İstediğinize Emin misiniz?", "Yeni Kayıt", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (dialogResult == DialogResult.Yes)
                    {
                        DailyCastingEntry_Personal_Service dailyCastingEntry_Personal_Service = new DailyCastingEntry_Personal_Service(unitofWork);
                        DailyCastingEntry_Personal         dailyCastingEntry_Personal         = new DailyCastingEntry_Personal
                        {
                            CastingDate  = CastingDate,
                            Status       = Status.Active,
                            Price        = Price,
                            Descriptions = Desciptions
                        };

                        if (dailyCastingEntry_Personal_Service.Insert(dailyCastingEntry_Personal))
                        {
                            DailyCastingEntry_TotalRevenue dailyCastingEntry_TotalRevenue = dailyCastingEntry_TotalRevenue_Service.GetTotalRevenue(CastingDate);
                            if (dailyCastingEntry_TotalRevenue != null)
                            {
                                if (dailyCastingEntry_TotalRevenue.Personal_ReelPrice > 0)
                                {
                                    dailyCastingEntry_TotalRevenue.Personal_ReelPrice  += Price;
                                    dailyCastingEntry_TotalRevenue.Personal_TotalPrice += Price;
                                }
                                else
                                {
                                    dailyCastingEntry_TotalRevenue.Personal_ReelPrice  = Price;
                                    dailyCastingEntry_TotalRevenue.Personal_TotalPrice = Price;
                                }

                                if (dailyCastingEntry_TotalRevenue_Service.Update(dailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                DailyCastingEntry_TotalRevenue newDailyCastingEntry_TotalRevenue = new DailyCastingEntry_TotalRevenue
                                {
                                    Personal_ReelPrice  = Price,
                                    Personal_TotalPrice = Price,
                                    Status      = Status.Active,
                                    CastingDate = CastingDate
                                };
                                if (dailyCastingEntry_TotalRevenue_Service.Insert(newDailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            nudPrice.Value      = 0;
                            txtDesciptions.Text = "";
                        }
                        else
                        {
                            MessageBox.Show("Hata Oluştu.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Boş Geçilemez.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else if (DailyCastingEntryType == 2)
            {
                #region Variables
                DateTime CastingDate    = Convert.ToDateTime(string.Format("{0: dd/MM/yyyy 00:00:00}", DateTime.Now));
                decimal  Price          = nudPrice.Value;
                int      NumberOfPeople = Convert.ToInt32(nudNumberOfPeope.Value);
                string   CateringCode   = cmbCateringCustomer.SelectedValue.ToString();
                string   PaymentMade    = cmbCateringPayment.Text;
                string   InvoiceCut     = cmbCateringInvoice.Text;
                #endregion

                #region Service Instance
                CateringCompanies_Service          cateringCompanies_Service          = new CateringCompanies_Service(unitofWork);
                DailyCastingEntry_Catering_Service dailyCastingEntry_Catering_Service = new DailyCastingEntry_Catering_Service(unitofWork);
                #endregion

                if (Price > 0 && NumberOfPeople > 0 && !string.IsNullOrEmpty(CateringCode) && !string.IsNullOrEmpty(cmbCateringInvoice.Text) && !string.IsNullOrEmpty(cmbCateringPayment.Text))
                {
                    DialogResult dialogResult = MessageBox.Show("Kaydı Eklemek İstediğinize Emin misiniz?", "Yeni Kayıt", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (dialogResult == DialogResult.Yes)
                    {
                        DailyCastingEntry_Catering dailyCastingEntry_Catering = new DailyCastingEntry_Catering()
                        {
                            CastingDate     = CastingDate,
                            CompanyCode     = cateringCompanies_Service.GetCateringCompanies(CateringCode).Code,
                            CateringCompany = cateringCompanies_Service.GetCateringCompanies(CateringCode).Name,
                            NumberOfPeople  = NumberOfPeople,
                            Price           = Price,
                            Status          = Status.Active,
                            PaymentMade     = PaymentMade,
                            InvoiceCut      = InvoiceCut
                        };
                        if (dailyCastingEntry_Catering_Service.Insert(dailyCastingEntry_Catering))
                        {
                            DailyCastingEntry_TotalRevenue dailyCastingEntry_TotalRevenue = dailyCastingEntry_TotalRevenue_Service.GetTotalRevenue(CastingDate);
                            if (dailyCastingEntry_TotalRevenue != null)
                            {
                                if (PaymentMade == "Yapıldı")
                                {
                                    dailyCastingEntry_TotalRevenue.Catering_ReelPrice = dailyCastingEntry_TotalRevenue.Catering_ReelPrice > 0 ? dailyCastingEntry_TotalRevenue.Catering_ReelPrice + Price : Price;
                                }
                                dailyCastingEntry_TotalRevenue.Catering_TotalPrice = dailyCastingEntry_TotalRevenue.Catering_TotalPrice > 0 ? dailyCastingEntry_TotalRevenue.Catering_TotalPrice + Price : Price;

                                dailyCastingEntry_TotalRevenue.Catering_NumberOfPeople = dailyCastingEntry_TotalRevenue.Catering_NumberOfPeople > 0 ? dailyCastingEntry_TotalRevenue.Catering_NumberOfPeople + NumberOfPeople : NumberOfPeople;

                                if (dailyCastingEntry_TotalRevenue_Service.Update(dailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                #region DailyCastingEntry_TotalRevenue Yeni Kayıt Oluşturuluyor ve Catering Bilgileri Ekleniyor.
                                dailyCastingEntry_TotalRevenue = new DailyCastingEntry_TotalRevenue
                                {
                                    CastingDate             = CastingDate,
                                    Catering_NumberOfPeople = NumberOfPeople,
                                    Catering_TotalPrice     = Price,
                                    Catering_ReelPrice      = PaymentMade == "Yapıldı" ? Price : 0
                                };

                                if (dailyCastingEntry_TotalRevenue_Service.Insert(dailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı.");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                                #endregion
                            }

                            nudPrice.Value                    = 0;
                            nudNumberOfPeope.Value            = 0;
                            cmbCateringCustomer.SelectedIndex = 0;
                        }
                        else
                        {
                            MessageBox.Show("İşlem Başarısız.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Boş Geçilemez.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else if (DailyCastingEntryType == 3)
            {
                #region Variables
                var CateringCustomerCode = cmbCateringCustomer.SelectedValue.ToString();
                #endregion

                #region Service Instance
                CateringCompanies_Service          cateringCompanies_Service          = new CateringCompanies_Service(unitofWork);
                DailyCastingEntry_Catering_Service dailyCastingEntry_Catering_Service = new DailyCastingEntry_Catering_Service(unitofWork);
                #endregion

                if (checkedListBox.CheckedItems.Count > 0)
                {
                    DialogResult dialogResult = MessageBox.Show("Kaydı Eklemek İstediğinize Emin misiniz?", "Yeni Kayıt", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (dialogResult == DialogResult.Yes)
                    {
                        for (int i = 0; i < checkedListBox.CheckedItems.Count; i++)
                        {
                            DateTime Date  = Convert.ToDateTime(checkedListBox.CheckedItems[i].ToString().Split('(')[0].Trim());
                            decimal  Price = Convert.ToDecimal(checkedListBox.CheckedItems[i].ToString().Split(':')[1].Replace(")", "").Trim());

                            List <DailyCastingEntry_Catering> dailyCastingEntry_CateringList = dailyCastingEntry_Catering_Service.GetAllCateringPaymentCasting().Where(x => x.CastingDate == Date && x.CompanyCode == CateringCustomerCode && x.Price == Price && x.PaymentMade == "Yapılmadı").ToList();
                            if (dailyCastingEntry_CateringList.Count > 0)
                            {
                                dailyCastingEntry_CateringList[0].PaymentMade = "Yapıldı";
                                if (dailyCastingEntry_Catering_Service.Update(dailyCastingEntry_CateringList[0]))
                                {
                                    DailyCastingEntry_TotalRevenue dailyCastingEntry_TotalRevenue = dailyCastingEntry_TotalRevenue_Service.GetTotalRevenue(Date);
                                    if (dailyCastingEntry_TotalRevenue != null)
                                    {
                                        dailyCastingEntry_TotalRevenue.Catering_ReelPrice = dailyCastingEntry_TotalRevenue.Catering_ReelPrice > 0 ? dailyCastingEntry_TotalRevenue.Catering_ReelPrice + dailyCastingEntry_CateringList[0].Price : dailyCastingEntry_CateringList[0].Price;

                                        dailyCastingEntry_TotalRevenue_Service.Update(dailyCastingEntry_TotalRevenue);
                                    }
                                }
                            }
                            MessageBox.Show("İşlem Başarılı");
                            checkedListBox.Items.Clear();
                            var CateringCode = cmbCateringCustomer.SelectedValue.ToString();
                            List <DailyCastingEntry_Catering> dailyCastingEntry_Caterings = dailyCastingEntry_Catering_Service.GetAllCateringPaymentCasting().Where(x => x.CompanyCode == CateringCode && x.PaymentMade == "Yapılmadı").ToList();
                            if (dailyCastingEntry_Caterings.Count > 0)
                            {
                                dailyCastingEntry_Caterings.ForEach(x =>
                                {
                                    checkedListBox.Items.Add(string.Format("{0: dd/MM/yyyy}", x.CastingDate) + " ( Tutar: " + x.Price + " )");
                                });
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Boş Geçilemez.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            else if (DailyCastingEntryType == 4)
            {
                #region Variables
                DateTime CastingDate    = Convert.ToDateTime(string.Format("{0: dd/MM/yyyy 00:00:00}", DateTime.Now));
                decimal  Price          = nudPrice.Value;
                int      NumberOfPeople = Convert.ToInt32(nudNumberOfPeope.Value);
                #endregion

                if (Price > 0 && NumberOfPeople > 0)
                {
                    DialogResult dialogResult = MessageBox.Show("Kaydı Eklemek İstediğinize Emin misiniz?", "Yeni Kayıt", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (dialogResult == DialogResult.Yes)
                    {
                        DailyCastingEntry_Restaurant_Cash dailyCastingEntry_Restaurant_Cash = new DailyCastingEntry_Restaurant_Cash()
                        {
                            CastingDate    = CastingDate,
                            NumberOfPeople = NumberOfPeople,
                            Price          = Price,
                            Status         = Status.Active
                        };
                        DailyCastingEntry_Restaurant_Cash_Service dailyCastingEntry_Restaurant_Cash_Service = new DailyCastingEntry_Restaurant_Cash_Service(unitofWork);
                        if (dailyCastingEntry_Restaurant_Cash_Service.Insert(dailyCastingEntry_Restaurant_Cash))
                        {
                            DailyCastingEntry_TotalRevenue dailyCastingEntry_TotalRevenue = dailyCastingEntry_TotalRevenue_Service.GetTotalRevenue(CastingDate);
                            if (dailyCastingEntry_TotalRevenue != null)
                            {
                                dailyCastingEntry_TotalRevenue.RestaurantCash_ReelPrice = dailyCastingEntry_TotalRevenue.RestaurantCash_ReelPrice > 0 ? dailyCastingEntry_TotalRevenue.RestaurantCash_ReelPrice + Price : Price;

                                dailyCastingEntry_TotalRevenue.RestaurantCash_TotalPrice = dailyCastingEntry_TotalRevenue.RestaurantCash_TotalPrice > 0 ? dailyCastingEntry_TotalRevenue.RestaurantCash_TotalPrice + Price : Price;

                                dailyCastingEntry_TotalRevenue.RestaurantCash_NumberOfPeople = dailyCastingEntry_TotalRevenue.RestaurantCash_NumberOfPeople > 0 ? dailyCastingEntry_TotalRevenue.RestaurantCash_NumberOfPeople + NumberOfPeople : NumberOfPeople;

                                if (dailyCastingEntry_TotalRevenue_Service.Update(dailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                #region DailyCastingEntry_TotalRevenue Yeni Kayıt Oluşturuluyor ve Catering Bilgileri Ekleniyor.
                                dailyCastingEntry_TotalRevenue = new DailyCastingEntry_TotalRevenue
                                {
                                    RestaurantCash_NumberOfPeople = NumberOfPeople,
                                    RestaurantCash_TotalPrice     = Price,
                                    RestaurantCash_ReelPrice      = Price,
                                    CastingDate = CastingDate
                                };

                                if (dailyCastingEntry_TotalRevenue_Service.Insert(dailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                                #endregion
                            }

                            nudNumberOfPeope.Value = 0;
                            nudPrice.Value         = 0;
                        }
                        else
                        {
                            MessageBox.Show("İşlem Başarısız.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Boş Geçilemez.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else if (DailyCastingEntryType == 5)
            {
                #region Variables
                DateTime CastingDate    = Convert.ToDateTime(string.Format("{0: dd/MM/yyyy 00:00:00}", DateTime.Now));
                string   BankName       = cmbBanks.Text;
                string   BankCode       = cmbBanks.SelectedValue.ToString();
                decimal  Price          = nudPrice.Value;
                int      NumberOfPeople = Convert.ToInt32(nudNumberOfPeope.Value);
                #endregion

                #region Services
                Banks_Service banks_Service = new Banks_Service(unitofWork);
                DailyCastingEntry_Restaurant_Bank_Service dailyCastingEntry_Restaurant_Bank_Service = new DailyCastingEntry_Restaurant_Bank_Service(unitofWork);
                #endregion

                if (!string.IsNullOrEmpty(BankCode) && Price > 0 && NumberOfPeople > 0)
                {
                    DialogResult dialogResult = MessageBox.Show("Kaydı Eklemek İstediğinize Emin misiniz?", "Yeni Kayıt", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (dialogResult == DialogResult.Yes)
                    {
                        Banks banks = banks_Service.GetBanks(BankCode);
                        DailyCastingEntry_Restaurant_Bank dailyCastingEntry_Restaurant_Bank = new DailyCastingEntry_Restaurant_Bank()
                        {
                            BankName       = banks.BankName,
                            BankCode       = banks.BankCode,
                            CastingDate    = CastingDate,
                            NumberOfPeople = NumberOfPeople,
                            Price          = Price,
                            Status         = Status.Active
                        };
                        if (dailyCastingEntry_Restaurant_Bank_Service.Insert(dailyCastingEntry_Restaurant_Bank))
                        {
                            DailyCastingEntry_TotalRevenue dailyCastingEntry_TotalRevenue = dailyCastingEntry_TotalRevenue_Service.GetTotalRevenue(CastingDate);
                            if (dailyCastingEntry_TotalRevenue != null)
                            {
                                dailyCastingEntry_TotalRevenue.RestaurantBank_ReelPrice = dailyCastingEntry_TotalRevenue.RestaurantBank_ReelPrice > 0 ? dailyCastingEntry_TotalRevenue.RestaurantBank_ReelPrice + Price : Price;

                                dailyCastingEntry_TotalRevenue.RestaurantBank_TotalPrice = dailyCastingEntry_TotalRevenue.RestaurantBank_TotalPrice > 0 ? dailyCastingEntry_TotalRevenue.RestaurantBank_TotalPrice + Price : Price;

                                dailyCastingEntry_TotalRevenue.RestaurantBank_NumberOfPeople = dailyCastingEntry_TotalRevenue.RestaurantBank_NumberOfPeople > 0 ? dailyCastingEntry_TotalRevenue.RestaurantBank_NumberOfPeople + NumberOfPeople : NumberOfPeople;

                                if (dailyCastingEntry_TotalRevenue_Service.Update(dailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                dailyCastingEntry_TotalRevenue = new DailyCastingEntry_TotalRevenue
                                {
                                    RestaurantBank_NumberOfPeople = NumberOfPeople,
                                    RestaurantBank_TotalPrice     = Price,
                                    RestaurantBank_ReelPrice      = Price,
                                    CastingDate = CastingDate
                                };

                                if (dailyCastingEntry_TotalRevenue_Service.Insert(dailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            };

                            cmbBanks.SelectedIndex = 0;
                            nudPrice.Value         = 0;
                            nudNumberOfPeope.Value = 0;
                        }
                        else
                        {
                            MessageBox.Show("İşlem Başarısız.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Boş Geçilemez.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else if (DailyCastingEntryType == 6)
            {
                #region Variables
                DateTime CastingDate    = Convert.ToDateTime(string.Format("{0: dd/MM/yyyy 00:00:00}", DateTime.Now));
                string   Name           = cmbFoods.Text;
                string   Code           = cmbFoods.SelectedValue.ToString();
                decimal  Price          = nudPrice.Value;
                int      NumberOfPeople = Convert.ToInt32(nudNumberOfPeope.Value);
                #endregion

                #region Services
                FoodCards_Service foodCards_Service = new FoodCards_Service(unitofWork);
                DailyCastingEntry_Restaurant_Food_Service dailyCastingEntry_Restaurant_Food_Service = new DailyCastingEntry_Restaurant_Food_Service(unitofWork);
                #endregion

                if (!string.IsNullOrEmpty(Code) && Price > 0 && NumberOfPeople > 0)
                {
                    DialogResult dialogResult = MessageBox.Show("Kaydı Eklemek İstediğinize Emin misiniz?", "Yeni Kayıt", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (dialogResult == DialogResult.Yes)
                    {
                        FoodCards foodCards = foodCards_Service.GetFoodCards(Code);
                        DailyCastingEntry_Restaurant_Food dailyCastingEntry_Restaurant_Food = new DailyCastingEntry_Restaurant_Food()
                        {
                            FoodCardCode   = foodCards.Code,
                            FoodCardName   = foodCards.Name,
                            CastingDate    = CastingDate,
                            NumberOfPeople = NumberOfPeople,
                            Price          = Price,
                            Status         = Status.Active
                        };
                        if (dailyCastingEntry_Restaurant_Food_Service.Insert(dailyCastingEntry_Restaurant_Food))
                        {
                            DailyCastingEntry_TotalRevenue dailyCastingEntry_TotalRevenue = dailyCastingEntry_TotalRevenue_Service.GetTotalRevenue(CastingDate);
                            if (dailyCastingEntry_TotalRevenue != null)
                            {
                                dailyCastingEntry_TotalRevenue.RestaurantFood_ReelPrice = dailyCastingEntry_TotalRevenue.RestaurantFood_ReelPrice > 0 ? dailyCastingEntry_TotalRevenue.RestaurantFood_ReelPrice + Price : Price;

                                dailyCastingEntry_TotalRevenue.RestaurantFood_TotalPrice = dailyCastingEntry_TotalRevenue.RestaurantFood_TotalPrice > 0 ? dailyCastingEntry_TotalRevenue.RestaurantFood_TotalPrice + Price : Price;

                                dailyCastingEntry_TotalRevenue.RestaurantFood_NumberOfPeople = dailyCastingEntry_TotalRevenue.RestaurantFood_NumberOfPeople > 0 ? dailyCastingEntry_TotalRevenue.RestaurantFood_NumberOfPeople + NumberOfPeople : NumberOfPeople;

                                if (dailyCastingEntry_TotalRevenue_Service.Update(dailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                dailyCastingEntry_TotalRevenue = new DailyCastingEntry_TotalRevenue
                                {
                                    RestaurantFood_NumberOfPeople = NumberOfPeople,
                                    RestaurantFood_TotalPrice     = Price,
                                    RestaurantFood_ReelPrice      = Price,
                                    CastingDate = CastingDate
                                };

                                if (dailyCastingEntry_TotalRevenue_Service.Insert(dailyCastingEntry_TotalRevenue))
                                {
                                    MessageBox.Show("İşlem Başarılı");
                                }
                                else
                                {
                                    MessageBox.Show("İşlem Başarısız", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }

                            cmbFoods.SelectedIndex = 0;
                            nudPrice.Value         = 0;
                            nudNumberOfPeope.Value = 0;
                        }
                        else
                        {
                            MessageBox.Show("İşlem Başarısız.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Boş Geçilemez.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Пример #4
0
        private void btnCatering_Click(object sender, EventArgs e)
        {
            DailyCastingEntryType = 2;

            #region Left Menu Color Change
            btnCatering.BackColor         = Color.LightGray;
            btnPersonal.BackColor         = Color.WhiteSmoke;
            btnRestaurantCash.BackColor   = Color.WhiteSmoke;
            btnRestaurantCredit.BackColor = Color.WhiteSmoke;
            btnRestaurantFood.BackColor   = Color.WhiteSmoke;
            btnCateringAssets.BackColor   = Color.WhiteSmoke;
            #endregion

            #region Catering Control Inputs
            pnlInput.Controls.Clear();

            Label(pnlInput, "Firma", 38, 20);
            cmbCateringCustomer = Combobox(pnlInput, "cmbCateringCustomer", 40, 45);

            UnitofWork unitofWork = new UnitofWork(ctx);
            CateringCompanies_Service cateringCompanies_Service = new CateringCompanies_Service(unitofWork);
            List <CateringCompanies>  CateringCompanyList       = new List <CateringCompanies>();
            CateringCompanyList.Add(new CateringCompanies()
            {
                Code = "", Name = "Firma Seçiniz..."
            });
            CateringCompanyList.AddRange(cateringCompanies_Service.GetAllCateringCompanies());
            cmbCateringCustomer.DataSource    = CateringCompanyList;
            cmbCateringCustomer.DisplayMember = "Name";
            cmbCateringCustomer.ValueMember   = "Code";

            Label(pnlInput, "Tutar", 38, 75);
            nudPrice = NumericUpDown(pnlInput, "nudPrice", 40, 100);

            Label(pnlInput, "Kişi Sayısı", 38, 130);
            nudNumberOfPeope = NumericUpDown(pnlInput, "nudNumberOfPeope", 40, 155);

            Label(pnlInput, "Fatura", 38, 185);
            cmbCateringInvoice = Combobox(pnlInput, "cmbCateringInvoice", 40, 210);
            List <SelectListItem> CateringInvoiceList = new List <SelectListItem>();
            CateringInvoiceList.Add(new SelectListItem()
            {
                Value = "0", Text = "Fatura Durumunu Seçiniz..."
            });
            CateringInvoiceList.Add(new SelectListItem()
            {
                Value = "1", Text = "Kesildi"
            });
            CateringInvoiceList.Add(new SelectListItem()
            {
                Value = "2", Text = "Kesilmedi"
            });
            cmbCateringInvoice.DataSource    = CateringInvoiceList;
            cmbCateringInvoice.DisplayMember = "Text";
            cmbCateringInvoice.ValueMember   = "Value";

            Label(pnlInput, "Ödeme", 38, 240);
            cmbCateringPayment = Combobox(pnlInput, "cmbCateringPayment", 40, 265);
            List <SelectListItem> CateringPaymentList = new List <SelectListItem>();
            CateringPaymentList.Add(new SelectListItem()
            {
                Value = "0", Text = "Ödeme Durumunu Seçiniz..."
            });
            CateringPaymentList.Add(new SelectListItem()
            {
                Value = "1", Text = "Yapıldı"
            });
            CateringPaymentList.Add(new SelectListItem()
            {
                Value = "2", Text = "Yapılmadı"
            });
            cmbCateringPayment.DataSource    = CateringPaymentList;
            cmbCateringPayment.DisplayMember = "Text";
            cmbCateringPayment.ValueMember   = "Value";
            #endregion
        }