/// <summary> /// 绑定Units信息的数据源 /// </summary> private void BindSource(int start) { Shop shop = new Shop(); shop.Order_id = Convert.ToInt32(id); ShopProvider provider = new ShopProvider(); DataTable table = provider.Select(shop, start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); }
protected void btn_add_Click(object sender, EventArgs e) { int i = 0; for (int index = 0; index < this.GridView1.Rows.Count; index++) { if (this.GridView1.Rows[index].RowType == DataControlRowType.DataRow) { TextBox control = (TextBox)this.GridView1.Rows[index].Cells[9].FindControl("txt_number"); if (control.Text != "") { int number = Convert.ToInt32(control.Text); if (number < 0) { this.Alert("数量不能为负数!"); return; } int num = number % 10; if (num > 0) { number = number / 10; number = number * 10 + 10; } Shop shop = new Shop(); shop.Good_id = Convert.ToInt32(this.GridView1.DataKeys[index].Value); shop.Shop_num = number; shop.Shop_jointime = Convert.ToDateTime(DateTime.Now.ToString("HH:mm:ss")); shop.Order_id = Convert.ToInt32(id); shop.Contrac_id = 0; ShopProvider provider = new ShopProvider(); provider.Insert(shop); i = 1; ((TextBox)this.GridView1.Rows[index].Cells[9].FindControl("txt_number")).Text = ""; } } } if (i == 1) { Shop shop = new Shop(); shop.Order_id = Convert.ToInt32(id); ShopProvider provider = new ShopProvider(); this.ListPager2.RecordCount = provider.GetSize(shop); this.BindSourceShop(0); this.ListPager2.PageChange += new PagerEventHandler(ListPager2_PageChange); } else { this.Alert("请输入数量!!!"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { id = Request.QueryString["id"].ToString(); } if (!IsPostBack) { Shop shop = new Shop(); shop.Order_id = Convert.ToInt32(id); ShopProvider provider = new ShopProvider(); this.ListPager1.RecordCount = provider.GetSize(shop); this.BindSource(0); } this.account.Text = Session["LOGINED"].ToString(); this.datetime.Text = this.BindDayWeek(); this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int rowIndex = e.RowIndex; Shop shop = new Shop(); shop.Shop_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value); ShopProvider provider = new ShopProvider(); if (provider.Delete(shop)) { this.Alert("删除成功!!!"); this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1; this.BindSource(); } }
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, "已全部收货"); } } } } } } } }
private static string PublishProduct(Guid id) { var shopProvider = new ShopProvider(); var savedProduct = GetProduct(id); var productImages = GetProductImages(id); var imageList = new List <string>(); foreach (var productImage in productImages) { if (productImage.SelectedForExport == true) { imageList.Add(productImage.Path); } } //Validate int price = Convert.ToInt16(savedProduct.Price); if (price < 2) { throw new NotImplementedException(); } if (imageList.Count < 1) { throw new NotImplementedException(); } //Todo: savedProduct.ProductCondition string description = savedProduct.Name + "\n\n"; var propertyList = new JavaScriptSerializer().Deserialize <List <ProductProperty> >(savedProduct.Properties); foreach (var prop in propertyList) { description += prop.Key + ": " + prop.Value + "\n"; } if (savedProduct.ProductConditionId.HasValue) { description += "\n\nSkick (1-5): " + savedProduct.ProductConditionId.ToString(); } description += "\n\n" + savedProduct.Comment; //344480 = Testauktioner int shopCategoryId = 344480; //Get category info using (var db = new DitatEntities()) { Category category = db.Categories.Single(c => c.ClassifierTag == savedProduct.Category); //Todo: uncomment and test this: shopCategoryId = category.Id; shopCategoryId = Int32.Parse(category.ExternalId); } var productUrl = shopProvider.PublishItem(id, savedProduct.Name, description, shopCategoryId, price, 1, 14, imageList, savedProduct.Shipping, savedProduct.ShippingCost, savedProduct.ProductNumber); return(productUrl); }