コード例 #1
0
        private void WarehouseListThem_simpleButton_Click(object sender, EventArgs e)
        {
            WarehouseList WarehouseListDataInsert = new WarehouseList();

            WarehouseListDataInsert.WarehouseListName                  = this.WarehouseListName_textEdit.EditValue.ToString().Trim();
            WarehouseListDataInsert.WarehouseListDebitAccountID        = this.WarehouseListDebitAccount_searchLookUpEdit.EditValue?.ToString() ?? "";
            WarehouseListDataInsert.WarehouseListDebitAccountDetailID  = this.WarehouseListDebitAccountDetail_searchLookUpEdit.EditValue?.ToString() ?? "";
            WarehouseListDataInsert.WarehouseListCreditAccountID       = this.WarehouseListCreditAccount_searchLookUpEdit.EditValue?.ToString() ?? "";
            WarehouseListDataInsert.WarehouseListCreditAccountDetailID = this.WarehouseListCreditAccountDetail_searchLookUpEdit.EditValue?.ToString() ?? "";
            WarehouseListDataInsert.WarehouseListManageCode            = this.WarehouseListManageCode_searchLookUpEdit.EditValue?.ToString() ?? "";
            WarehouseListDataInsert.WarehouseListTitle                 = this.WarehouseListTitle_textEdit.EditValue?.ToString() ?? "";
            WarehouseListDataInsert.WarehouseListAddress               = this.WarehouseListAdd_textEdit.EditValue?.ToString() ?? "";
            WarehouseListDataInsert.WarehouseListNote                  = this.WarehouseListNote_richTextBoxVoucherContent.Text?.ToString() ?? "";
            WarehouseListDataInsert.CompanyID = CommonInfo.CompanyInfo.CompanyID;
            WarehouseListDataInsert.Status    = ModifyMode.Insert;
            List <WarehouseList> ListWarehouseList = new List <WarehouseList>();

            ListWarehouseList.Add(WarehouseListDataInsert);
            if (ListWarehouseList?.Count > 0)
            {
                WareHouseListController controller = new WareHouseListController();
                if (controller.SaveWareHouseList(ListWarehouseList))
                {
                    MessageBoxHelper.ShowInfoMessage(BSMessage.BSM000001);
                    this.LoadGridView();
                }
                else
                {
                    MessageBoxHelper.ShowInfoMessage(BSMessage.BSM000002);
                }
            }
        }
コード例 #2
0
        private void WarehouseList_gridView_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            try
            {
                WarehouseList warehouseList = this.WarehouseList_gridView.GetRow(e.RowHandle).CastTo <WarehouseList>();

                this.WarehouseListCode_textEdit.EditValue = warehouseList.WarehouseListID;
                this.WarehouseListName_textEdit.Text      = warehouseList.WarehouseListName;
                this.WarehouseListDebitAccount_searchLookUpEdit.EditValue        = warehouseList.WarehouseListDebitAccountID;
                this.WarehouseListDebitAccountDetail_searchLookUpEdit.EditValue  = warehouseList.WarehouseListDebitAccountDetailID;
                this.WarehouseListCreditAccount_searchLookUpEdit.EditValue       = warehouseList.WarehouseListCreditAccountID;
                this.WarehouseListCreditAccountDetail_searchLookUpEdit.EditValue = warehouseList.WarehouseListCreditAccountDetailID;
                this.WarehouseListManageCode_searchLookUpEdit.EditValue          = warehouseList.WarehouseListManageCode ?? "";
                this.WarehouseListNote_richTextBoxVoucherContent.Text            = warehouseList.WarehouseListNote ?? "";
                this.WarehouseListAdd_textEdit.Text   = warehouseList.WarehouseListAddress ?? "";
                this.WarehouseListTitle_textEdit.Text = warehouseList.WarehouseListTitle ?? "";

                // this.WarehouseListDebitAccountDetail_searchLookUpEdit.EditValue = selectRow.AccountDetailID;
                materialDebitAccountDetail = materialTK.Where(item => item.AccountID == WarehouseListDebitAccount_searchLookUpEdit.EditValue.ToString()).ToList();
                this.WarehouseListDebitAccountDetail_searchLookUpEdit.Properties.DataSource = materialDebitAccountDetail;
                WarehouseListDebitAccountDetail_searchLookUpEdit.Refresh();

                materialCreditAccountDetail = materialTK.Where(item => item.AccountID == WarehouseListCreditAccount_searchLookUpEdit.EditValue.ToString()).ToList();
                this.WarehouseListCreditAccountDetail_searchLookUpEdit.Properties.DataSource = materialCreditAccountDetail;
                WarehouseListCreditAccountDetail_searchLookUpEdit.Refresh();
            }
            catch
            {
            }
        }
