public CollectionMissed(int id, Department departmentId, Employee createdBy, DateTime createdDate, int status) { this.Id = id; this.Department = departmentId; this.CreatedBy = createdBy; this.CreatedDate = createdDate; this.Status = status; }
public RetrievalDetail(int id, Retrieval retrievalId, Item itemId, Department departmentId, int neededQty, int actualQty) { this.Id = id; this.Retrieval = retrievalId; this.Item = itemId; this.Department = departmentId; this.NeededQty = neededQty; this.ActualQty = actualQty; }
public Requisition(string id,Department department,Employee employee,string remarks,Employee approvedBy, DateTime createDate,int status) { this.Id = id; this.Department = department; this.CreatedBy = employee; this.Remarks = remarks; this.ApprovedBy = approvedBy; this.CreatedDate = createDate; this.Status = status; }
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; }
/// <summary> /// Get the list of collecionMissed according the Department Id in CollectionMissed table /// </summary> /// <param name="department"></param> /// <returns> /// List of collecionMissed /// </returns> public List<CollectionMissed> GetAllCollectionMissed(Department department) { try { //get the list of collectionMissed by checking Department Id collectionMissedList = inventory.CollectionMisseds.Where(c => c.Department.Id == department.Id).ToList(); } catch (Exception e) { collectionMissedList = null; } return collectionMissedList; }
public Employee(int id, User userId, Role roleId, Department departmentId, string name, int designation, string email, DateTime createdDate, Employee createdBy, int status) { this.Id = id; this.User = userId; this.Role = roleId; this.Department = departmentId; this.Name = name; this.Designation = designation; this.Email = email; this.CreatedDate = createdDate; this.CreatedBy = createdBy; this.Status = 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> /// Get the list of CollectionMissed by department Id and status /// </summary> /// <param name="department"></param> /// <param name="status"></param> /// <returns> /// List of CollectionMissed /// </returns> public List<CollectionMissed> GetAllCollectionMissed(Department department, Constants.VISIBILITY_STATUS status) { try { //get the collectionMissed List by checking department Id of collecion Missed Table and check the Visibility Status collectionMissedList = inventory.CollectionMisseds.Where(c => c.Department.Id == department.Id || status.Equals("SHOW")).ToList(); } catch (Exception e) { collectionMissedList = null; } return collectionMissedList; }
/// <summary> /// Insert Department data to the Department Table according to the department Parameter /// Return Constants.DB_STATUS /// </summary> /// <param name="newDepartment"></param> /// <returns></returns> public Constants.DB_STATUS Insert(Department newDepartment) { Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN; try { inventory.AddToDepartments(newDepartment); inventory.SaveChanges(); status = Constants.DB_STATUS.SUCCESSFULL; } catch (Exception e) { status = Constants.DB_STATUS.FAILED; } return status; }
/// <summary> /// Retreive All of the requisition information according to status /// </summary> /// <param name="requisitionStatus"></param> /// <returns></returns> public List<Requisition> GetAllRequisition(Department department) { try { requisitionList = inventory.Requisitions.Where(reqObj => reqObj.Department.Id.Contains(department.Id)).ToList<Requisition>(); } catch (Exception e) { requisitionList = null; } return requisitionList; }
/// <summary> /// Retreive All of the requisition information according to status /// </summary> /// <param name="requisitionStatus"></param> /// <returns></returns> public List<Requisition> GetAllRequisition(Constants.REQUISITION_STATUS requisitionStatus, Department department) { try { int status = Converter.objToInt(requisitionStatus); requisitionList = inventory.Requisitions.Where(reqObj => reqObj.Status == status && reqObj.Department.Id.Contains(department.Id)).OrderByDescending(reqObj => reqObj.CreatedDate).ToList<Requisition>(); } catch (Exception e) { requisitionList = null; } return requisitionList; }
/// <summary> /// Deprecated Method for adding a new object to the Departments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDepartments(Department department) { base.AddObject("Departments", department); }
/// <summary> /// Create a new Department object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="phoneNumber">Initial value of the PhoneNumber property.</param> /// <param name="faxNumber">Initial value of the FaxNumber property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> /// <param name="status">Initial value of the Status property.</param> public static Department CreateDepartment(global::System.String id, global::System.String name, global::System.String phoneNumber, global::System.String faxNumber, global::System.DateTime createdDate, global::System.Int32 status) { Department department = new Department(); department.Id = id; department.Name = name; department.PhoneNumber = phoneNumber; department.FaxNumber = faxNumber; department.CreatedDate = createdDate; department.Status = status; return department; }
/// <summary> /// Show all departments list except hidden departments /// Created By:Zin Mar Thwin /// Created Date:28-01-2012 /// Modified By: /// Modified Date: /// Modification Reason: /// Modified By: /// Modified Date: /// Modification Reason: /// </summary> /// <param name="itemDescription"></param> /// <returns>The return value of this method is resultItem.</returns> //private List<Department> GetDepaermentList() //{ // List<Department> list = new List<Department>(); // List<Department> newList = new List<Department>(); // list = departmentBroker.GetAllDepartment(); // foreach (Department dep in list) // { // if (dep.Status != (int)Constants.DEPARTMENT_STATUS.HIDDEN) // { // newList.Add(dep); // } // } // return newList; //} /// <summary> /// Set blacklist/unblacklist according to the department list that user clicks /// Created By:Zin Mar Thwin /// Created Date:28-01-2012 /// Modified By: /// Modified Date: /// Modification Reason: /// Modified By: /// Modified Date: /// Modification Reason: /// </summary> /// <param name="itemDescription"></param> /// <returns>The return value of this method is resultItem.</returns> public Constants.ACTION_STATUS SelectLink(string departmentId) { Constants.ACTION_STATUS status = Constants.ACTION_STATUS.UNKNOWN; Department department = new Department(); department.Id = departmentId; department = departmentBroker.GetDepartment(department); if (department != null) { switch (Converter.objToDepartmentStatus(department.Status)) { case Constants.DEPARTMENT_STATUS.BLACKLIST: department = blacklistDepartmentList.Find(delegate(Department dep) { return dep.Id == departmentId; }); // if(department!=null) department.Status = Converter.objToInt(Constants.DEPARTMENT_STATUS.UNBLACKLIST); foreach (CollectionMissed cm in department.CollectionMisseds.ToList()) { cm.Status = Converter.objToInt(Constants.VISIBILITY_STATUS.HIDDEN); collectionMissedBroker.Update(cm); } unblacklistDepartmentList.Add(department); blacklistDepartmentList.Remove(department); break; case Constants.DEPARTMENT_STATUS.UNBLACKLIST: department = unblacklistDepartmentList.Find(delegate(Department dep) { return dep.Id == departmentId; }); department.Status = Converter.objToInt(Constants.DEPARTMENT_STATUS.BLACKLIST); blacklistDepartmentList.Add(department); unblacklistDepartmentList.Remove(department); break; case Constants.DEPARTMENT_STATUS.SHOW: department = cleanDepartmentList.Find(delegate(Department dep) { return dep.Id == departmentId; }); department.Status = Converter.objToInt(Constants.DEPARTMENT_STATUS.BLACKLIST); blacklistDepartmentList.Add(department); unblacklistDepartmentList.Remove(department); break; } departmentBroker.Update(department); status = Constants.ACTION_STATUS.SUCCESS; } else { status = Constants.ACTION_STATUS.FAIL; } return status; }
static void Main() { // Write the Main Program for RequistionBrokerTest here... RequisitionBroker reqBroker = new RequisitionBroker(); Requisition req = new Requisition(); RequisitionDetail reqDetail=new RequisitionDetail(); Department dept = new Department(); Item item = new Item(); Employee emp = new Employee(); dept.Id = "COMM"; emp.Id = 1; emp.Department = dept; emp.Role = new Role(); emp.Role.Id = 1; emp.User = new User(); emp.User.Employee = emp; emp.User1 = new User(); emp.User1.Employee = emp; req.Department = dept; // req.Employee = emp; //req.Employee.Id=1; req.Remarks="Insert Test"; //req.ApprovedDate=new DateTime(23-01-2012); //req.CreatedDate=new DateTime(23-01-2012); req.Status=1; req.Employee = emp; req.Employee1 = emp; // reqDetail.Requisition.Id // reqDetail.Item.Id="1"; item.Id = "1"; reqDetail.Item=item; reqDetail.Qty=10; reqDetail.DeliveredQty=20; req.RequisitionDetails.Add(reqDetail); reqDetail.Item.Employee = reqDetail.Requisition.Employee; if (reqBroker.Insert(req).Equals("FAILED")) { Console.WriteLine("Successful"); } else { Console.WriteLine("Error"); } /* req.Id = "1"; if (reqBroker.GetRequisition(req) != null) { Console.WriteLine(reqBroker.GetRequisition(req).Remarks); foreach(RequisitionDetail reqDetial in reqBroker.GetRequisition(req).RequisitionDetails) Console.WriteLine(reqDetial.DeliveredQty); } if (reqBroker.GetAllRequisition().Count > 0) { Console.WriteLine("Retrieve all requisitions"); foreach (Requisition r in reqBroker.GetAllRequisition()) { Console.WriteLine(r.Id + " " + r.Remarks); foreach (RequisitionDetail rd in r.RequisitionDetails) { Console.WriteLine(rd.Id + " " + rd.Item.Description); } } } else { Console.WriteLine("Cannot read all requisitions"); } Console.WriteLine(SystemStoreInventorySystemUtil.Converter.objToInt(SystemStoreInventorySystemUtil.Constants.VISIBILITY_STATUS.SHOW)); Console.WriteLine(SystemStoreInventorySystemUtil.Constants.VISIBILITY_STATUS.SHOW); */ #region /* Do not remove this or write codes after this */ ISSConsole.Pause(); #endregion }
/// <summary> /// Retrieve the Department information from Department Table according to the department Parameter /// </summary> /// <param name="department"></param> /// <returns></returns> public Department GetDepartment(Department department) { ////Get the Department data by Department ID if (department.Status != 0) { int status = Converter.objToInt(department.Status); departmentObj = inventory.Departments.Where(iObj => iObj.Id == department.Id && department.Status == status).First(); } else { departmentObj = inventory.Departments.Where(iObj => iObj.Id == department.Id || iObj.Name.Contains(department.Name)).First(); } if (!departmentObj.Equals(null)) { //departmentObj.CreatedBy = inventory.Employees.Where(x => x.Id == departmentObj.CreatedBy.Id).First(); //departmentObj.EmployeeContactId = inventory.Employees.Where(x => x.Id == departmentObj.EmployeeContactId.Id).First(); //departmentObj.EmployeeHeadId = inventory.Employees.Where(x => x.Id == departmentObj.EmployeeHeadId.Id).First(); //departmentObj.EmployeeRepresentativeId = inventory.Employees.Where(x => x.Id == departmentObj.EmployeeRepresentativeId.Id).First(); //departmentObj.CollectionPoint = inventory.CollectionPoints.Where(x => x.Id == departmentObj.CollectionPoint.Id).First(); //foreach (Employee e in departmentObj.Employees) //{ // departmentObj.Employees.Add(e); //} return departmentObj; } return null; }
/// <summary> /// Update Department data to Department Table according to the department Parameter /// Return Constants.DB_STATUS /// </summary> /// <param name="department"></param> /// <returns></returns> public Constants.DB_STATUS Update(Department department) { Constants.DB_STATUS status = Constants.DB_STATUS.UNKNOWN; try { departmentObj = inventory.Departments.Where(iObj => iObj.Id == department.Id).First(); if (departmentObj != null) { //Employee contactId = inventory.Employees.Where(e => e.Id == departmentObj.EmployeeContactId.Id).First(); //Employee headId = inventory.Employees.Where(e => e.Id == departmentObj.EmployeeHeadId.Id).First(); //Employee representativeId = inventory.Employees.Where(e => e.Id == departmentObj.EmployeeRepresentativeId.Id).First(); //Employee createdBy = inventory.Employees.Where(e => e.Id == departmentObj.CreatedBy.Id).First(); //CollectionPoint collectionPId = inventory.CollectionPoints.Where(c => c.Id == departmentObj.CollectionPoint.Id).First(); departmentObj.Name = department.Name; departmentObj.Contact = department.Contact; departmentObj.PhoneNumber = department.PhoneNumber; departmentObj.FaxNumber = department.FaxNumber; departmentObj.Head = department.Head; departmentObj.CollectionPoint = department.CollectionPoint; //departmentObj.CollectionPoint.Id = department.CollectionPoint.Id; departmentObj.Representative = department.Representative; departmentObj.CreatedDate = department.CreatedDate; departmentObj.CreatedBy = department.CreatedBy ; inventory.SaveChanges(); status = Constants.DB_STATUS.SUCCESSFULL; } } catch (Exception e) { status = Constants.DB_STATUS.FAILED; } return status; }
/// <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; }
public ManageStationeryRetrievalListControl(object obj) { if (obj is List<RequisitionCollection>) { init(); requisitionCollectionBroker = new RequisitionCollectionBroker(inventory); List<RequisitionCollection> requisitionCollectionList = (List<RequisitionCollection>)obj; retrieval = new Retrieval(retrievalBroker.GetRetrievalId(), DateTime.Now, Util.GetEmployee(employeeBroker), Converter.objToInt(Constants.VISIBILITY_STATUS.SHOW)); retrievalList = new Dictionary<string, List<object>>(); unfulfilledRetrievalList = new Dictionary<string, List<object>>(); foreach (RequisitionCollection requisitionCollection in requisitionCollectionList) { foreach (RequisitionCollectionDetail requisitionCollectionDetail in requisitionCollection.RequisitionCollectionDetails) { foreach (RequisitionDetail requisitionDetail in requisitionCollectionDetail.Requisition.RequisitionDetails) { if (unfulfilledRetrievalList.ContainsKey(requisitionDetail.Item.Id.Trim())) { retrievalInfo = unfulfilledRetrievalList[requisitionDetail.Item.Id]; retrievalInfo[2] = Converter.objToInt(retrievalInfo[2]) + Converter.objToInt(requisitionDetail.Qty); ((RetrievalTable)retrievalInfo[4]).Add(requisitionCollectionDetail.Requisition.Department.Name, requisitionDetail.Qty, 0, requisitionCollectionDetail.Requisition.CreatedDate); // have the same total with current balance / fulfilled //if (Converter.objToInt(retrievalInfo[2]) <= Converter.objToInt(retrievalInfo[3])) //{ // ((RetrievalTable)retrievalInfo[4]).FullFill(); // retrievalList.Add(requisitionDetail.Item.Id, retrievalInfo); // unfulfilledRetrievalList.Remove(requisitionDetail.Item.Id); //} //else //{ unfulfilledRetrievalList[requisitionDetail.Item.Id] = retrievalInfo; //} } else { retrievalInfo = new List<object>(); retrievalInfo.Add(requisitionDetail.Item.Description); retrievalInfo.Add(requisitionDetail.Item.Bin); retrievalInfo.Add(requisitionDetail.Qty); int currentItemBalance = itemBroker.GetCurrentBalance(requisitionDetail.Item); retrievalInfo.Add(currentItemBalance); retrievalInfo.Add(new RetrievalTable(requisitionCollectionDetail.Requisition.Department.Name, requisitionDetail.Qty, 0, requisitionCollectionDetail.Requisition.CreatedDate)); //if (requisitionDetail.Qty <= currentItemBalance) //{ // retrievalList.Add(requisitionDetail.Item.Id, retrievalInfo); //} //else //{ unfulfilledRetrievalList.Add(requisitionDetail.Item.Id.Trim(), retrievalInfo); //} } } } requisitionCollection.Status = Converter.objToInt(Constants.COLLECTION_STATUS.NEED_TO_COLLECT); requisitionCollectionBroker.Update(requisitionCollection); } List<string> keyToBeRemoved = new List<string>(); foreach (string key in unfulfilledRetrievalList.Keys) { retrievalInfo = unfulfilledRetrievalList[key]; if (((RetrievalTable)retrievalInfo[4]).GetTotalQty("NeededQty") <= Converter.objToInt(retrievalInfo[3])) { ((RetrievalTable)retrievalInfo[4]).FullFill(); retrievalList.Add(key, retrievalInfo); keyToBeRemoved.Add(key); } } foreach (string key in keyToBeRemoved) { unfulfilledRetrievalList.Remove(key); } int addedId = 0; foreach (string key in retrievalList.Keys) { retrievalInfo = retrievalList[key]; Item item = new Item(); item.Id = key; item = itemBroker.GetItem(item); foreach(DataRow dr in ((RetrievalTable)retrievalInfo[4]).Rows) { RetrievalDetail retrievalDetail = new RetrievalDetail(); retrievalDetail.Id = retrievalBroker.GetRetrievalDetailId() + (addedId++); retrievalDetail.Item = item; Department department = new Department(); department.Name = dr["Department"].ToString(); department = departmentBroker.GetDepartment(department); retrievalDetail.Department = department; retrievalDetail.NeededQty = Converter.objToInt(dr["NeededQty"]); retrievalDetail.ActualQty = Converter.objToInt(dr["ActualQty"]); retrieval.RetrievalDetails.Add(retrievalDetail); } } foreach (string key in unfulfilledRetrievalList.Keys) { retrievalInfo = unfulfilledRetrievalList[key]; Item item = new Item(); item.Id = key; item = itemBroker.GetItem(item); foreach (DataRow dr in ((RetrievalTable)retrievalInfo[4]).Rows) { RetrievalDetail retrievalDetail = new RetrievalDetail(); retrievalDetail.Id = retrievalBroker.GetRetrievalDetailId() + (addedId++); retrievalDetail.Item = item; Department department = new Department(); department.Name = dr["Department"].ToString(); department = departmentBroker.GetDepartment(department); retrievalDetail.Department = department; retrievalDetail.NeededQty = Converter.objToInt(dr["NeededQty"]); retrievalDetail.ActualQty = Converter.objToInt(dr["ActualQty"]); retrieval.RetrievalDetails.Add(retrievalDetail); } } if (retrievalBroker.Insert(retrieval) == Constants.DB_STATUS.FAILED) { // do something } } }