public RequisitionDetailsControl() { currentEmployee = Util.ValidateUser(); InventoryEntities inventory = new InventoryEntities(); requisitionBroker = new RequisitionBroker(inventory); requisitionCollectionBroker = new RequisitionCollectionBroker(inventory); RequisitionList = requisitionBroker.GetAllRequisition(currentEmployee.Department); }
public CreateStationeryRetrievalListControl() { currentEmployee = Util.ValidateUser(Constants.EMPLOYEE_ROLE.STORE_CLERK); inventory = new InventoryEntities(); retrievalBroker = new RetrievalBroker(inventory); requisitionCollectionBroker = new RequisitionCollectionBroker(inventory); itemBroker = new ItemBroker(inventory); employeeBroker = new EmployeeBroker(inventory); //retrievalList = retrievalBroker.GetAllRetrieval(); requisitionCollectionList = requisitionCollectionBroker.GetAllRequisitionCollection(Constants.COLLECTION_STATUS.NEED_TO_RETRIEVE); collectionDataColumn = new DataColumn[] { new DataColumn(collectionColumnName[0]), new DataColumn(collectionColumnName[1]), new DataColumn(collectionColumnName[2]), new DataColumn(collectionColumnName[3]) }; }
public UpdateStationeryRetrievalControl() { currentEmployee = Util.ValidateUser(Constants.EMPLOYEE_ROLE.STORE_CLERK); inventory = new InventoryEntities(); collectionMissedBroker = new CollectionMissedBroker(inventory); employeeBroker = new EmployeeBroker(inventory); retrievalBroker = new RetrievalBroker(inventory); requisitionCollectionBroker = new RequisitionCollectionBroker(inventory); //collectionList = requisitionCollectionBroker.GetAllRequisitionCollection(); dataColumn = new DataColumn[] { new DataColumn(columnName[0]), new DataColumn(columnName[1]), new DataColumn(columnName[2]), new DataColumn(columnName[3]), new DataColumn(columnName[4]), new DataColumn(columnName[5]) }; }
public UpdateCollectionDetailsByRequisitionControl() { currentEmployee = Util.ValidateUser(Constants.EMPLOYEE_ROLE.DEPARTMENT_REPRESENTATIVE); inventory = new InventoryEntities(); requisitionCollectionBroker = new RequisitionCollectionBroker(inventory); requisitionCollectionList = requisitionCollectionBroker.GetAllRequisitionCollection(currentEmployee.Department, Constants.COLLECTION_STATUS.NEED_TO_COLLECT); //collectedRequisitionCollectionList = requisitionCollectionBroker.GetAllRequisitionCollection(currentEmployee.Department, Constants.COLLECTION_STATUS.COLLECTED); collectionListDataColumn = new DataColumn[] { new DataColumn(collectionListColumnName[0]), new DataColumn(collectionListColumnName[1]), new DataColumn(collectionListColumnName[2]), new DataColumn(collectionListColumnName[3]), new DataColumn(collectionListColumnName[4]) }; requisitionDetailDataColumn = new DataColumn[] { new DataColumn(requisitionDetailColumnName[0]), new DataColumn(requisitionDetailColumnName[1]), new DataColumn(requisitionDetailColumnName[2]), new DataColumn(requisitionDetailColumnName[3]) }; }
public SubmitRequestToStoreControl() { currentEmployee = Util.ValidateUser(Constants.EMPLOYEE_ROLE.DEPARTMENT_REPRESENTATIVE); inventory = new InventoryEntities(); requisitionBroker = new RequisitionBroker(inventory); requisitionCollectionBroker = new RequisitionCollectionBroker(inventory); employeeBroker = new EmployeeBroker(inventory); Employee employee = new Employee(); employee.Id = currentEmployee.Id; employee = employeeBroker.GetEmployee(employee); requisitionCollection = new RequisitionCollection(requisitionCollectionBroker.GetRequisitionCollectionId(), employee.Department, employee.Department.CollectionPoint, DateTime.Now, employee, Converter.objToInt(Constants.COLLECTION_STATUS.NEED_TO_COLLECT)); approvedRequisitionList = requisitionBroker.GetAllRequisition(Constants.REQUISITION_STATUS.APPROVED, currentEmployee.Department); dataColumn = new DataColumn[] { new DataColumn(columnName[0]), new DataColumn(columnName[1]), new DataColumn(columnName[2]), new DataColumn(columnName[3]) }; }
//private DataColumn[] collectionDataColumn; // for drop down list public GenerateDisbursementControl() { currentEmployee = Util.ValidateUser(Constants.EMPLOYEE_ROLE.STORE_CLERK); inventory = new InventoryEntities(); retrievalBroker = new RetrievalBroker(inventory); requisitionCollectionBroker = new RequisitionCollectionBroker(inventory); requisitionBroker = new RequisitionBroker(inventory); employeeBroker = new EmployeeBroker(inventory); retrievalList = retrievalBroker.GetAllRetrieval(); requisitionCollectionList = new Dictionary <RequisitionCollection, DateTime>(); dataColumn = new DataColumn[] { new DataColumn(columnName[0]), new DataColumn(columnName[1]), new DataColumn(columnName[2]), new DataColumn(columnName[3]) }; //collectionDataColumn = new DataColumn[] { new DataColumn(collectionColumnName[0]), // new DataColumn(collectionColumnName[1]) }; }
//private DataColumn[] collectionDataColumn; // for drop down list public GenerateDisbursementControl() { currentEmployee = Util.ValidateUser(Constants.EMPLOYEE_ROLE.STORE_CLERK); inventory = new InventoryEntities(); retrievalBroker = new RetrievalBroker(inventory); requisitionCollectionBroker = new RequisitionCollectionBroker(inventory); requisitionBroker = new RequisitionBroker(inventory); employeeBroker = new EmployeeBroker(inventory); retrievalList = retrievalBroker.GetAllRetrieval(); requisitionCollectionList = new Dictionary<RequisitionCollection, DateTime>(); dataColumn = new DataColumn[]{ new DataColumn(columnName[0]), new DataColumn(columnName[1]), new DataColumn(columnName[2]), new DataColumn(columnName[3]) }; //collectionDataColumn = new DataColumn[] { new DataColumn(collectionColumnName[0]), // new DataColumn(collectionColumnName[1]) }; }
public UpdateCollectionDetailsByRequisitionItemControl() { currentEmployee = Util.ValidateUser(Constants.EMPLOYEE_ROLE.DEPARTMENT_REPRESENTATIVE); inventory = new InventoryEntities(); requisitionCollectionBroker = new RequisitionCollectionBroker(inventory); requisitionCollectionItemBroker = new RequisitionCollectionItemBroker(inventory); itemBroker = new ItemBroker(inventory); employeeBroker = new EmployeeBroker(inventory); requisitionCollectionList = requisitionCollectionBroker.GetAllRequisitionCollection(currentEmployee.Department, Constants.COLLECTION_STATUS.NEED_TO_COLLECT); //collectedRequisitionCollectionList = requisitionCollectionBroker.GetAllRequisitionCollection(currentEmployee.Department, Constants.COLLECTION_STATUS.COLLECTED); collectionListDataColumn = new DataColumn[] { new DataColumn(collectionListColumnName[0]), new DataColumn(collectionListColumnName[1]), new DataColumn(collectionListColumnName[2]), new DataColumn(collectionListColumnName[3]), new DataColumn(collectionListColumnName[4]) }; itemDetailDataColumn = new DataColumn[] { new DataColumn(itemDetailColumnName[0]), new DataColumn(itemDetailColumnName[1]), new DataColumn(itemDetailColumnName[2]), new DataColumn(itemDetailColumnName[3]) }; }
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 } } }
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 } } }