コード例 #3
0
 public bool InsertWareHouseList(WarehouseList wareHouseList)
 {
     try
     {
         SqlParameter[] sqlParameters = new SqlParameter[]
         {
             new SqlParameter("@WarehouseListID", wareHouseList.WarehouseListID),
             new SqlParameter("@WarehouseListName", wareHouseList.WarehouseListName),
             new SqlParameter("@WarehouseListDebitAccountID", wareHouseList.WarehouseListDebitAccountID),
             new SqlParameter("@WarehouseListDebitAccountDetailID", wareHouseList.WarehouseListDebitAccountDetailID),
             new SqlParameter("@WarehouseListCreditAccountID", wareHouseList.WarehouseListCreditAccountID),
             new SqlParameter("@WarehouseListCreditAccountDetailID", wareHouseList.WarehouseListCreditAccountDetailID),
             new SqlParameter("@WarehouseListManageCode", wareHouseList.WarehouseListManageCode),
             new SqlParameter("@WarehouseListTitle", wareHouseList.WarehouseListTitle ?? (object)DBNull.Value),
             new SqlParameter("@WarehouseListAddress", wareHouseList.WarehouseListAddress ?? (object)DBNull.Value),
             new SqlParameter("@WarehouseListNote", wareHouseList.WarehouseListNote ?? (object)DBNull.Value),
             new SqlParameter("@CreateUser", UserInfo.UserID),
             new SqlParameter("@CompanyID", CommonInfo.CompanyInfo.CompanyID),
         };
         this.Context.ExecuteDataFromProcedure("WarehouseListInsert", sqlParameters);
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Insert WareHouseList Fail! " + ex.Message);
         return(false);
     }
 }
コード例 #4
0
 private void ChangeKeyLogic()
 {
     if (!string.IsNullOrEmpty(SelectedWarehouse.WarehouseID))
     {//check to see if key is part of the current companylist...
         Warehouse query = WarehouseList.Where(company => company.WarehouseID == SelectedWarehouse.WarehouseID &&
                                               company.AutoID != SelectedWarehouse.AutoID).FirstOrDefault();
         if (query != null)
         {//revert it back
             SelectedWarehouse.WarehouseID = SelectedWarehouseMirror.WarehouseID;
             //change to the newly selected company...
             SelectedWarehouse = query;
             return;
         }
         //it is not part of the existing list try to fetch it from the db...
         WarehouseList = GetWarehouseByID(SelectedWarehouse.WarehouseID, XERP.Client.ClientSessionSingleton.Instance.CompanyID);
         if (WarehouseList.Count == 0)//it was not found do new record required logic...
         {
             NotifyNewRecordNeeded("Record " + SelectedWarehouse.WarehouseID + " Does Not Exist.  Create A New Record?");
         }
         else
         {
             SelectedWarehouse = WarehouseList.FirstOrDefault();
         }
     }
     else
     {
         string errorMessage = "ID Is Required.";
         NotifyMessage(errorMessage);
         //revert back to the value it was before it was changed...
         if (SelectedWarehouse.WarehouseID != SelectedWarehouseMirror.WarehouseID)
         {
             SelectedWarehouse.WarehouseID = SelectedWarehouseMirror.WarehouseID;
         }
     }
 }
