Ejemplo n.º 1
0
        /// <summary>
        /// Update Requisition data to Requisition Table according to the Requisition Parameter
        ///  Return Constants.DB_STATUS
        /// </summary>
        /// <param name="requisition"></param>
        /// <returns></returns>

        public Constants.DB_STATUS Update(Requisition requisition)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                //requisitionObj = inventory.Requisitions.Where(reqObj => reqObj.Id == requisition.Id).First();
                //Employee empId=inventory.Employees.Where(e=>e.Id==requisition.CreatedBy.Id).First();
                //Employee approvedBy=inventory.Employees.Where(e=>e.Id==requisition.ApprovedBy.Id).First();
                //Department department = inventory.Departments.Where(d => d.Id == requisition.Department.Id).First();
                ////requisitionObj.Id = requisition.Id;
                //requisitionObj.Department = department;
                //requisitionObj.CreatedBy = empId;
                //requisitionObj.ApprovedBy = approvedBy;
                //requisitionObj.ApprovedDate = requisition.ApprovedDate;
                //requisitionObj.CreatedDate = requisition.CreatedDate;
                //foreach (RequisitionDetail requisitionDetail in requisition.RequisitionDetails)
                //{
                //    this.Update(requisitionDetail);
                //}
                //if (isSaved) inventory.SaveChanges();
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
        /// <summary>
        ///  Update ItemPrice data to ItemPrice Table according to the ItemPrice Parameter
        ///   Return Constants.DB_STATUS
        /// </summary>
        /// <param name="itemPrice"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(ItemPrice itemPrice)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                itemPriceObj = inventory.ItemPrices.Where(iObj => iObj.ItemId == itemPrice.ItemId).First();
                if (!itemPriceObj.Equals(null))
                {
                    Employee createdBy = inventory.Employees.Where(eObj => eObj.Id == itemPrice.CreatedBy.Id).First();
                    itemPriceObj.SupplierId  = itemPrice.SupplierId;
                    itemPriceObj.Price       = itemPrice.Price;
                    itemPriceObj.CreatedDate = itemPrice.CreatedDate;
                    itemPriceObj.CreatedBy   = createdBy;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Update the Employee information to employee table
        /// Return Constants.DB_STATUS
        /// </summary>
        /// <param name="employee"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(Employee employee)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                employeeObj = inventory.Employees.Where(eObj => eObj.Id == employee.Id).First();
                User       userId    = inventory.Users.Where(u => u.Id == employee.User.Id).First();
                Role       roleId    = inventory.Roles.Where(r => r.Id == employee.Role.Id).First();
                Department deptId    = inventory.Departments.Where(d => d.Id == employee.Department.Id).First();
                Employee   createdBy = inventory.Employees.Where(e => e.Id == employee.CreatedBy.Id).First();
                if (employeeObj != null)
                {
                    employeeObj.Id          = employee.Id;
                    employeeObj.User        = userId;
                    employeeObj.Role        = roleId;
                    employeeObj.Department  = deptId;
                    employeeObj.Name        = employee.Name;
                    employeeObj.Designation = employee.Designation;
                    employeeObj.Email       = employee.Email;
                    employeeObj.CreatedDate = employee.CreatedDate;
                    employeeObj.CreatedBy   = createdBy;
                    //this.Update(empObj.User);
                    //this.Update(empObj.Role);
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Update the collectionMissed data to the CollectionMissed Table
        /// </summary>
        /// <param name="collectionMissed"></param>
        /// <returns>
        /// Return DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Update(CollectionMissed collectionMissed)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;


            try
            {
                collectionMissedObj = inventory.CollectionMisseds.Where(c => c.Id == collectionMissed.Id).First();
                if (collectionMissedObj != null)
                {
                    //get the department and employee object by checking Id from collectionMissed table
                    departmentObj = inventory.Departments.Where(d => d.Id == collectionMissed.Department.Id).First();
                    Employee createdBy = inventory.Employees.Where(e => e.Id == collectionMissed.CreatedBy.Id).First();
                    collectionMissedObj.Id          = collectionMissed.Id;
                    collectionMissedObj.Department  = departmentObj;
                    collectionMissedObj.CreatedBy   = createdBy;
                    collectionMissedObj.CreatedDate = collectionMissed.CreatedDate;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
        /// <summary>
        /// Update RetrievalDetail data to RetrievalDetail Table according to the RetrievalDetail Parameter
        /// Return Constants.DB_STATUS
        /// </summary>
        /// <param name="retrievalDetail"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(RetrievalDetail retrievalDetail)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;
            try
            {
                RetrievalDetail rDetail = inventory.RetrievalDetails.Where(rObj => rObj.Id == retrievalDetail.Id).First();
                if (!rDetail.Equals(null))
                {
                    retrieval = inventory.Retrievals.Where(r => r.Id == retrievalDetail.Retrieval.Id).First();
                    Item       item       = inventory.Items.Where(i => i.Id == retrievalDetail.Item.Id).First();
                    Department department = inventory.Departments.Where(d => d.Id == retrievalDetail.Department.Id).First();

                    rDetail.Retrieval  = retrieval;
                    rDetail.Item       = item;
                    rDetail.Department = department;
                    rDetail.NeededQty  = retrievalDetail.NeededQty;
                    rDetail.ActualQty  = retrievalDetail.ActualQty;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Update the role data to the role table
        /// </summary>
        /// <param name="role"></param>
        /// <returns>
        /// Returns DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Update(Role role)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                roleObj = inventory.Roles.Where(rObj => rObj.Id == role.Id).First();
                Employee createdBy = inventory.Employees.Where(e => e.Id == role.CreatedBy.Id).First();
                if (roleObj != null)
                {
                    roleObj.Id          = role.Id;
                    roleObj.Name        = role.Name;
                    roleObj.CreatedDate = role.CreatedDate;
                    roleObj.CreatedBy   = createdBy;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
        /// <summary>
        ///  Update Retrieval data to Retrieval Table according to the Retrieval Parameter
        ///    Return Constants.DB_STATUS
        /// </summary>
        /// <param name="retrieval"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(Retrieval retrieval)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                Retrieval retrievalObj = inventory.Retrievals.Where(rObj => rObj.Id == retrieval.Id).First();
                Employee  createdBy    = inventory.Employees.Where(e => e.Id == retrieval.CreatedBy.Id).First();

                retrievalObj.Id          = retrieval.Id;
                retrievalObj.CreatedBy   = createdBy;
                retrievalObj.CreatedDate = retrieval.CreatedDate;
                foreach (RetrievalDetail retrievalDetail in retrieval.RetrievalDetails)
                {
                    this.Update(retrievalDetail);
                }
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
        /// <summary>
        /// Update PurchaseOrder data to the PurchaseOrder Table according to the purchaseOrder Parameter
        /// Return Constans.DB_STATUS
        /// </summary>
        /// <param name="purchaseOrder"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(PurchaseOrder purchaseOrder)
        {
            // throw new NotImplementedException();
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                //foreach (PurchaseOrderDetail purchaseOrderDetail in purchaseOrder.PurchaseOrderDetails)
                //{
                //    this.Update(purchaseOrderDetail);
                //}
                //inventory.SaveChanges();
                //status = Constants.DB_STATUS.SUCCESSFULL;
                purchaseorder = inventory.PurchaseOrders.Where(iObj => iObj.Id == purchaseOrder.Id).First();
                Supplier supplierId = inventory.Suppliers.Where(s => s.Id == purchaseorder.Supplier.Id).First();
                // purchaseorder.Supplier.Id = purchaseOrder.Supplier.Id;
                purchaseorder.Supplier       = supplierId;
                purchaseorder.DeliverAddress = purchaseOrder.DeliverAddress;
                purchaseorder.Attn           = purchaseOrder.Attn;
                purchaseorder.ExpectedDate   = purchaseOrder.ExpectedDate;
                purchaseorder.CreatedDate    = purchaseOrder.CreatedDate;
                purchaseorder.ApprovedDate   = purchaseOrder.ApprovedDate;
                purchaseorder.Status         = purchaseOrder.Status;

                //  supplierObj.CreatedDate = supplier.CreatedDate;

                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Update the REquisitionCollectionDetail from the parameter
        /// </summary>
        /// <param name="requisitionCollectionDetail"></param>
        /// <returns>
        /// Returns DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Update(RequisitionCollectionDetail requisitionCollectionDetail)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                requisitionCollectionDetailObj = inventory.RequisitionCollectionDetails.Where(reqObj => reqObj.Id == requisitionCollectionDetail.Id).First();
                if (!requisitionCollectionDetailObj.Equals(null))
                {
                    Requisition requistionId = inventory.Requisitions.Where(r => r.Id == requisitionCollectionDetail.Requisition.Id).First();
                    requisitionCollectionObj = inventory.RequisitionCollections.Where(r => r.Id == requisitionCollectionDetail.RequisitionCollection.Id).First();

                    requisitionCollectionDetailObj.Id                    = requisitionCollectionDetail.Id;
                    requisitionCollectionDetailObj.Requisition           = requistionId;
                    requisitionCollectionDetailObj.RequisitionCollection = requisitionCollectionObj;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
        /// <summary>
        /// Update Notification data to Notification table
        /// </summary>
        /// <param name="notification"></param>
        /// <returns>
        /// Retrun DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Update(Notification notification)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                notificationObj = inventory.Notifications.Where(n => n.Id == notification.Id).First();
                if (notificationObj != null)
                {
                    Employee employeeId = inventory.Employees.Where(e => e.Id == notification.Employee.Id).First();
                    notificationObj.Id          = notification.Id;
                    notificationObj.Employee    = employeeId;
                    notificationObj.Message     = notification.Message;
                    notificationObj.CreatedDate = notification.CreatedDate;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Update the Requisition Collection data to the Requisition Collection table
        /// </summary>
        /// <param name="requisitionCollection"></param>
        /// <returns>
        /// Return DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Update(RequisitionCollection requisitionCollection)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                //requisitionCollectionObj = inventory.RequisitionCollections.Where(reqObj => reqObj.Id == requisitionCollection.Id).First();
                //Department department = inventory.Departments.Where(d => d.Id == requisitionCollection.Department.Id).First();
                //CollectionPoint collectionPoint = inventory.CollectionPoints.Where(c => c.Id == requisitionCollection.CollectionPoint.Id).First();
                //Employee createdBy = inventory.Employees.Where(e => e.Id == requisitionCollection.CreatedBy.Id).First();
                //requisitionCollectionObj.Id = requisitionCollection.Id;
                //requisitionCollectionObj.Department = department;
                //requisitionCollectionObj.CollectionPoint = collectionPoint;
                //requisitionCollectionObj.CreatedDate = requisitionCollection.CreatedDate;
                //requisitionCollectionObj.CreatedBy = createdBy;
                //foreach (RequisitionCollectionDetail rd in requisitionCollectionObj.RequisitionCollectionDetails)
                //{
                //    this.Update(rd);
                //}
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
Ejemplo n.º 13
0
 /// <summary>
 ///  Update StockDetail data to StockDetail Table according to the StockDetail Parameter
 ///   Return Constants.DB_STATUS
 /// </summary>
 /// <param name="stockCardDetail"></param>
 /// <returns></returns>
 public Constants.DB_STATUS Update(StockCardDetail stockCardDetail)
 {
     Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;
     try
     {
         StockCardDetail stcDetail = inventory.StockCardDetails.Where(s => s.Id == stockCardDetail.Id).First();
         if (!stcDetail.Equals(null))
         {
             Item     item      = inventory.Items.Where(i => i.Id == stockCardDetail.Item.Id).First();
             Employee createdBy = inventory.Employees.Where(e => e.Id == stockCardDetail.CreatedBy.Id).First();
             stcDetail.Id          = stockCardDetail.Id;
             stcDetail.Item        = item;
             stcDetail.Description = stockCardDetail.Description;
             stcDetail.Qty         = stockCardDetail.Qty;
             stcDetail.Balance     = stockCardDetail.Balance;
             stcDetail.CreatedDate = stockCardDetail.CreatedDate;
             stcDetail.CreatedBy   = createdBy;
             inventory.AddToStockCardDetails(stockCardDetail);
             inventory.SaveChanges();
             status = Constants.DB_STATUS.SUCCESSFULL;
         }
     }
     catch (Exception e)
     {
         status = Constants.DB_STATUS.FAILED;
     }
     return(status);
 }
        /// <summary>
        /// Update PurchaseOrderDetail data to the PurchaseOrderDetail Table according to the purchaseOrderDetail Parameter
        /// Return Constans.DB_STATUS
        /// </summary>
        /// <param name="purchaseOrderDetail"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(PurchaseOrderDetail purchaseOrderDetail)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                PurchaseOrderDetail purchasedetail = inventory.PurchaseOrderDetails.Where(p => p.Id == purchaseOrderDetail.Id).First();
                if (!purchaseorderdetail.Equals(null))
                {
                    purchaseorder = inventory.PurchaseOrders.Where(p => p.Id == purchaseOrderDetail.PurchaseOrder.Id).First();
                    Item item = inventory.Items.Where(i => i.Id == purchaseOrderDetail.Item.Id).First();

                    purchasedetail.Id            = purchaseOrderDetail.Id;
                    purchasedetail.PurchaseOrder = purchaseorder;
                    purchasedetail.Price         = purchaseOrderDetail.Price;
                    purchasedetail.Qty           = purchaseOrderDetail.Qty;
                    purchasedetail.AcceptedQty   = purchaseOrderDetail.AcceptedQty;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Update Item data to Item Table according to the Item Parameter
        /// Return Constants.DB_STATUS
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(Item item)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                itemObj = inventory.Items.Where(iObj => iObj.Id == item.Id).First();
                if (!itemObj.Equals(null))
                {
                    Employee createdBy = inventory.Employees.Where(eObj => eObj.Id == item.CreatedBy.Id).First();
                    itemObj.ItemCategoryId  = item.ItemCategoryId;
                    itemObj.Description     = item.Description;
                    itemObj.ReorderLevel    = item.ReorderLevel;
                    itemObj.ReorderQty      = item.ReorderQty;
                    itemObj.Cost            = item.Cost;
                    itemObj.UnitOfMeasureId = item.UnitOfMeasureId;
                    itemObj.CreatedDate     = item.CreatedDate;
                    itemObj.CreatedBy       = createdBy;
                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Update Supplier data to the Supplier Table according to the Supplier Parameter
        ///  Return Constants.DB_STATUS
        /// </summary>
        /// <param name="supplier"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(Supplier supplier)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                supplierObj = inventory.Suppliers.Where(iObj => iObj.Id == supplier.Id).First();
                if (!supplierObj.Equals(null))
                {
                    Employee createdBy = inventory.Employees.Where(e => e.Id == supplier.CreatedBy.Id).First();
                    supplierObj.Id                    = supplier.Id;
                    supplierObj.Name                  = supplier.Name;
                    supplierObj.Priority              = supplier.Priority;
                    supplierObj.ContactName           = supplier.ContactName;
                    supplierObj.PhoneNumber           = supplier.PhoneNumber;
                    supplierObj.FaxNumber             = supplier.FaxNumber;
                    supplierObj.Address               = supplier.Address;
                    supplierObj.GstRegistrationNumber = supplier.GstRegistrationNumber;
                    supplierObj.CreatedDate           = supplier.CreatedDate;
                    supplierObj.CreatedBy             = createdBy;

                    inventory.SaveChanges();
                    status = Constants.DB_STATUS.SUCCESSFULL;
                }
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
        public Constants.ACTION_STATUS CreateAdjustment()
        {
            Constants.ACTION_STATUS status   = Constants.ACTION_STATUS.UNKNOWN;
            Constants.DB_STATUS     dbStatus = discrepancyBroker.Insert(stockAdjustment);
            if (dbStatus == Constants.DB_STATUS.SUCCESSFULL)
            {
                status = Constants.ACTION_STATUS.SUCCESS;
            }
            else
            {
                status = Constants.ACTION_STATUS.FAIL;
            }
            //   discrepancy.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.HIDDEN);
            List <DiscrepancyDetail> dd = GetList(discrepancy.DiscrepancyDetails.ToList());

            foreach (DiscrepancyDetail temp in dd)
            {
                StockCardDetail stockCardDetail = new StockCardDetail();
                stockCardDetail.Id          = itemBroker.GetStockCardDetailId();
                stockCardDetail.Item        = temp.Item;
                stockCardDetail.Description = "Stock Adjsutment " + stockAdjustment.Id;
                stockCardDetail.Qty         = temp.Qty;
                stockCardDetail.CreatedDate = DateTime.Now;
                stockCardDetail.CreatedBy   = Util.GetEmployee(employeeBroker);
                stockCardDetail.Status      = Converter.objToInt(Constants.VISIBILITY_STATUS.SHOW);
                stockCardDetail.Balance     = itemBroker.GetCurrentBalance(temp.Item) + Converter.objToInt(temp.Qty);
                itemBroker.Insert(stockCardDetail);
                temp.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.HIDDEN);
                //discrepancyBroker.Update(temp);
            }

            bool flag = false;

            foreach (DiscrepancyDetail temp in discrepancy.DiscrepancyDetails)
            {
                if (temp.Status == Converter.objToInt(Constants.VISIBILITY_STATUS.SHOW))
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                discrepancy.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.HIDDEN);
            }
            else
            {
                discrepancy.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.SHOW);
            }
            discrepancyBroker.Update(discrepancy);


            return(status);
        }
        public Constants.DB_STATUS Delete(DiscrepancyDetail discrepancyDetail)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
        public Constants.DB_STATUS Insert(StockAdjustment newStockAdjustment)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                inventory.AddToStockAdjustments(newStockAdjustment);
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Logically delete the Item table by setting the status to 2 in the Item table
        /// Return Constants.DB_STATUS
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Delete(Item item)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                itemObj        = inventory.Items.Where(iObj => iObj.Id == item.Id).First();
                itemObj.Status = 2;
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Insert Requisition dtail data to the Requisition detail Table according to the Requisition Parameter
        ///  Return Constants.DB_STATUS
        /// </summary>
        /// <param name="requisitionDetail"></param>
        /// <returns></returns>

        public Constants.DB_STATUS Insert(RequisitionDetail requisitionDetail)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                inventory.AddToRequisitionDetails(requisitionDetail);
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Logically Delete teh Requisition Collection Table
        /// </summary>
        /// <param name="requisitionCollection"></param>
        /// <returns>
        /// Return DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Delete(RequisitionCollection requisitionCollection)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                requisitionCollectionObj        = inventory.RequisitionCollections.Where(reqObj => reqObj.Id == requisitionCollection.Id).First();
                requisitionCollectionObj.Status = 2;
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
        /// <summary>
        ///  Insert PurchaseOrderDetail data to the PurchaseOrderDetail Table according to the newPurchaseOrderDetail Parameter
        ///  Return Constants.DB_STATUS
        /// </summary>
        /// <param name="newPurchaseOrderDetail"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Insert(PurchaseOrderDetail newPurchaseOrderDetail)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                inventory.AddToPurchaseOrderDetails(newPurchaseOrderDetail);
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Insert the role data to the role table
        /// </summary>
        /// <param name="newRole"></param>
        /// <returns>
        /// Return DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Insert(Role newRole)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                inventory.AddToRoles(newRole);
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
        /// <summary>
        /// Logically delete the Department table by setting the status to 2 in the Department table
        /// Return Constants.DB_STATUS
        /// </summary>
        /// <param name="department"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Delete(Department department)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                departmentObj        = inventory.Departments.Where(iObj => iObj.Id == department.Id).First();
                departmentObj.Status = 2;
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
        /// <summary>
        /// Logically delete the Item table by setting the status to 2 in the Item table
        ///  Return Constants.DB_STATUS
        /// </summary>
        /// <param name="retrieval"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Delete(Retrieval retrieval)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                Retrieval retrieve = inventory.Retrievals.Where(rObj => rObj.Id == retrieval.Id).First();
                retrieve.Status = 2;
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
        /// <summary>
        ///  Insert Discrepancy data to the Discrepancy and Discrepancy Detail Table according to the newdiscrepancy Parameter
        ///  Return Constants.DB_STATUS
        /// </summary>
        /// <param name="newdiscrepancy"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Insert(Discrepancy newdiscrepancy)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                inventory.AddToDiscrepancies(newdiscrepancy);

                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Insert RequisitionCollectionItem data from the parameter
        /// </summary>
        /// <param name="newRequisitionCollectionItem"></param>
        /// <returns>
        /// DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Insert(RequisitionCollectionItem newRequisitionCollectionItem)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                inventory.AddToRequisitionCollectionItems(newRequisitionCollectionItem);
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }
Ejemplo n.º 29
0
        /// <summary>
        ///  Logically delete the Supplier by setting the status to 2 in the Supplier table
        ///   Return Constants.DB_STATUS
        /// </summary>
        /// <param name="supplier"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Delete(Supplier supplier)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                supplierObj        = inventory.Suppliers.Where(iObj => iObj.Id == supplier.Id).First();
                supplierObj.Status = 2;
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }
            return(status);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Logically delete the status of collectionMissed table
        /// </summary>
        /// <param name="collectionMissed"></param>
        /// <returns>
        /// Return the DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Delete(CollectionMissed collectionMissed)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                collectionMissedObj        = inventory.CollectionMisseds.Where(c => c.Id == collectionMissed.Id).First();
                collectionMissedObj.Status = 2;
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

            return(status);
        }