public WCFUser ValidateUser(WCFUser User)
        {
            //return BusinessLogic.validateUser(userid, password);

            try
            {
                User user = userService.FindByUserID(User.UserID);
                if (user != null)
                {
                    if (User.PassWord == Encrypt.DecryptMethod(user.password))
                    {
                        return(WCFModelConvertUtility.ConvertToWCFUser(user));
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                // non existing userID
                return(null);
            }
        }
        public bool AddNewRequest(string requesterID, WCFRequisitionDetail[] newRequisition)
        {
            Requisition_Record newRecord = new Requisition_Record();

            newRecord.Requisition_Detail = new List <Requisition_Detail>();
            //newRecord.Requisition_Detail.Add(WCFModelConvertUtility.ConvertFromWCFRequisitionDetail(newRequisition));

            foreach (var wcf_detail in newRequisition)
            {
                newRecord.Requisition_Detail.Add(WCFModelConvertUtility.ConvertFromWCFRequisitionDetail(wcf_detail));
            }

            try
            {
                requisitionRecordService.SubmitNewRequisition(newRecord, requesterID);

                return(true);
            }
            catch (EmailException e)
            {
                // success submitssion
                return(true);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        public List <WCFRetrievalForm> getRetrievalList()
        {
            StationeryModel     entity = new StationeryModel();
            List <RetrieveForm> list   = new List <RetrieveForm>();
            DateTime            date   = DateTime.Now;
            List <RetrieveForm> model  = requisitionRecordService.GetRetrieveFormByDateTime(date);

            if (HttpContext.Current.Application["retrieveForm"] == null)
            {
                HttpContext.Current.Application["retrieveForm"] = model;
            }
            else if (HttpContext.Current.Application["retrieveForm"] != null)
            {
                List <RetrieveForm> list2 = (List <RetrieveForm>)HttpContext.Current.Application["retrieveForm"];

                foreach (var item in model)
                {
                    foreach (var i in list2)
                    {
                        if (i.ItemCode == item.ItemCode)
                        {
                            item.retrieveQty = i.retrieveQty;
                        }
                    }
                }
                HttpContext.Current.Application["retrieveForm"] = model;
            }

            //generate list of requisition records for allocation at the same time
            List <Requisition_Record> rr = entity.Requisition_Records.Where(x => x.status == RequisitionStatus.APPROVED_PROCESSING || x.status == RequisitionStatus.PARTIALLY_FULFILLED).ToList();

            HttpContext.Current.Application["requisitionRecordList_allocation"] = rr;

            return(WCFModelConvertUtility.ConvertToWCFRetrievalList(model));
        }
        public List <WCFRequisitionDetail> GetDetailsByReqNo(string reqNo)
        {
            int no = Int32.Parse(reqNo);
            List <Requisition_Detail> reqDetail = requisitionRecordService.GetDetailsByNo(no);

            return(WCFModelConvertUtility.ConvertToWCFRequestionDetails(reqDetail));
        }
Example #5
0
        public WCFUser GetUser(string userID)
        {
            StationeryModel entity  = new StationeryModel();
            User            user    = entity.Users.Where(x => x.userID == userID).First();
            WCFUser         wcfUser = WCFModelConvertUtility.ConvertToWCFUser(user);

            return(wcfUser);
        }
 public List <WCFRequisitionDetail> GetRequisitionDetailsByItemCode(string itemCode)
 {
     using (StationeryModel entity = new StationeryModel())
     {
         List <Requisition_Detail> temp = entity.Requisition_Detail.Where(x => x.itemCode == itemCode).ToList();
         return(WCFModelConvertUtility.ConvertToWCFRequestionDetails(temp));
     }
 }
 public WCFStationery GetStationery(string itemCode)
 {
     try
     {
         Stationery s = stationeryService.FindStationeryByItemCode(itemCode);
         return(WCFModelConvertUtility.ConvertToWCFStationery(s));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
 public WCFRequisitionDetail GetRequisitionDetailsBy2Keys(string itemCode, string requisitionNO)
 {
     try
     {
         Requisition_Detail detail = requisitionRecordService.FindDetailsBy2Key(itemCode, Convert.ToInt32(requisitionNO));
         return(WCFModelConvertUtility.ConvertToWCFRequisitionDetail(detail));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
 public List <WCFCategory> GetAllCategories()
 {
     try
     {
         List <Category> categories = stationeryService.GetAllCategory();
         return(WCFModelConvertUtility.ConvertToWCFCategories(categories));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
        public WCFRetrievalForm GetRetrievalForm(string itemCode)
        {
            List <RetrieveForm> list = new List <RetrieveForm>();

            if (HttpContext.Current.Application["retrieveForm"] != null)
            {
                list = (List <RetrieveForm>)HttpContext.Current.Application["retrieveForm"];
            }
            else
            {
                //can be assumed no items have been retrieved yet since there is no retrieval list generated
            }

            WCFRetrievalForm item = WCFModelConvertUtility.ConvertToWCFRetrieval(list.Where(x => x.ItemCode == itemCode).First());

            return(item);
        }
        //retrieve list must already be generated
        public List <WCFRequisitionRecord> GetAllRequestRecordForItemAllocation(string itemCode)
        {
            List <WCFRequisitionDetail> allRDForAllocation = GetAllRequisitionDetailsforAllocation().Where(x => x.ItemCode == itemCode).ToList();

            //if returns null "There is either no itemCode by that name or the retrieval list has not been generated, hence allocation cannot proceed"

            List <WCFRequisitionRecord> allRRForItem = new List <WCFRequisitionRecord>();

            //all record numbers for that item
            foreach (WCFRequisitionDetail WCFRd in allRDForAllocation)
            {
                allRRForItem.Add(WCFModelConvertUtility.ConvertToWCFRequisitionRecord(requisitionRecordService.GetRequisitionByID(WCFRd.RequisitionNo)));
                allRRForItem.Distinct().ToList();
            }


            return(allRRForItem);
        }
        public List <WCFStationery> GetStationeryByCategory(string categoryName)
        {
            try
            {
                string categoryID = "-1";

                if (categoryName != "All")
                {
                    List <Category> categories = stationeryService.GetAllCategory();
                    categoryID = categories.Find(x => x.categoryName == categoryName).categoryID.ToString();
                }

                List <Stationery> stationeries = stationeryService.GetStationeriesBasedOnCriteria(null, categoryID);
                return(WCFModelConvertUtility.ConvertToWCFStationery(stationeries));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        //allocation list should match the retrieval list
        public List <WCFRequisitionDetail> GetAllRequisitionDetailsforAllocation()
        {
            List <WCFRequisitionDetail> allocationList = new List <WCFRequisitionDetail>();

            if (HttpContext.Current.Application["requisitionRecordList_allocation"] == null)
            {
                return(allocationList = null); //empty and need to return some error msg
            }

            List <Requisition_Record> records = (List <Requisition_Record>)HttpContext.Current.Application["requisitionRecordList_allocation"];

            foreach (Requisition_Record rr in records)
            {
                List <Requisition_Detail>   temp    = rr.Requisition_Detail.ToList();
                List <WCFRequisitionDetail> wcftemp = WCFModelConvertUtility.ConvertToWCFRequestionDetails(temp);
                allocationList.AddRange(wcftemp);
            }

            return(allocationList);
        }
 public WCFUser GetUser(string userID, string password)
 {
     try
     {
         User user = userService.FindByUserID(userID);
         if (Encrypt.DecryptMethod(user.password) == password)
         {
             WCFUser wcfUser = WCFModelConvertUtility.ConvertToWCFUser(user);
             return(wcfUser);
         }
         else
         {
             WCFUser invalid = new WCFUser();
             return(invalid);
         }
     }
     catch (Exception e)
     {
         WCFUser invalid = new WCFUser();
         return(invalid);
     }
 }
        //public List<WCFDisbursement> GetCodeFromName(string name)
        //{
        //    stationeryService.GetAllStationery();

        //}


        //public List<Disbursement> getDisbursementList()
        //{
        //    throw new NotImplementedException();
        //}

        //public List<RequisitionRecord> getRequisitionListByUserID(string UserID)
        //{
        //    throw new NotImplementedException();
        //}

        //public List<RequisitionDetails> getrequisitionDetailsByNO(int requisitionNo)
        //{
        //    throw new NotImplementedException();
        //}

        public WCFDepartment GetDepartment(string departmentCode)
        {
            string deptCode = departmentCode.ToUpper().Trim();

            try
            {
                Department d = departmentService.GetDepartmentByCode(deptCode);
                if (d.departmentCode == deptCode)
                {
                    WCFDepartment WCFD = WCFModelConvertUtility.convertToWCFDepartment(d);
                    return(WCFD);
                }
                else
                {
                    WCFDepartment invalid = new WCFDepartment();
                    return(invalid);
                }
            }
            catch (Exception e)
            {
                WCFDepartment invalid = new WCFDepartment();
                return(invalid);
            }
        }
        public List <WCFDisbursement> GetPendingItemsToBeProcessedByDepartmentByItems(string deptCode)
        {
            List <Disbursement> pendingItemsByItem = requisitionRecordService.GetPendingDisbursementByDept(deptCode);

            return(WCFModelConvertUtility.ConvertToWCFDisbursement(pendingItemsByItem, deptCode));
        }
        public List <WCFDisbursement> GetDisbursementByDept(string deptCode)
        {
            List <Disbursement> disbursement = requisitionRecordService.GetRequisitionByDept(deptCode);

            return(WCFModelConvertUtility.ConvertToWCFDisbursement(disbursement, deptCode));
        }
        public List <WCFCollectionPoint> GetAllCollectionPoints()
        {
            List <Collection_Point> cpList = cpService.GetAllCollectionPoints2();

            return(WCFModelConvertUtility.convertToWCFCollectionPoints(cpList));
        }
        public List <WCFDepartment> GetAllDepartments()
        {
            List <Department> departmentList = departmentService.GetAllDepartment();

            return(WCFModelConvertUtility.ConvertToWCFDepartments(departmentList));
        }
        public List <WCFRequisitionRecord> GetAllRequisitionRecords()
        {
            List <Requisition_Record> requisitionRecords = requisitionRecordService.GetAllRequisition();

            return(WCFModelConvertUtility.ConvertToWCFRequisitionRecord(requisitionRecords));
        }
        public List <WCFRequisitionRecord> GetRequsitionRecordByDept(string deptCode)
        {
            List <Requisition_Record> reqByDept = requisitionRecordService.GetRequisitionRecordByDept(deptCode);

            return(WCFModelConvertUtility.ConvertToWCFRequisitionRecord(reqByDept));
        }
        public List <WCFRequisitionRecord> GetRequisitionRecordByRequesterID(string requesterID)
        {
            List <Requisition_Record> reqByReqID = requisitionRecordService.GetRequestByReqID(requesterID);

            return(WCFModelConvertUtility.ConvertToWCFRequisitionRecord(reqByReqID));
        }
        public List <WCFRequisitionDetail> GetPendingRequestByDept(string deptCode)
        {
            List <Requisition_Detail> reqDetail = requisitionRecordService.GetPendingRequestByDeptCode(deptCode);

            return(WCFModelConvertUtility.ConvertToWCFRequestionDetails(reqDetail));
        }