コード例 #5
0
        private void WarehouseListSua_simpleButton_Click(object sender, EventArgs e)
        {
            WarehouseList WarehouseListDataUpdate = new WarehouseList
            {
                WarehouseListID                    = this.WarehouseListCode_textEdit.EditValue.ToString(),
                WarehouseListName                  = this.WarehouseListName_textEdit.EditValue.ToString().Trim(),
                WarehouseListDebitAccountID        = this.WarehouseListDebitAccount_searchLookUpEdit.EditValue?.ToString() ?? "",
                WarehouseListDebitAccountDetailID  = this.WarehouseListDebitAccountDetail_searchLookUpEdit.EditValue?.ToString() ?? "",
                WarehouseListCreditAccountID       = this.WarehouseListCreditAccount_searchLookUpEdit.EditValue?.ToString() ?? "",
                WarehouseListCreditAccountDetailID = this.WarehouseListCreditAccountDetail_searchLookUpEdit.EditValue?.ToString() ?? "",
                WarehouseListManageCode            = this.WarehouseListManageCode_searchLookUpEdit.EditValue?.ToString() ?? "",
                WarehouseListTitle                 = this.WarehouseListTitle_textEdit.EditValue?.ToString() ?? "",
                WarehouseListAddress               = this.WarehouseListAdd_textEdit.EditValue?.ToString() ?? "",
                WarehouseListNote                  = this.WarehouseListNote_richTextBoxVoucherContent.Text?.ToString() ?? "",
                CompanyID = CommonInfo.CompanyInfo.CompanyID
            };
            WareHouseListController controller = new WareHouseListController();

            if (controller.UpdateWareHouseList(WarehouseListDataUpdate))
            {
                MessageBoxHelper.ShowInfoMessage(BSMessage.BSM000001);
                this.LoadGridView();
            }
            else
            {
                MessageBoxHelper.ShowInfoMessage(BSMessage.BSM000002);
            }
        }
コード例 #6
0
        public List <TheKho> AddTheKhoName(List <TheKho> datas)
        {
            // Lấy dữ liệu hàng hóa
            var ItemsList = ItemsDAO.GetItems().ToDictionary(o => o.ItemID, o => o);
            var WHList    = GetWarehouses().ToDictionary(o => o.WarehouseListID, o => o);

            // Thêm name vào danh sách
            foreach (var data in datas)
            {
                Items item = null;
                if (data.ItemID != null && ItemsList.ContainsKey(data.ItemID))
                {
                    item = ItemsList[data.ItemID];
                }

                WarehouseList wh = null;
                if (data.WarehouseListID != null && WHList.ContainsKey(data.WarehouseListID))
                {
                    wh = WHList[data.WarehouseListID];
                }

                data.WarehouseListName = wh?.WarehouseListName;
                data.WHLSEQ            = wh?.WHLSEQ ?? 0;
                data.ItemName          = item?.ItemName;
                data.ItemSName         = item?.ItemSName;
            }

            return(datas);
        }
コード例 #7
0
        //Warehouse Object Scope Validation check the entire object for validity...
        private byte WarehouseIsValid(Warehouse item, out string errorMessage)
        {   //validate key
            errorMessage = "";
            if (string.IsNullOrEmpty(item.WarehouseID))
            {
                errorMessage = "ID Is Required.";
                return(1);
            }
            EntityStates entityState = GetWarehouseState(item);

            if (entityState == EntityStates.Added && WarehouseExists(item.WarehouseID, item.PlantID))
            {
                errorMessage = "Item All Ready Exists.";
                return(1);
            }
            //check cached list for duplicates...
            int count = WarehouseList.Count(q => q.WarehouseID == item.WarehouseID);

            if (count > 1)
            {
                errorMessage = "Item All Ready Exists...";
                return(1);
            }
            //validate Description
            if (string.IsNullOrEmpty(item.Name))
            {
                errorMessage = "Name Is Required.";
                return(1);
            }
            //a value of 2 is pending changes...
            //On Commit we will give it a value of 0...
            return(2);
        }
