Beispiel #1
0
        private void Btn_Add_Item_Click(object sender, EventArgs e)
        {
            TBL_Receive receive = new TBL_Receive();
            Tbl_Item    Item    = new Tbl_Item();

            if (txt_receive_date.Text == "" && txt_receive_num.Text == "")
            {
                txt_receive_date.Text = Convert.ToString(DateTime.Now);
                var maxid = brada.TBL_Receives.Max(s => s.recieve_num);
                txt_receive_num.Text = (maxid + 1).ToString();
            }
            txt_Packu_Cost.Clear();
            txt_Code_Item.Clear();
            txt_Item_Name.Clear();
            txt_Quantity_Int_Store.Visible = false;
            txt_Quantity_Number.Clear();
            txt_Peices_Num.Clear();
            txt_Validation_date.Clear();
            txt_TotalCost.Clear();
            Btn_Impleme_Update.Visible   = false;
            Btn_Delete_Confirm.Visible   = false;
            Btn_Add_Item_Confirm.Visible = true;
            Btn_Add_Item_Confirm.Text    = "تأكيد الإضافة";

            Combo_Hall_Name.Visible = false;
            label4.Visible          = false;

            label8.Visible = false;

            Btn_Decrease_Shlal.Visible = false;
            Btn_Increase_Shlal.Visible = false;
            label12.Visible            = false;
            label13.Visible            = false;

            txt_money_val.Visible        = false;
            txt_Store_Packu.Visible      = false;
            label15.Visible              = false;
            label17.Visible              = false;
            txt_Search_Store.Visible     = false;
            txt_Packu_Store_Cost.Visible = false;
        }
