コード例 #1
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);
        }
コード例 #2
0
 /// <summary>
 /// Get CollectionMissed from CollectionMissed Table
 /// </summary>
 /// <param name="collectionMissed"></param>
 /// <returns>
 /// CollectionMissed Object
 /// </returns>
 public CollectionMissed GetCollectionMissed(CollectionMissed collectionMissed)
 {
     try
     {
         //Get the collectionMissed Object by collectionMissed Parameter's Id
         collectionMissedObj = inventory.CollectionMisseds.Where(c => c.Id == collectionMissed.Id).First();
     }
     catch (Exception e)
     {
         collectionMissedObj = null;
     }
     return(collectionMissedObj);
 }
コード例 #3
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);
        }
コード例 #4
0
        /// <summary>
        /// Insert the collectionMissed data to the CollectionMissed Table
        /// </summary>
        /// <param name="newCollectionMissed"></param>
        /// <returns>
        /// Return DB_STATUS
        /// </returns>
        public Constants.DB_STATUS Insert(CollectionMissed newCollectionMissed)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;


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

            return(status);
        }