コード例 #8
0
        public void DeleteWarehouseCommand()
        {
            try
            {
                int i  = 0;
                int ii = 0;
                for (int j = SelectedWarehouseList.Count - 1; j >= 0; j--)
                {
                    Warehouse item = (Warehouse)SelectedWarehouseList[j];
                    //get Max Index...
                    i = WarehouseList.IndexOf(item);
                    if (i > ii)
                    {
                        ii = i;
                    }
                    Delete(item);
                    WarehouseList.Remove(item);
                }

                if (WarehouseList != null && WarehouseList.Count > 0)
                {
                    //back off one index from the max index...
                    ii = ii - 1;

                    //if they delete the first row...
                    if (ii < 0)
                    {
                        ii = 0;
                    }

                    //make sure it does not exceed the list count...
                    if (ii >= WarehouseList.Count())
                    {
                        ii = WarehouseList.Count - 1;
                    }

                    SelectedWarehouse = WarehouseList[ii];
                    //we will only enable committ for dirty validated records...
                    if (Dirty == true)
                    {
                        AllowCommit = CommitIsAllowed();
                    }
                    else
                    {
                        AllowCommit = false;
                    }
                }
                else//only one record, deleting will result in no records...
                {
                    SetAsEmptySelection();
                }
            }//we try catch company delete as it may be used in another table as a key...
            //As well we will force a refresh to sqare up the UI after the botched delete...
            catch
            {
                NotifyMessage("Warehouse/s Can Not Be Deleted.  Contact XERP Admin For More Details.");
                Refresh();
            }
        }
コード例 #9
0
        /// <summary>
        /// Binds the lists.
        /// </summary>
        private void BindLists()
        {
            // bind shipment packages
            if (PackageList.Items.Count <= 1)
            {
                ShippingMethodDto shippingDto = ShippingManager.GetShippingPackages();
                if (shippingDto.Package != null)
                {
                    foreach (ShippingMethodDto.PackageRow row in shippingDto.Package.Rows)
                    {
                        PackageList.Items.Add(new ListItem(row.Name, row.PackageId.ToString()));
                    }
                }
                PackageList.DataBind();
            }

            // bind warehouses
            if (WarehouseList.Items.Count <= 1)
            {
                WarehouseDto dto = WarehouseManager.GetWarehouseDto();
                if (dto.Warehouse != null)
                {
                    foreach (WarehouseDto.WarehouseRow row in dto.Warehouse.Rows)
                    {
                        WarehouseList.Items.Add(new ListItem(row.Name, row.WarehouseId.ToString()));
                    }
                }

                WarehouseList.DataBind();
            }

            // bind merchants
            if (MerchantList.Items.Count <= 1)
            {
                CatalogEntryDto merchants = CatalogContext.Current.GetMerchantsDto();
                if (merchants.Merchant != null)
                {
                    foreach (CatalogEntryDto.MerchantRow row in merchants.Merchant.Rows)
                    {
                        MerchantList.Items.Add(new ListItem(row.Name, row.MerchantId.ToString()));
                    }
                }
                MerchantList.DataBind();
            }

            // bind tax categories
            if (TaxList.Items.Count <= 1)
            {
                CatalogTaxDto taxes = CatalogTaxManager.GetTaxCategories();
                if (taxes.TaxCategory != null)
                {
                    foreach (CatalogTaxDto.TaxCategoryRow row in taxes.TaxCategory.Rows)
                    {
                        TaxList.Items.Add(new ListItem(row.Name, row.TaxCategoryId.ToString()));
                    }
                }
                TaxList.DataBind();
            }
        }
コード例 #10
0
 /// <summary>
 /// 显示条码规则列表
 /// </summary>
 public void ShowWarehouseTable()
 {
     foreach (var model in GetWarehouseList())
     {
         WarehouseList.Add(model);
     }
     ShowWarehouseList();
 }
