protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int rowIndex = e.RowIndex; Good good = new Good(); good.Good_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value); GoodProvider provider = new GoodProvider(); if (provider.Delete(good)) { this.Alert("删除成功!!!"); if (this.txt_Position.Text == "") { this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1; this.BindSource(null); } else { this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1; this.BindSource("%" + this.txt_Position.Text + "%"); } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Convert.ToInt32(e.CommandArgument); if (e.CommandName.Equals("outbound")) { Good good = new Good(); good.Good_name = this.GridView1.Rows[rowIndex].Cells[0].Text; good.Good_code = this.GridView1.Rows[rowIndex].Cells[3].Text; GoodProvider goodProvider = new GoodProvider(); DataTable table = goodProvider.Select(good); if (table.Rows.Count != 0) { Warehouse warehouse = new Warehouse(); Warehouse_info warehouse_info = new Warehouse_info(); warehouse.Good_id = Convert.ToInt32(table.Rows[0]["good_id"]); warehouse.Warehouse_type = "出库"; warehouse_info.Good_id = Convert.ToInt32(table.Rows[0]["good_id"]); WarehouseInfoProvider warehouseInfoProvider = new WarehouseInfoProvider(); table = warehouseInfoProvider.Select(warehouse_info); WarehouseProvider warehouseProvider = new WarehouseProvider(); Shop shop = new Shop(); shop.Shop_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value); ShopProvider shopProvider = new ShopProvider(); if (table.Rows.Count != 0) { int number = Convert.ToInt32(table.Rows[0]["warehouse_info_number"]); if (number < Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text)) { this.Alert("仓库商品数量不足!!!"); } warehouse_info.Warehouse_info_number = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text); warehouse.Warehouse_number = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text); warehouse.Order_id = Convert.ToInt32(id); warehouse.Warehouse_operators = Session["LOGINED"].ToString(); warehouse.Warehouse_time = Convert.ToDateTime(DateTime.Now.ToString("HH:mm:ss")); warehouse_info.Warehouse_info_id = Convert.ToInt32(table.Rows[0]["warehouse_info_id"]); if (warehouseInfoProvider.UpdateOut(warehouse_info.Warehouse_info_number, warehouse_info.Warehouse_info_id)) { if (shopProvider.Delete(shop)) { if (warehouseProvider.Insert(warehouse)) { this.Alert("出库成功!"); Shop shop1 = new Shop(); shop.Order_id = Convert.ToInt32(id); ShopProvider provider = new ShopProvider(); this.ListPager1.RecordCount = provider.GetSize(shop1); this.BindSource(0); } } } } } else { this.Alert("没有此商品!!!"); } } }
/// <summary> /// 绑定Units信息的数据源 /// </summary> private void BindSource(int start) { Good good = new Good(); good.Product_id = 2; GoodProvider provider = new GoodProvider(); DataTable table = provider.Select(good, start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); }
protected void ddl_BrandName_SelectedIndexChanged(object sender, EventArgs e) { if (this.ddl_BrandName.SelectedValue.ToString() == "所有") { GoodProvider providers = new GoodProvider(); this.ListPager1.RecordCount = providers.GetSize(); this.BindSource(0, null); return; } this.BindSelect(); }
private void BindSource() { GoodProvider good = new GoodProvider(); this.ddl_good.DataSource = good.GetAll(); this.ddl_good.DataBind(); PlaceProvider place = new PlaceProvider(); this.ddl_place.DataSource = place.GetAll(); this.ddl_place.DataBind(); }
protected void btn_Result_Click(object sender, EventArgs e) { if (this.txt_Name.Text == "") { GoodProvider provider = new GoodProvider(); this.ListPager1.RecordCount = provider.GetSize(); this.BindSource(0); return; } this.BindSelect(); this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.GridView1.Columns[5].Visible = false; GoodProvider provider = new GoodProvider(); this.ListPager1.RecordCount = provider.GetSize(); this.BindSource(0, null); } this.account.Text = Session["LOGINED"].ToString(); this.datetime.Text = this.BindDayWeek(); this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange); }
private void BindText() { Good good = new Good(); good.Good_id = Convert.ToInt32(id); GoodProvider provider = new GoodProvider(); DataTable table = new DataTable(); table = provider.Select(good); this.Image1.ImageUrl = table.Rows[0]["good_img"].ToString(); this.txt_Name.Text = table.Rows[0]["good_name"].ToString(); this.txt_Num.Text = table.Rows[0]["good_num"].ToString(); }
protected void ddl_BrandName_SelectedIndexChanged(object sender, EventArgs e) { if (this.ddl_BrandName.SelectedValue.ToString() == "所有") { Good good = new Good(); good.Product_id = 1; GoodProvider provider = new GoodProvider(); DataTable table = provider.Select(good, 0, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); return; } this.BindSelect(); }
protected void btn_sure_Click(object sender, EventArgs e) { Good good = this.AddGood(); GoodProvider provider = new GoodProvider(); switch (this.OperationFlag) { case Operation.Add: if (good.Good_name == "") { this.Alert("警告:错误的产品名!!!!"); break; } if (good.Good_Num == "") { this.Alert("警告:错误的产品编号!!!!"); break; } Good newgood = new Good(); newgood.Good_Num = this.txt_Num.Text; //newgood.Good_name = this.txt_Name.Text; GoodProvider goodProvider = new GoodProvider(); DataTable table = new DataTable(); table = goodProvider.Select(newgood); if (table.Rows.Count == 0) { if (provider.Insert(good)) { this.Alert("添加成功!!!"); this.TextCancel(); } } else { this.Alert("代码和名称已经存在!!!"); } break; case Operation.Update: if (provider.UpdateInfo(good)) { this.Alert("修改成功!!!"); this.BindText(); } break; } }
protected void ddl_GoodId_SelectedIndexChanged(object sender, EventArgs e) { Good good = new Good(); GoodProvider provider = new GoodProvider(); String good_name = ""; good.Good_Num = this.ddl_GoodId.SelectedValue.ToString(); DataTable table = provider.Select(good); if (table != null && table.Rows.Count == 1) { good_name = table.Rows[0]["good_name"].ToString(); } StockProvider provider1 = new StockProvider(); table = provider1.GetStocks(this.ddl_GoodId.SelectedValue.ToString()); int min = 0; int max = 0; int sum = 0; int price = 0; for (int i = 0; i < table.Rows.Count; i++) { sum += Convert.ToInt32(table.Rows[i]["stock_num"]); price = Convert.ToInt32(table.Rows[i]["purchase_price"]); if (i == 0) { min = max = price; continue; } if (price < min) { min = price; } else if (price > max) { max = price; } } this.lbl_PriceRange.Text = " 采购价格最低为:" + min.ToString() + " 最高为:" + max.ToString(); this.lbl_StockNum.Text = "库存还剩:" + sum.ToString(); Session["STOCKSUM"] = sum.ToString(); this.txt_goodname.Text = good_name; this.txt_goodname.Enabled = false; }
private void BindText() { Good good = new Good(); good.Good_id = Convert.ToInt32(id); GoodProvider provider = new GoodProvider(); DataTable table = new DataTable(); table = provider.Select(good); this.text_Min.Text = table.Rows[0]["purchase_priceMin"].ToString(); this.text_Max.Text = table.Rows[0]["purchase_priceMax"].ToString(); this.txt_Name.Text = table.Rows[0]["good_name"].ToString(); this.txt_Num.Text = table.Rows[0]["good_num"].ToString(); }
private void BindSelect() { Good good = new Good(); good.Unit_id = Convert.ToInt32(this.ddl_Unit.SelectedValue); good.Brand_id = Convert.ToInt32(this.ddl_BrandName.SelectedValue); good.Good_name = "%" + this.txt_Name.Text + "%"; good.Product_id = 2; GoodProvider provider = new GoodProvider(); this.ListPager1.RecordCount = provider.GetSize(good); DataTable table = provider.Select(good, 0, this.ListPager1.RecordCount); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { id = Request.QueryString["id"].ToString(); } if (!IsPostBack) { this.BindDDL(); GoodProvider provider = new GoodProvider(); this.ListPager1.RecordCount = provider.GetSize(); this.BindSource(0, null); } this.account.Text = Session["LOGINED"].ToString(); this.datetime.Text = this.BindDayWeek(); this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange); }
/* * private void BindDDL() * { * ProductProvider product = new ProductProvider(); * this.ddl_Product.DataSource = product.GetAll(); * this.ddl_Product.DataBind(); * this.ddl_Product.Items.Add("所有"); * this.ddl_Product.SelectedIndex = this.ddl_Product.Items.Count - 1; * BrandProvider brand = new BrandProvider(); * this.ddl_BrandName.DataSource = brand.GetAll(); * this.ddl_BrandName.DataBind(); * this.ddl_BrandName.Items.Add("所有"); * this.ddl_BrandName.SelectedIndex = this.ddl_BrandName.Items.Count - 1; * } * * private void BindSelect() * { * Good good = new Good(); * if (this.ddl_BrandName.SelectedValue.ToString() != "所有") * { * good.Brand_id = Convert.ToInt32(this.ddl_BrandName.SelectedValue); * } * if (this.ddl_Product.SelectedValue.ToString() != "所有") * { * //good.Product_id = Convert.ToInt32(this.ddl_Product.SelectedValue); * } * //good.Good_code = this.txt_code.Text; * good.Good_name = "%" + this.txt_Name.Text + "%"; * GoodProvider provider = new GoodProvider(); * this.ListPager1.RecordCount = provider.GetSize(good); * DataTable table = provider.Select(good, 0, this.ListPager1.RecordCount); * this.GridView1.DataSource = table.DefaultView; * this.GridView1.DataBind(); * } */ /// <summary> /// 绑定good信息的数据源 /// </summary> private void BindSource(int start, string name) { if (name != null) { Good good = new Good(); good.Good_name = name; GoodProvider provider = new GoodProvider(); DataTable table = provider.Select(good, start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } else { GoodProvider provider = new GoodProvider(); DataTable table = provider.GetAll(start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } }
protected void btn_Result_Click(object sender, EventArgs e) { Good good = new Good(); GoodProvider provider = new GoodProvider(); if (this.txt_Name.Text == "") { if (this.txt_code.Text == "") { GoodProvider providers = new GoodProvider(); this.ListPager1.RecordCount = providers.GetSize(); this.BindSource(0, null); } else { good.Product_id = 2; good.Good_code = "%" + this.txt_code.Text + "%"; DataTable table = provider.Select(good, 0, this.ListPager1.RecordCount); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } } else { if (this.txt_code.Text == "") { good.Product_id = 2; good.Good_name = "%" + this.txt_Name.Text + "%"; this.ListPager1.RecordCount = provider.GetSize(good); this.BindSource(0, "%" + this.txt_Name.Text + "%"); } else { good.Product_id = 2; good.Good_name = "%" + this.txt_Name.Text + "%"; good.Good_code = "%" + this.txt_code.Text + "%"; DataTable table = provider.Select(good, 0, this.ListPager1.RecordCount); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } } this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange); }
private void BindText() { Good good = new Good(); good.Good_id = Convert.ToInt32(id); GoodProvider provider = new GoodProvider(); DataTable table = new DataTable(); table = provider.Select(good); this.txt_Color.Text = table.Rows[0]["good_color"].ToString(); this.txt_Code.Text = table.Rows[0]["good_code"].ToString(); this.txt_Description.Text = table.Rows[0]["good_description"].ToString(); this.Image1.ImageUrl = table.Rows[0]["good_img"].ToString(); this.txt_Name.Text = table.Rows[0]["good_name"].ToString(); this.txt_Num.Text = table.Rows[0]["good_num"].ToString(); this.txt_Price.Text = table.Rows[0]["good_price"].ToString(); this.txt_SellingPrice.Text = table.Rows[0]["good_selling_price"].ToString(); }
protected void btn_Result_Click(object sender, EventArgs e) { Good good = new Good(); GoodProvider provider = new GoodProvider(); if (this.txt_Position.Text == "") { GoodProvider providers = new GoodProvider(); this.ListPager1.RecordCount = providers.GetSize(); this.BindSource(0, null); } else { good.Good_name = "%" + this.txt_Position.Text + "%"; DataTable table = provider.Select(good, 0, this.ListPager1.RecordCount); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } }
protected void ddl_GoodId_SelectedIndexChanged(object sender, EventArgs e) { Good good = new Good(); GoodProvider provider = new GoodProvider(); good.Good_Num = this.ddl_GoodId.SelectedValue.ToString(); DataTable table = provider.Select(good); if (table != null && table.Rows.Count == 1) { good_name = table.Rows[0]["good_name"].ToString(); max = Convert.ToInt32(table.Rows[0]["purchase_priceMax"].ToString()); min = Convert.ToInt32(table.Rows[0]["purchase_priceMin"].ToString()); } this.lbl_PriceRange.Text = "²É¹º·¶Î§£º" + min.ToString() + " - " + max.ToString(); this.txt_goodname.Text = good_name; this.txt_goodname.Enabled = false; }
protected void btn_sure_Click(object sender, EventArgs e) { Good good = this.AddGood(); GoodProvider provider = new GoodProvider(); switch (this.OperationFlag) { case Operation.Update: if (good.Purchase_PriceMin > good.Purchase_PriceMax) { this.Alert("下限大于上限,请重新输入!!!!!!!!"); this.BindText(); break; } if (provider.UpdatePrice(good)) { this.Alert("修改成功!!!"); this.BindText(); } break; } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Convert.ToInt32(e.CommandArgument); if (e.CommandName.Equals("warehousing")) { Good good = new Good(); good.Good_name = this.GridView1.Rows[rowIndex].Cells[0].Text; ////good.Good_code = this.GridView1.Rows[rowIndex].Cells[3].Text; GoodProvider goodProvider = new GoodProvider(); DataTable table = goodProvider.Select(good); if (table.Rows.Count != 0) { Warehouse warehouse = new Warehouse(); Warehouse_info warehouse_info = new Warehouse_info(); warehouse.Good_id = Convert.ToInt32(table.Rows[0]["good_id"]); warehouse.Warehouse_type = "入库"; warehouse_info.Good_id = Convert.ToInt32(table.Rows[0]["good_id"]); WarehouseInfoProvider warehouseInfoProvider = new WarehouseInfoProvider(); table = warehouseInfoProvider.Select(warehouse_info); WarehouseProvider warehouseProvider = new WarehouseProvider(); Shop shop = new Shop(); shop.Shop_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value); ShopProvider shopProvider = new ShopProvider(); if (table.Rows.Count != 0) { warehouse_info.Warehouse_info_number = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text); warehouse.Warehouse_number = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text); warehouse.Order_id = Convert.ToInt32(id); warehouse.Warehouse_operators = Session["LOGINED"].ToString(); warehouse.Warehouse_time = Convert.ToDateTime(DateTime.Now.ToString("HH:mm:ss")); warehouse_info.Warehouse_info_id = Convert.ToInt32(table.Rows[0]["warehouse_info_id"]); if (warehouseInfoProvider.Update(warehouse_info.Warehouse_info_number, warehouse_info.Warehouse_info_id)) { if (shopProvider.Delete(shop)) { if (warehouseProvider.Insert(warehouse)) { this.Alert("入库成功!"); Shop shop1 = new Shop(); shop.Contrac_id = Convert.ToInt32(id); ContractShopProvider provider = new ContractShopProvider(); this.ListPager1.RecordCount = provider.GetSize(shop1); this.BindSource(0); if (this.ListPager1.RecordCount > 0) { ContractProvider contractProvider = new ContractProvider(); contractProvider.Update(id, "已部分收货"); } else { ContractProvider contractProvider = new ContractProvider(); contractProvider.Update(id, "已全部收货"); } } } } } else { warehouse_info.Warehouse_id = warehouseProvider.GetSize() + 1; warehouse_info.Warehouse_info_number = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text); warehouse.Warehouse_number = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text); warehouse.Order_id = Convert.ToInt32(id); warehouse.Warehouse_operators = Session["LOGINED"].ToString(); warehouse.Warehouse_time = Convert.ToDateTime(DateTime.Now.Date); Place place = new Place(); place.Place_state = "空闲"; PlaceProvider placeProvider = new PlaceProvider(); table = placeProvider.Select(place); warehouse_info.Place_id = Convert.ToInt32(table.Rows[0]["place_id"]); if (warehouseInfoProvider.Insert(warehouse_info)) { if (shopProvider.Delete(shop)) { if (warehouseProvider.Insert(warehouse)) { this.Alert("入库成功!"); Shop shop1 = new Shop(); shop.Contrac_id = Convert.ToInt32(id); ContractShopProvider provider = new ContractShopProvider(); this.ListPager1.RecordCount = provider.GetSize(shop1); this.BindSource(0); Contract contract = new Contract(); if (this.ListPager1.RecordCount > 0) { ContractProvider contractProvider = new ContractProvider(); contractProvider.Update(id, "已部分收货"); } else { ContractProvider contractProvider = new ContractProvider(); contractProvider.Update(id, "已全部收货"); } } } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { id = Request.QueryString["id"].ToString(); if (!IsPostBack) { this.BindText(); } this.OperationFlag = Operation.Update; } else { this.txt_datetime.Text = DateTime.Now.ToString("yyyyMMdd"); } if (!IsPostBack) { this.ddl_GoodId.DataSource = Good_Record; this.ddl_GoodId.Width = 100; this.ddl_GoodId.DataValueField = "good_num"; this.ddl_GoodId.DataBind(); this.ddl_buyerid.DataSource = Buyer_Record; this.ddl_buyerid.Width = 100; this.ddl_buyerid.DataValueField = "buyer_bh"; this.ddl_buyerid.DataBind(); StockProvider provider = new StockProvider(); DataTable table = provider.GetStocks(this.ddl_GoodId.SelectedValue.ToString()); int min = 0; int max = 0; int sum = 0; int price = 0; for (int i = 0; i < table.Rows.Count; i++) { sum += Convert.ToInt32(table.Rows[i]["stock_num"]); price = Convert.ToInt32(table.Rows[i]["purchase_price"]); if (i == 0) { min = max = price; continue; } if (price < min) { min = price; } else if (price > max) { max = price; } } this.lbl_PriceRange.Text = " 采购价格最低为:" + min.ToString() + " 最高为:" + max.ToString(); this.lbl_StockNum.Text = "库存还剩:" + sum.ToString(); //stock_sum = sum; Session["STOCKSUM"] = sum.ToString(); Good good = new Good(); GoodProvider provider1 = new GoodProvider(); String good_name = ""; good.Good_Num = this.ddl_GoodId.SelectedValue.ToString(); DataTable table1 = provider1.Select(good); if (table1 != null && table1.Rows.Count == 1) { good_name = table1.Rows[0]["good_name"].ToString(); } this.txt_goodname.Text = good_name; } if (Request.QueryString["staffid"] != null) { staffinfo_id = Convert.ToInt32(Request.QueryString["staffid"].ToString()); } this.txt_datetime.Enabled = false; this.txt_goodname.Enabled = false; this.account.Text = GetAccout(); //Session["LOGINED"].ToString(); this.datetime.Text = this.BindDayWeek(); }