Esempio n. 1
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtName.Text != "")
                {
                    if (txtStoreOfQty.Text != "")
                    {
                        Shelfs _Shelfs = new Shelfs();

                        _Shelfs.Name     = txtName.Text;
                        _Shelfs.StoreQty = Convert.ToInt32(txtStoreOfQty.Text);

                        decimal AlreadyExistShelfs = _ShelfRepository.AlreadyExistName(_Shelfs);
                        if (AlreadyExistShelfs >= 1)
                        {
                            lblmsg.Text      = "This Shelfs Already Here!!....";
                            lblmsg.ForeColor = Color.Red;
                            txtName.Focus();
                        }
                        else
                        {
                            int Savesuccess = _ShelfRepository.Add(_Shelfs);
                            if (Savesuccess > 0)
                            {
                                lblmsg.Text      = "This Shelfs Save Successefully!!....";
                                lblmsg.ForeColor = Color.Green;
                                LoadShelfs();
                                txtStoreOfQty.Text = "";
                                txtName.Text       = "";

                                //Response.Redirect(Request.Url.AbsoluteUri);
                            }
                            else
                            {
                                lblmsg.Text      = "This Shelfs Saving Failed!!....";
                                lblmsg.ForeColor = Color.Red;
                            }
                        }
                    }
                    else
                    {
                        txtStoreOfQty.Focus();
                        lblmsg.Text      = "Please Type Shelfs Store Qty";
                        lblmsg.ForeColor = Color.Red;
                    }
                }
                else
                {
                    txtName.Focus();
                    lblmsg.Text      = "Please Type Shelfs Name";
                    lblmsg.ForeColor = Color.Red;
                }
            }
            catch (Exception ex)
            {
                lblmsg.Text      = ex.Message;
                lblmsg.ForeColor = Color.Red;
            }
        }
Esempio n. 2
0
        public new bool Add(CMD_SHELF shelf)
        {
            var shelfAdd  = new CMD_SHELF();
            var warehouse = WarehouseRepository.GetQueryable().FirstOrDefault(w => w.WAREHOUSE_CODE == shelf.WAREHOUSE_CODE);
            var area      = AreaRepository.GetQueryable().FirstOrDefault(a => a.AREA_CODE == shelf.AREA_CODE);

            shelfAdd.SHELF_CODE     = shelf.SHELF_CODE;
            shelfAdd.SHELF_NAME     = shelf.SHELF_NAME;
            shelfAdd.STATION_NO     = shelf.STATION_NO;
            shelfAdd.CRANE_NO       = shelf.CRANE_NO;
            shelfAdd.ROW_COUNT      = shelf.ROW_COUNT;
            shelfAdd.COLUMN_COUNT   = shelf.COLUMN_COUNT;
            shelfAdd.WAREHOUSE_CODE = warehouse.WAREHOUSE_CODE;
            shelfAdd.AREA_CODE      = area.AREA_CODE;
            shelfAdd.MEMO           = shelf.MEMO;

            ShelfRepository.Add(shelfAdd);
            ShelfRepository.SaveChanges();
            return(true);
        }
Esempio n. 3
0
        public new bool Add(Shelf shelf)
        {
            var shelfAdd  = new Shelf();
            var warehouse = WarehouseRepository.GetQueryable().FirstOrDefault(w => w.WarehouseCode == shelf.WarehouseCode);
            var area      = AreaRepository.GetQueryable().FirstOrDefault(a => a.AreaCode == shelf.AreaCode);

            shelfAdd.ShelfCode   = shelf.ShelfCode;
            shelfAdd.ShelfName   = shelf.ShelfName;
            shelfAdd.ShortName   = shelf.ShortName;
            shelfAdd.ShelfType   = shelf.ShelfType;
            shelfAdd.CellRows    = shelf.CellRows;
            shelfAdd.CellCols    = shelf.CellCols;
            shelfAdd.ImgX        = shelf.ImgX;
            shelfAdd.ImgY        = shelf.ImgY;
            shelfAdd.Warehouse   = warehouse;
            shelfAdd.Area        = area;
            shelfAdd.Description = shelf.Description;
            shelfAdd.IsActive    = shelf.IsActive;
            shelfAdd.UpdateTime  = DateTime.Now;

            ShelfRepository.Add(shelfAdd);
            ShelfRepository.SaveChanges();
            return(true);
        }