コード例 #11
0
        public ProductOnHand GetProductExternalOnHand(int id, IEnumerable <Warehouse> warehouses, string statusSeed = Ignored,
                                                      string priceListSeed = Ignored, int?customerId  = InvalidId, int?companyId = InvalidId, string cultureCode = Ignored,
                                                      int?currencyId       = InvalidId, bool useCache = true)
        {
            var warehouseList = new WarehouseList();

            warehouseList.AddRange(warehouses);

            return(GetProductOnHand(id, warehouseList, statusSeed, priceListSeed, customerId, companyId, cultureCode, currencyId, true, useCache));
        }
コード例 #12
0
 private void OnSearchResult(object sender, NotificationEventArgs <BindingList <Warehouse> > e)
 {
     if (e.Data != null && e.Data.Count > 0)
     {
         WarehouseList     = e.Data;
         SelectedWarehouse = WarehouseList.FirstOrDefault();
         Dirty             = false;
         AllowCommit       = false;
     }
     UnregisterToReceiveMessages <BindingList <Warehouse> >(MessageTokens.WarehouseSearchToken.ToString(), OnSearchResult);
 }
コード例 #13
0
        private void BindWarehouses()
        {
            IList <Warehouse> warehouses = WarehouseDataSource.LoadAll("Name");
            int index = warehouses.IndexOf(_WarehouseId);

            if (index > -1)
            {
                warehouses.RemoveAt(index);
            }
            WarehouseList.DataSource = warehouses;
            WarehouseList.DataBind();
        }
コード例 #14
0
        private void LoadList()
        {
            WarehouseList.Items.Clear();
            CustomerList.Items.Clear();

            WarehouseList.DataSource     = db.Warehouses.ToList();
            WarehouseList.DataTextField  = "WarehouseDescription";
            WarehouseList.DataValueField = "WarehouseID";
            WarehouseList.DataBind();

            CustomerList.DataSource     = db.Customers.ToList();
            CustomerList.DataTextField  = "CustomerName";
            CustomerList.DataValueField = "CustomerID";
            CustomerList.DataBind();
        }
コード例 #15
0
        private void WarehouseListXoa_simpleButton_Click(object sender, EventArgs e)
        {
            WarehouseList WareHouseListDataDelete = new WarehouseList();

            WareHouseListDataDelete.WarehouseListID = this.WarehouseListCode_textEdit.EditValue.ToString();
            WareHouseListController controller = new WareHouseListController();

            if (controller.DeleteWareHouseList(WareHouseListDataDelete))
            {
                MessageBoxHelper.ShowInfoMessage(BSMessage.BSM000027);
                this.LoadGridView();
            }
            else
            {
                MessageBoxHelper.ShowInfoMessage("Xóa dữ liệu thất bại!");
            }
        }
コード例 #16
0
        private ProductOnHand GetProductOnHand(int id, WarehouseList warehouses, string statusSeed = Ignored,
                                               string priceListSeed = Ignored, int?customerId  = InvalidId, int?companyId = InvalidId, string cultureCode = Ignored,
                                               int?currencyId       = InvalidId, bool external = false, bool useCache     = true)
        {
            using (var client = GetBatch())
            {
                client.UseCache = useCache;
                if (external)
                {
                    return(client.ProductProxy.GetExternalProductOnHandByProduct(id, warehouses, StatusSeed(statusSeed),
                                                                                 PricelistSeed(priceListSeed), Customer(customerId), Company(companyId), CultureCode(cultureCode),
                                                                                 Currency(currencyId)));
                }

                return(client.ProductProxy.GetProductOnHandByProduct(id, warehouses, StatusSeed(statusSeed),
                                                                     PricelistSeed(priceListSeed), Customer(customerId), Company(companyId), CultureCode(cultureCode),
                                                                     Currency(currencyId)));
            }
        }
