public RequisitionCollection(int id, Department departmentId, CollectionPoint collectionPointId, DateTime createdDate,
     Employee createdBy, int status)
 {
     this.Id = id;
     this.Department = departmentId;
     this.CollectionPoint = collectionPointId;
     this.CreatedDate = createdDate;
     this.CreatedBy = createdBy;
     this.Status = status;
 }
 public Department(string id, string name, Employee contactId, string phoneNumer, string faxNumer, Employee headId, CollectionPoint collectionPointId,
     Employee representativId, DateTime createdDate, Employee createdBy, int status)
 {
     this.Id = id;
     this.Name = name;
     this.Contact = contactId;
     this.PhoneNumber = phoneNumer;
     this.FaxNumber = faxNumer;
     this.Head = headId;
     this.CollectionPoint = collectionPointId;
     this.Representative = representativId;
     this.CreatedDate = createdDate;
     this.CreatedBy = createdBy;
     this.Status = status;
 }
        /// <summary>
        /// Logically delete the CollectionPoint table by setting the status to 2 in the CollectionPoint table
        /// Return Constants.DB_STATUS
        /// </summary>
        /// <param name="collectionPoint"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Delete(CollectionPoint collectionPoint)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
              //  cop = inventory.CollectionPoints.Where(c => c.Id == collectionPoint.Id).First();

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

            return status;
        }
 /// <summary>
 /// Create a new CollectionPoint object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="time">Initial value of the Time property.</param>
 public static CollectionPoint CreateCollectionPoint(global::System.Int32 id, global::System.String name, global::System.TimeSpan time)
 {
     CollectionPoint collectionPoint = new CollectionPoint();
     collectionPoint.Id = id;
     collectionPoint.Name = name;
     collectionPoint.Time = time;
     return collectionPoint;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the CollectionPoints EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCollectionPoints(CollectionPoint collectionPoint)
 {
     base.AddObject("CollectionPoints", collectionPoint);
 }
        public Constants.ACTION_STATUS SelectSave(int collectionPointId)
        {
            Constants.ACTION_STATUS status = Constants.ACTION_STATUS.UNKNOWN;

            try
            {
                Employee employee = new Employee();
                employee.Id = currentEmployee.Id;
                employee = employeeBroker.GetEmployee(employee);

                CollectionPoint collectionPoint = new CollectionPoint();
                collectionPoint.Id = collectionPointId;
                collectionPoint = collectionPointBroker.GetCollectionPoint(collectionPoint);

                if (collectionPoint != null)
                {

                    employee.Department.CollectionPoint = collectionPoint;

                    if (employeeBroker.Update(employee) == SystemStoreInventorySystemUtil.Constants.DB_STATUS.SUCCESSFULL)
                    {
                        currentEmployee = employee;
                        Util.SetEmployee(currentEmployee);
                        status = SystemStoreInventorySystemUtil.Constants.ACTION_STATUS.SUCCESS;
                    }
                    else
                    {
                        status = SystemStoreInventorySystemUtil.Constants.ACTION_STATUS.FAIL;
                    }
                }
                else
                {
                    status = Constants.ACTION_STATUS.FAIL;
                }

                if (status == Constants.ACTION_STATUS.SUCCESS)
                {
                    inventory.SaveChanges();
                }
            }
            catch (Exception e)
            {
                status = Constants.ACTION_STATUS.FAIL;
            }

            return status;
        }
 /// <summary>
 /// Retrieve the collection point information from CollectionPoint Table according to the collectionPoint Parameter
 /// </summary>
 /// <param name="collectionPoint"></param>
 /// <returns></returns>
 public CollectionPoint GetCollectionPoint(CollectionPoint collectionPoint)
 {
     try
     {
         ///Get the collectionPoint data by collectionPoint ID
         collectionPointObj = inventory.CollectionPoints.Where(copObj => copObj.Id == collectionPoint.Id).First();
     }
     catch (Exception e)
     {
         collectionPointObj = null;
     }
     return collectionPointObj;
 }
        /// <summary>
        /// Update collectionPoint data to CollectionPoint Table according to the collecionPoint Parameter
        /// Return Constants.DB_STATUS
        /// </summary>
        /// <param name="collectionPoint"></param>
        /// <returns></returns>
        public Constants.DB_STATUS Update(CollectionPoint collectionPoint)
        {
            Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN;

            try
            {
                collectionPointObj = inventory.CollectionPoints.Where(iObj => iObj.Id == collectionPoint.Id).First();
                Employee empId = inventory.Employees.Where(e => e.Id == collectionPoint.Clerk.Id).First();
                collectionPointObj.Id = collectionPoint.Id;
                collectionPointObj.Name = collectionPoint.Name;
                collectionPointObj.Time = collectionPoint.Time;
                collectionPointObj.Clerk = empId;
                inventory.SaveChanges();
                status = Constants.DB_STATUS.SUCCESSFULL;
            }
            catch (Exception e)
            {
                status = Constants.DB_STATUS.FAILED;
            }

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

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

            return status;
        }
Example #10
0
 public Department(string id, string name, Employee contactId, string phoneNumer, string faxNumer, Employee headId, CollectionPoint collectionPointId,
                   Employee representativId, DateTime createdDate, Employee createdBy, int status)
 {
     this.Id              = id;
     this.Name            = name;
     this.Contact         = contactId;
     this.PhoneNumber     = phoneNumer;
     this.FaxNumber       = faxNumer;
     this.Head            = headId;
     this.CollectionPoint = collectionPointId;
     this.Representative  = representativId;
     this.CreatedDate     = createdDate;
     this.CreatedBy       = createdBy;
     this.Status          = status;
 }