private void UpdateGeneralOrderStatus(int Status)
        {
            BLL.Order oOrder = new BLL.Order(this.OID, BLL.Enumarations.State.Aktif);
            if (dtDetailedOrder.Rows.Count == 1)
            {
                oOrder.OrderStatus = (BLL.Enumarations.OrderStatus)Status;
                if (oOrder.Save() == 0)
                {
                    MessageBox.Show("İşlem başarılı");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Kayıt işlemi sırasında bir hata oluştu");
                }
            }
            else if (dtDetailedOrder.Rows.Count > 1)
            {
                switch (Status)
                {
                case 3:    //boyahane
                    if (!IsExistSmallerStatus((int)BLL.Enumarations.OrderStatus.Boyahanede))
                    {
                        oOrder.OrderStatus = BLL.Enumarations.OrderStatus.Boyahanede;
                    }
                    break;

                case 4:    //boyanıyor
                    if (!IsExistSmallerStatus((int)BLL.Enumarations.OrderStatus.Boyanıyor))
                    {
                        oOrder.OrderStatus = BLL.Enumarations.OrderStatus.Boyanıyor;
                    }
                    break;

                case 5:    //hazır
                    if (!IsExistSmallerStatus((int)BLL.Enumarations.OrderStatus.Hazir))
                    {
                        oOrder.OrderStatus = BLL.Enumarations.OrderStatus.Hazir;
                    }
                    break;

                case 6:    //gönderildi
                    if (!IsExistSmallerStatus((int)BLL.Enumarations.OrderStatus.Gonderildi))
                    {
                        oOrder.OrderStatus = BLL.Enumarations.OrderStatus.Gonderildi;
                    }
                    break;

                default:
                    break;
                }
                if (oOrder.Save() == 0)
                {
                    MessageBox.Show("İşlem başarılı");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Kayıt işlemi sırasında bir hata oluştu");
                }
            }
        }
Exemplo n.º 2
0
        private void Click_btnSave()
        {
            using (TransactionScope scope1 = new TransactionScope(TransactionScopeOption.Required))
            {
                try
                {
                    string strVal = ValidationMethot();
                    if (strVal == "")
                    {
                        BLL.Order oOrder = new BLL.Order();
                        oOrder.CustomerID     = Int32.Parse(cmbCustomer.SelectedValue.ToString());
                        oOrder.DateOfDelivery = dpDateOfDelivery.SelectedDate.Value;
                        string a = String.Format("{0:d/M/yyyy HH:mm:ss}", oOrder.DateOfDelivery);
                        oOrder.DateOfDelivery2 = a;
                        oOrder.MinState        = BLL.Enumarations.State.Aktif;
                        oOrder.OrderStatus     = BLL.Enumarations.OrderStatus.İmalataHazır;
                        oOrder.State           = BLL.Enumarations.State.Aktif;
                        oOrder.Products        = "";
                        foreach (BLL.Product item in dgOrderProduct.Items)
                        {
                            oOrder.Products += "," + item.ID.ToString() + "";
                        }
                        oOrder.Products += ",";
                        oOrder.EstimatedTotalProductionTime = Int32.Parse(lblProductionTime.Content.ToString());
                        //if (txtTutar.Text!="")
                        //{
                        //    oOrder.TotalCost = decimal.Parse(txtTutar.Text);
                        //}

                        int firstResult  = -1;
                        int secondResult = -1;
                        firstResult = oOrder.Save();
                        if (firstResult == 0)
                        {
                            foreach (BLL.Product item in dgOrderProduct.Items)
                            {
                                secondResult = BLL.Order.SaveOrderDetail(oOrder.ID, item.ID, item.OrderCount, item.UsedStockCountColored, item.UsedStockCountNonColored, item.ProductionCount, item.CColor.ID, item.CurrentPackageType, item.CurrentOPStatus);
                                if (secondResult == 0)
                                {
                                    (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentSearchOrder.Visibility = Visibility.Hidden;
                                    (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentAddOrder.Visibility    = Visibility.Hidden;
                                    (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentOrderDetail.Visibility = Visibility.Visible;
                                    Ozyaysan.UserControls.UCOrderDetail oWindowsOrderDetail = new UserControls.UCOrderDetail(oOrder.ID);
                                    (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentOrderDetail.Children.Clear();
                                    (((Start)((Grid)(((TabControl)(((TabItem)((Grid)((Grid)(this.Parent)).Parent).Parent).Parent)).Parent)).Parent)).GrdContentOrderDetail.Children.Add(oWindowsOrderDetail);
                                }
                            }
                        }
                        MessageBox.Show("İşlem Başarili");
                    }
                    else
                    {
                        MessageBox.Show(strVal);
                    }
                    scope1.Complete();
                }
                catch (System.Data.SqlClient.SqlException Exp)
                {
                    MessageBox.Show("Sql Hatası oluştu : " + Exp.Message);
                }
                catch (Exception Exp)
                {
                    MessageBox.Show("Hata oluştu : " + Exp.Message);
                }
            }
            #endregion
        }