コード例 #17
0
        private void GenerateStockyards()
        {
            List <Stockyard> newStockyards = new List <Stockyard>();

            Stockyard lastStockyard = SelectedWarehouse.Stockyards.LastOrDefault(x =>
                                                                                 x.Name.ToLower().Contains(Prefix.ToLower()) && x.Name.ToLower().Contains(Suffix.ToLower()));

            int lastNumber = 1;

            if (lastStockyard != null)
            {
                string lastNumberString = lastStockyard.Name.ToLower();
                if (!string.IsNullOrEmpty(Prefix))
                {
                    lastNumberString = lastNumberString.Replace(Prefix.ToLower(), "");
                }

                if (!string.IsNullOrEmpty(Suffix))
                {
                    lastNumberString = lastNumberString.Replace(Suffix.ToLower(), "");
                }

                lastNumber = Convert.ToInt32(lastNumberString) + 1;
            }

            for (int i = 0; i < NumberOfStockyardsToCreate; i++)
            {
                newStockyards.Add(new Stockyard
                {
                    Name = Prefix + lastNumber + Suffix, RefWarehouseId = SelectedWarehouse.WarehouseId
                });
                lastNumber++;
            }

            Stockyards.Insert(newStockyards);

            int selectedWarehouseId = SelectedWarehouse.WarehouseId;

            LoadAllWarehouses();

            SelectedWarehouse = WarehouseList.SingleOrDefault(x => x.WarehouseId == selectedWarehouseId);
        }
コード例 #18
0
 protected void BindWarehouses()
 {
     WarehouseListPanel.Visible = (UseWarehouseRestriction.SelectedIndex > 0);
     if (WarehouseListPanel.Visible)
     {
         WarehouseList.DataSource = WarehouseDataSource.LoadAll("Name");
         WarehouseList.DataBind();
         if (WarehouseList.Items.Count > 4)
         {
             WarehouseList.Rows = 8;
         }
         foreach (Warehouse item in _ShipMethod.Warehouses)
         {
             ListItem listItem = WarehouseList.Items.FindByValue(item.Id.ToString());
             if (listItem != null)
             {
                 listItem.Selected = true;
             }
         }
     }
 }
コード例 #19
0
        //Object.Property Scope Validation...
        private bool WarehouseIsValid(Warehouse item, _warehouseValidationProperties validationProperties, out string errorMessage)
        {
            errorMessage = "";
            switch (validationProperties)
            {
            case _warehouseValidationProperties.WarehouseID:
                //validate key
                if (string.IsNullOrEmpty(item.WarehouseID))
                {
                    errorMessage = "ID Is Required.";
                    return(false);
                }
                EntityStates entityState = GetWarehouseState(item);
                if (entityState == EntityStates.Added && WarehouseExists(item.WarehouseID, item.PlantID))
                {
                    errorMessage = "Item All Ready Exists...";
                    return(false);
                }
                //check cached list for duplicates...
                int count = WarehouseList.Count(q => q.WarehouseID == item.WarehouseID);
                if (count > 1)
                {
                    errorMessage = "Item All Ready Exists...";
                    return(false);
                }
                break;

            case _warehouseValidationProperties.Name:
                //validate Description
                if (string.IsNullOrEmpty(item.Name))
                {
                    errorMessage = "Description Is Required.";
                    return(false);
                }
                break;
            }
            return(true);
        }
コード例 #20
0
        public LoginViewModel()
        {
            List <WarehouseModel> lst = new List <WarehouseModel>
            {
                new WarehouseModel {
                    WarheouseCode = "1001", WarehouseName = "용인 물류센터"
                },
                new WarehouseModel {
                    WarheouseCode = "1002", WarehouseName = "수지 물류센터"
                },
                new WarehouseModel {
                    WarheouseCode = "1003", WarehouseName = "천안 물류센터"
                },
                new WarehouseModel {
                    WarheouseCode = "1004", WarehouseName = "부산 물류센터"
                }
            };

            WarehouseList.AddRange(lst);

            LoginCommand = new Command(async() => await Login(), () => IsControlEnable);
            //LoginCommand = new Command(async () => await Login());
        }
コード例 #21
0
        private void LoadList()
        {
            var w = (from yt in db.UserLogins
                     where yt.UserID.ToString() == User.Identity.Name
                     select new { yt.WorkStationID }).FirstOrDefault();
            var wn = db.Warehouses.Where(t => t.WarehouseID == w.WorkStationID).FirstOrDefault();

            WarehouseList.Items.Clear();
            CustomerList.Items.Clear();

            WarehouseList.DataSource     = db.Warehouses.ToList();
            WarehouseList.DataTextField  = "WarehouseDescription";
            WarehouseList.DataValueField = "WarehouseID";
            WarehouseList.DataBind();

            //CustomerList.DataSource = db.Customers.OrderBy(x => x.CustomerName).ToList();


            int wID = wn.WarehouseID;//Convert.ToInt32(WarehouseList.SelectedItem.Value);

            CustomerList.DataSource     = db.Customers.Where(a => a.WarehouseID == wID).OrderBy(x => x.CustomerName).ToList(); CustomerList.DataTextField = "CustomerName";
            CustomerList.DataValueField = "CustomerID";
            CustomerList.DataBind();
        }
コード例 #22
0
        private bool NewWarehouse(string itemID)
        {
            Warehouse newItem = new Warehouse();

            //all new records will be give a negative int autoid...
            //when they are updated then sql will generate one for them overiding this set value...
            //it will allow us to give uniqueness to the tempory new records...
            //Before they are updated to the entity and given an autoid...
            //we use a negative number and keep subtracting by 1 for each new item added...
            //This will allow it to alwasy be unique and never interfere with SQL's positive autoid...
            _newWarehouseAutoId     = _newWarehouseAutoId - 1;
            newItem.AutoID          = _newWarehouseAutoId;
            newItem.WarehouseID     = itemID;
            newItem.CompanyID       = ClientSessionSingleton.Instance.CompanyID;
            newItem.IsValid         = 1;
            newItem.NotValidMessage = "New Record Key Field/s Are Required.";
            WarehouseList.Add(newItem);
            _serviceAgent.AddToWarehouseRepository(newItem);
            SelectedWarehouse = WarehouseList.LastOrDefault();

            AllowEdit = true;
            Dirty     = false;
            return(true);
        }
コード例 #23
0
 public bool InsertWareHouseList(WarehouseList WareHouseList)
 {
     return(this.WareHouseListDAO.InsertWareHouseList(WareHouseList));
 }
コード例 #24
0
        private void SelectedWarehouseLocation_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {//these properties are not to be persisted we will igore them...
            if (e.PropertyName == "IsSelected" ||
                e.PropertyName == "IsExpanded" ||
                e.PropertyName == "IsValid" ||
                e.PropertyName == "NotValidMessage" ||
                e.PropertyName == "LastModifiedBy" ||
                e.PropertyName == "LastModifiedByDate" ||
                e.PropertyName == "PlantID")
            {//WarehouseID and PlantID or set from the WarehouseLocation selection...
                return;
            }
            //Key ID Logic...
            if (e.PropertyName == "WarehouseLocationID")
            {//make sure it is has changed...
                if (SelectedWarehouseLocationMirror.WarehouseLocationID != SelectedWarehouseLocation.WarehouseLocationID)
                {
                    //if their are no records it is a key change
                    if (WarehouseLocationList != null && WarehouseLocationList.Count == 0 &&
                        SelectedWarehouseLocation != null && !string.IsNullOrEmpty(SelectedWarehouseLocation.WarehouseLocationID))
                    {
                        ChangeKeyLogic();
                        return;
                    }

                    EntityStates entityState = GetWarehouseLocationState(SelectedWarehouseLocation);

                    if (entityState == EntityStates.Unchanged ||
                        entityState == EntityStates.Modified)
                    {                             //once a key is added it can not be modified...
                        if (Dirty && AllowCommit) //dirty record exists ask if save is required...
                        {
                            NotifySaveRequired("Do you want to save changes?", _saveRequiredResultActions.ChangeKeyLogic);
                        }
                        else
                        {
                            ChangeKeyLogic();
                        }

                        return;
                    }
                }
            }//end KeyID logic...
            //2ndary key logic... when this key is selected we will populate it upstream keys...
            if (e.PropertyName == "WarehouseID" &&
                SelectedWarehouseLocationMirror.WarehouseID != SelectedWarehouseLocation.WarehouseID)
            {
                //look up WarehouseLocation to fetch its upstream properties...
                Warehouse item = WarehouseList.Where(q => q.WarehouseID == SelectedWarehouseLocation.WarehouseID).FirstOrDefault();
                SelectedWarehouseLocation.PlantID = item.PlantID;
            }

            object propertyChangedValue = SelectedWarehouseLocation.GetPropertyValue(e.PropertyName);
            object prevPropertyValue    = SelectedWarehouseLocationMirror.GetPropertyValue(e.PropertyName);
            string propertyType         = SelectedWarehouseLocation.GetPropertyType(e.PropertyName);
            //in some instances the value is not really changing but yet it still is tripping property change..
            //This will ensure that the field has physically been modified...
            //As well when we revert back it constitutes a property change but they will be = and it will bypass the logic...
            bool objectsAreEqual;

            if (propertyChangedValue == null)
            {
                if (prevPropertyValue == null)//both values are null
                {
                    objectsAreEqual = true;
                }
                else//only one value is null
                {
                    objectsAreEqual = false;
                }
            }
            else
            {
                if (prevPropertyValue == null)//only one value is null
                {
                    objectsAreEqual = false;
                }
                else //both values are not null use .Equals...
                {
                    objectsAreEqual = propertyChangedValue.Equals(prevPropertyValue);
                }
            }
            if (!objectsAreEqual)
            {
                //Here we do property change validation if false is returned we will reset the value
                //Back to its mirrored value and return out of the property change w/o updating the repository...
                if (WarehouseLocationPropertyChangeIsValid(e.PropertyName, propertyChangedValue, prevPropertyValue, propertyType))
                {
                    Update(SelectedWarehouseLocation);
                    //set the mirrored objects field...
                    SelectedWarehouseLocationMirror.SetPropertyValue(e.PropertyName, propertyChangedValue);
                    SelectedWarehouseLocationMirror.IsValid         = SelectedWarehouseLocation.IsValid;
                    SelectedWarehouseLocationMirror.IsExpanded      = SelectedWarehouseLocation.IsExpanded;
                    SelectedWarehouseLocationMirror.NotValidMessage = SelectedWarehouseLocation.NotValidMessage;
                }
                else
                {
                    SelectedWarehouseLocation.SetPropertyValue(e.PropertyName, prevPropertyValue);
                    SelectedWarehouseLocation.IsValid         = SelectedWarehouseLocationMirror.IsValid;
                    SelectedWarehouseLocation.IsExpanded      = SelectedWarehouseLocationMirror.IsExpanded;
                    SelectedWarehouseLocation.NotValidMessage = SelectedWarehouseLocationMirror.NotValidMessage;
                }
            }
        }
コード例 #25
0
 public bool DeleteWareHouseList(WarehouseList WareHouseList)
 {
     return(this.WareHouseListDAO.DeleteWareHouseList(WareHouseList.WarehouseListID, CommonInfo.CompanyInfo.CompanyID));
 }
コード例 #26
0
 public bool UpdateWareHouseList(WarehouseList WareHouseList)
 {
     return(this.WareHouseListDAO.UpdateWareHouseList(WareHouseList));
 }
コード例 #27
0
 public void ClearLogic()
 {
     WarehouseList.Clear();
     SetAsEmptySelection();
 }