Beispiel #2
0
        private void Btn_Add_Item_Confirm_Click(object sender, EventArgs e)
        {
            TBL_Receive receive = new TBL_Receive();
            Tbl_Item    Item    = new Tbl_Item();

            if (txt_receive_date.Text != "" && txt_receive_num.Text != "")
            {
                if (!search(txt_Item_Name.Text))
                {
                    if (txt_Item_Name.Text != "" && txt_Quantity_Number.Text != "" && txt_Packu_Cost.Text != "" && txt_Validation_date.Text != "" && txt_TotalCost.Text != "")
                    {
                        if (txt_Item_Name.Text != "Empty !!" && txt_Quantity_Number.Text != "Empty !!" && txt_Packu_Cost.Text != "Empty !!" && txt_Validation_date.Text != "Empty !!" && txt_TotalCost.Text != "Empty !!")
                        {
                            receive.recieve_num  = int.Parse(txt_receive_num.Text);
                            receive.recieve_Date = DateTime.Parse(txt_receive_date.Text);
                            var   newnam            = txt_Item_Name.Text;
                            var   Quantity_num      = int.Parse(txt_Quantity_Number.Text);
                            int   Quantity_Num      = Convert.ToInt32(Quantity_num);
                            var   Peices_num        = int.Parse(txt_Peices_Num.Text);
                            int   Peices_Num        = Convert.ToInt32(Peices_num);
                            var   Price             = float.Parse(txt_Packu_Cost.Text);
                            float price             = Price;
                            var   date              = DateTime.Parse(txt_Validation_date.Text);
                            int   Quantity_Int      = Quantity_Num / Peices_Num;
                            int   Quantit_Int_Price = Convert.ToInt32(price * Peices_Num);
                            var   Quantity_int      = Quantity_Int;
                            var   total_cost        = float.Parse(txt_TotalCost.Text);
                            brada.TBL_Receives.InsertOnSubmit(receive);
                            brada.insert_tbl_Item2(newnam, Quantity_num, Price, Peices_num, Quantity_Int, date, total_cost, Quantit_Int_Price);
                            brada.SubmitChanges();
                            Btn_Add_Item_Confirm.Text = "تم الإضافة";

                            //string[] formats = { "MM/dd/yyyy", "M/d/yyyy", "M/dd/yyyy", "MM/d/yyyy" };
                            //foreach (var date in formats)
                            //{
                            //    if (txt_Validation_date.Text == date)
                            //    {

                            //    }
                            //    else
                            //    {
                            //        MessageBox.Show("Use MM/dd/yyyy formatting for date");
                            //    }
                            //}


                            //Item.ValidationDate = DateTime.Parse(txt_Validation_date.Text);
                            //string[] formats = { "MM/dd/yyyy", "M/d/yyyy", "M/dd/yyyy", "MM/d/yyyy" };
                            //string formats = "MM/dd/yyyy 00:00:00.000";
                            ////foreach (var date in formats)
                            ////{
                            //if (txt_Validation_date.Text == formats)
                            //{
                            //    Item.ValidationDate = DateTime.Parse(txt_Validation_date.Text);
                            //}
                            //else
                            //{
                            //    MessageBox.Show("Use MM/dd/yyyy formatting for date");
                            //}
                            //}
                            ////--------
                            //if (DateTime.TryParseExact(txt_Validation_date.Text, "MM/dd/yyyy", null, DateTimeStyles.None, out Test) == true)
                            //{
                            //}
                            //----
                            //DateTime dDate;
                            //if (DateTime.TryParse(txt_Validation_date.Text,out dDate) )
                            //{
                            //    String.Format("{0:d/MM/yyyy}", dDate);
                            //}
                        }
                        else
                        {
                            MessageBox.Show("برجاء املأ الخانات");
                        }
                    }
                    else
                    {
                        MessageBox.Show("برجاء املأ الخانات");
                    }
                    brada.SubmitChanges();
                    //txt_Item_Name.Text = txt_Quantity_Cost.Text = txt_Quantity_Integer.Text = txt_Quantity_Number.Text = txt_TotalCost.Text = txt_Validation_date.Text = "";
                }
                else
                {
                    MessageBox.Show("الاسم مكرر");
                }
            }
            else
            {
                MessageBox.Show("Press Add Item,إضغط إضافة صنف");
            }


            //else
            //{
            //    MessageBox.Show("Press Add Item,إضغط إضافة صنف");
            //}
            //-------------
            //-------------
            //if (txt_receive_date.Text!=""&&txt_receive_num.Text!="")
            //{
            //    if (txt_Item_Name.Text != "" && txt_Cost.Text != "" && txt_Quantity_Integer.Text != "" && txt_Quantity_Number.Text != "" && txt_TotalCost.Text != "" && txt_Validation_date.Text != "" && txt_receive_date.Text != "" && txt_receive_num.Text != "")
            //    {
            //        receive.recieve_num = int.Parse(txt_receive_num.Text);
            //        receive.recieve_Date = DateTime.Parse(txt_receive_date.Text);
            //        Item.Item_Name = txt_Item_Name.Text;
            //        Item.CostPrice = float.Parse(txt_Cost.Text);
            //        Item.QuantityInteger = int.Parse(txt_Quantity_Integer.Text);
            //        Item.QuantityNumber = int.Parse(txt_Quantity_Number.Text);
            //        Item.ValidationDate = DateTime.Parse(txt_Validation_date.Text);
            //        Item.TotalCost = float.Parse(txt_TotalCost.Text);

            //        brada.TBL_Receives.InsertOnSubmit(receive);
            //        brada.TblItems.InsertOnSubmit(Item);
            //        brada.SubmitChanges();
            //        Btn_Add_Item_Confirm.Text = "تم الإضافة";
            //    }
            //}

            label12.Visible = false;
            label13.Visible = false;

            txt_money_val.Visible   = false;
            txt_Store_Packu.Visible = false;

            label8.Visible = false;

            Btn_Decrease_Shlal.Visible   = false;
            Btn_Increase_Shlal.Visible   = false;
            label15.Visible              = false;
            label17.Visible              = false;
            txt_Search_Store.Visible     = false;
            txt_Packu_Store_Cost.Visible = false;
        }