コード例 #1
0
        void Creat_Ri_by_Color()
        {
            try
            {
                if (!CheckValidate_F())
                {
                    return;
                }

                c_j_ao  = Convert.ToInt16(txtCount_J.Text);
                c_from  = Convert.ToInt16(txtFromAge.Text);
                c_to    = Convert.ToInt16(txtToAge.Text);
                c_count = Convert.ToInt16(txtCount.Text);

                decimal _count = 0;
                foreach (Product_Detail_Info item in c_lst_Products_Detail)
                {
                    _count += item.Total_Count / c_count;
                }

                if (_count == c_j_ao)
                {
                    NoteBox.Show("Bạn đã nhập đủ số dây áo");
                    return;
                }

                frmCreate_Item _frmCreateItems = new frmCreate_Item();
                _frmCreateItems.Owner   = Window.GetWindow(this);
                _frmCreateItems.c_count = c_j_ao - _count;
                _frmCreateItems.ShowDialog();
                if (_frmCreateItems.c_ok == 1)
                {
                    Product_Detail_Info _Product_Detail_Info = new Product_Detail_Info();
                    _Product_Detail_Info.Name        = " Ri " + (c_lst_Products_Detail.Count + 1).ToString();
                    _Product_Detail_Info.Color_Id    = _frmCreateItems.c_ProductInfo.Color_Id;
                    _Product_Detail_Info.Total_Count = _frmCreateItems.c_ProductInfo.Count_Ri_by_Color * c_count;
                    _Product_Detail_Info.Ri_Count    = _frmCreateItems.c_ProductInfo.Count_Ri_by_Color;
                    _Product_Detail_Info.Size        = c_from.ToString() + " - " + c_to.ToString();
                    _Product_Detail_Info.Color_Name  = _frmCreateItems.c_ProductInfo.Color_Name;
                    c_lst_Products_Detail.Add(_Product_Detail_Info);

                    dgrProduct_VietNam.ItemsSource = c_lst_Products_Detail;
                    dgrProduct_VietNam.Items.Refresh();
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
コード例 #2
0
ファイル: Product_Controller.cs プロジェクト: dangtq72/Shop
        public bool Product_Detail_Insert(Product_Detail_Info p_Product_Detail_Info)
        {
            try
            {
                SqlParameter[] spParameter = new SqlParameter[6];

                spParameter[0]           = new SqlParameter("@Product_Id", SqlDbType.Int);
                spParameter[0].Direction = ParameterDirection.Input;
                spParameter[0].Value     = p_Product_Detail_Info.Product_Id;

                spParameter[1]           = new SqlParameter("@Color_Id", SqlDbType.Int);
                spParameter[1].Direction = ParameterDirection.Input;
                spParameter[1].Value     = p_Product_Detail_Info.Color_Id;

                spParameter[2]           = new SqlParameter("@Ri_Count", SqlDbType.Int);
                spParameter[2].Direction = ParameterDirection.Input;
                spParameter[2].Value     = p_Product_Detail_Info.Ri_Count;

                spParameter[3]           = new SqlParameter("@Total_Count", SqlDbType.Int);
                spParameter[3].Direction = ParameterDirection.Input;
                spParameter[3].Value     = p_Product_Detail_Info.Total_Count;

                spParameter[4]           = new SqlParameter("@Name", SqlDbType.NVarChar);
                spParameter[4].Direction = ParameterDirection.Input;
                spParameter[4].Value     = p_Product_Detail_Info.Name;

                spParameter[5]           = new SqlParameter("@Size", SqlDbType.NVarChar);
                spParameter[5].Direction = ParameterDirection.Input;
                spParameter[5].Value     = p_Product_Detail_Info.Size;

                SqlHelper.ExecuteNonQuery(CommonData.ConnectionString, CommandType.StoredProcedure, "proc_Product_Detail_Insert", spParameter);

                return(true);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                return(false);
            }
        }
コード例 #3
0
        void Add_Product()
        {
            try
            {
                if (txtCount.Text == "")
                {
                    NoteBox.Show("Nhập số lượng sản phẩm ", "", NoteBoxLevel.Error);
                    return;
                }
                if (c_Product_Info_Search == null)
                {
                    return;
                }

                decimal _count = Convert.ToDecimal(txtCount.Text);
                if (_count > c_Product_Info_Search.Total_Remain)
                {
                    NoteBox.Show("Mua nhiều thế !!!!! Số lượng trong hàng không đủ, hiện tại chỉ còn " + c_Product_Info_Search.Total_Remain.ToString(), "", NoteBoxLevel.Error);
                    txtCount.Focus();
                    txtCount.SelectAll();
                    return;
                }

                decimal _color_id = 0;

                if (cboColor.Text != "")
                {
                    _color_id = Convert.ToDecimal(cboColor.SelectedValue);
                    c_Product_Info_Search.Color_Name = cboColor.Text;
                    c_Product_Info_Search.Color_Id   = _color_id;

                    Product_Detail_Info _Product_Detail_Info = (Product_Detail_Info)cboColor.SelectedItem;

                    if (_count > _Product_Detail_Info.Remain_Count)
                    {
                        NoteBox.Show("Mua nhiều thế !!!!! Số lượng trong hàng không đủ, hiện tại chỉ còn " + _Product_Detail_Info.Remain_Count.ToString("###,###,0") + " sản phẩm", "", NoteBoxLevel.Error);
                        txtCount.Focus();
                        txtCount.SelectAll();
                        return;
                    }
                }

                string _key = c_Product_Info_Search.Product_Code.ToUpper() + "_" + _color_id.ToString();

                if (!c_hs_Product.ContainsKey(_key))
                {
                    c_Product_Info_Search.Count_Sale_By_Header = _count;
                    c_Product_Info_Search.Total_Price          = c_Product_Info_Search.Count_Sale_By_Header * c_Product_Info_Search.BanBuon_Price;
                    c_list_Product_Buy.Add(c_Product_Info_Search);

                    c_hs_Product[_key] = c_Product_Info_Search;
                }
                else
                {
                    Product_Info _Product_Info = (Product_Info)c_hs_Product[_key];
                    //_Product_Info.Count_Sale_By_Header = _Product_Info.Count_Sale_By_Header + _count;
                    _Product_Info.Count_Sale_By_Header = _count;
                    _Product_Info.Total_Price          = c_Product_Info_Search.Count_Sale_By_Header * c_Product_Info_Search.BanBuon_Price;
                }

                txtProductCode.Focus();
                txtProductCode.Text     = "";
                lblProduct_Name.Content = "";
                lblRemain.Content       = "";
                lblSalePrice.Content    = "";

                dgrProduct.ItemsSource = c_list_Product_Buy;
                dgrProduct.Items.Refresh();
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }