Beispiel #1
0
        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("没有此商品!!!");
                }
            }
        }
Beispiel #2
0
        private void BindText()
        {
            Warehouse warehouse = new Warehouse();

            warehouse.Warehouse_id = Convert.ToInt32(id);
            WarehouseProvider provider = new WarehouseProvider();
            DataTable         table    = new DataTable();

            table = provider.Select(warehouse);

            this.txt_number.Text = table.Rows[0]["warehouse_number"].ToString();
            this.txt_time.Text   = table.Rows[0]["warehouse_time"].ToString();
        }
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int rowIndex = e.RowIndex;

            Warehouse warehouse = new Warehouse();

            warehouse.Warehouse_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value);

            WarehouseProvider provider = new WarehouseProvider();

            if (provider.Delete(warehouse))
            {
                this.Alert("删除成功!!!");

                this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                this.BindSource();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null)
     {
         id = Request.QueryString["id"].ToString();
     }
     if (!IsPostBack)
     {
         Warehouse warehouse = new Warehouse();
         warehouse.Good_id = Convert.ToInt32(id);
         WarehouseProvider provider = new WarehouseProvider();
         this.ListPager1.RecordCount = provider.GetSize(warehouse);
         this.BindSource(0);
     }
     this.account.Text           = Session["LOGINED"].ToString();
     this.datetime.Text          = this.BindDayWeek();
     this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange);
 }
 /// <summary>
 ///  绑定Units信息的数据源
 /// </summary>
 private void BindSource(int start)
 {
     if (Request.QueryString["id"] != null)
     {
         id = Request.QueryString["id"].ToString();
         Warehouse warehouse = new Warehouse();
         warehouse.Good_id = Convert.ToInt32(id);
         WarehouseProvider provider = new WarehouseProvider();
         DataTable         table    = provider.Select(warehouse, start, this.ListPager1.PageSize);
         this.GridView1.DataSource = table.DefaultView;
         this.GridView1.DataBind();
     }
     else
     {
         WarehouseProvider provider = new WarehouseProvider();
         DataTable         table    = provider.GetAll(start, this.ListPager1.PageSize);
         this.GridView1.DataSource = table.DefaultView;
         this.GridView1.DataBind();
     }
 }
Beispiel #6
0
        protected void btn_sure_Click(object sender, EventArgs e)
        {
            Warehouse         warehouse = this.AddWarehouse();
            WarehouseProvider provider  = new WarehouseProvider();

            switch (this.OperationFlag)
            {
            case Operation.Add:
                if (provider.Insert(warehouse))
                {
                    this.Alert("添加成功!!!");
                }
                break;

            case Operation.Update:
                if (provider.Update(warehouse))
                {
                    this.Alert("修改成功!!!");
                    this.BindText();
                }
                break;
            }
        }
Beispiel #7
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName.Equals("info"))
            {
                Shop shop = new Shop();
                shop.Shop_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value);
                ContractShopProvider provider  = new ContractShopProvider();
                DataTable            table     = provider.Select(shop);
                Warehouse            warehouse = new Warehouse();
                warehouse.Warehouse_number    = Convert.ToInt32(table.Rows[0]["shop_num"]);
                warehouse.Good_id             = Convert.ToInt32(table.Rows[0]["good_id"]);
                warehouse.Warehouse_type      = "出库";
                warehouse.Warehouse_time      = DateTime.Now.Date;
                warehouse.Warehouse_operators = Session["LOGINED"].ToString();
                WarehouseProvider warehouseProvider = new WarehouseProvider();
                warehouseProvider.Insert(warehouse);
                if (provider.Delete(shop))
                {
                    this.Alert("出库成功!!!");
                }
            }
        }
Beispiel #8
0
        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, "已全部收货");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }