Пример #1
0
        /// <summary>
        /// Update the RequisitionCollectionItem data from the parameter
        /// </summary>
        /// <param name="requisitionCollectionItem"></param>
        /// <returns>
        /// Return DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Update(RequisitionCollectionItem requisitionCollectionItem)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                requisitionCollectionItemObj = inventory.RequisitionCollectionItems.Where(r => r.Id == requisitionCollectionItem.Id).First();
                if (!requisitionCollectionItemObj.Equals(null))
                {
                    RequisitionCollection requisitionCollectionId = inventory.RequisitionCollections.Where(r => r.Id == requisitionCollectionItem.RequisitionCollection.Id).First();
                    Item     item      = inventory.Items.Where(i => i.Id == requisitionCollectionItem.Item.Id).First();
                    Employee createdBy = inventory.Employees.Where(e => e.Id == requisitionCollectionItem.CreatedBy.Id).First();

                    requisitionCollectionItemObj.Id = requisitionCollectionItem.Id;
                    requisitionCollectionItemObj.RequisitionCollection = requisitionCollectionId;
                    requisitionCollectionItemObj.Item        = item;
                    requisitionCollectionItemObj.CreatedDate = requisitionCollectionItem.CreatedDate;
                    requisitionCollectionItemObj.CreatedBy   = createdBy;
                    requisitionCollectionItemObj.Qty         = requisitionCollectionItem.Qty;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
Пример #2
0
        public RequisitionCollectionItem GetRequisitionCollectionItem(RequisitionCollectionItem requisitionCollectionItem)
        {
            reqCollectionItem = inventory.RequisitionCollectionItems.Where(r => r.Id == requisitionCollectionItem.Id).First();

            if (!reqCollectionItem.Equals(null))
            {
                Item item = inventory.Items.Where(i => i.Id == reqCollectionItem.Item.Id).First();
                // int i=Convert.ToInt32(inventory.Items.Last().Id) + 1;
                reqCollectionItem.Item = item;
                return(reqCollectionItem);
            }
            return(null);
        }
Пример #3
0
        /// <summary>
        /// Get the RequisitionCollectionItem from the RequisitionCollectionItem table
        /// </summary>
        /// <param name="requisitionCollectionItem"></param>
        /// <returns>
        /// Returns RequisitionCollectionItem
        /// </returns>
        public RequisitionCollectionItem GetRequisitionCollectionItem(RequisitionCollectionItem requisitionCollectionItem)
        {
            try
            {
                requisitionCollectionItemObj = inventory.RequisitionCollectionItems.Where(r => r.Id == requisitionCollectionItem.Id).First();

                if (!requisitionCollectionItemObj.Equals(null))
                {
                    Item item = inventory.Items.Where(i => i.Id == requisitionCollectionItemObj.Item.Id).First();
                    // int i=Convert.ToInt32(inventory.Items.Last().Id) + 1;
                    requisitionCollectionItemObj.Item = item;
                }
            }
            catch (Exception e)
            {
                requisitionCollectionItemObj = null;
            }
            return(requisitionCollectionItemObj);
        }