/// <summary> /// TO GET THE COUNTS FOR THE MANAGER /// </summary> /// <CreatedBy>Mano Jaswal</CreatedBy> /// <CretaedDate>2015-3-12</CretaedDate> /// <param name="LoginUserType"></param> /// <param name="LocationID"></param> /// <returns></returns> public List <ManagerModel> GetUserByManager(string LoginUserType, long LocationID, long iUserID) { ManagerRepositroy obj_ManagerRepositroy = new ManagerRepositroy(); return(obj_ManagerRepositroy.GetTotalCountOfUsers(LoginUserType, LocationID, iUserID).Select(x => new ManagerModel() { UserEmail = x.UserEmail, FirstName = x.FirstName, LastName = x.LastName, UserID = x.UserID, }).ToList()); }
///// <summary>SaveWorkRequest ///// ///// </summary> ///// <param name="objWorkRequestModel"></param> ///// <returns></returns> //public Result SaveWorkRequest(WorkRequestModel objWorkRequestModel) //{ // try // { // if (ChkDuplicateWorkRequest(objWorkRequestModel)) // { // WorkRequest _WorkRequest = new WorkRequest(); // objWorkRequestRepository = new WorkRequestRepository(); // AutoMapper.Mapper.CreateMap<WorkRequestModel, WorkRequest>(); // _WorkRequest = AutoMapper.Mapper.Map(objWorkRequestModel, _WorkRequest); // objWorkRequestRepository.Add(_WorkRequest); // objWorkRequestRepository.SaveChanges(); // if (_WorkRequest.WorkRequestID > 0) // return Result.Completed; // else // return Result.Failed; // } // else // { // return Result.DuplicateRecord; // } // } // catch (Exception) // { // throw; // } //} ///// <summary>GetAllWorkRequest ///// ///// </summary> ///// <param name="ProjectId"></param> ///// <param name="UserID"></param> ///// <param name="OperationName"></param> ///// <param name="pageIndex"></param> ///// <param name="numberOfRows"></param> ///// <param name="sortColumnName"></param> ///// <param name="sortOrderBy"></param> ///// <param name="textSearch"></param> ///// <param name="paramTotalRecords"></param> ///// <returns></returns> //public List<WorkRequestModelList> GetAllWorkRequest(long? projectId, long? userID, string operationName, int? pageIndex, int? numberOfRows, string sortColumnName, string sortOrderBy, string textSearch, ObjectParameter paramTotalRecords) //{ // objWorkRequestRepository = new WorkRequestRepository(); // try // { // return objWorkRequestRepository.GetAllWorkRequest(projectId, userID, operationName, pageIndex, numberOfRows, sortColumnName, sortOrderBy, textSearch, paramTotalRecords); // } // catch (Exception) // { // throw; // } //} ///// <summary>SaveWorkOrder ///// ///// </summary> ///// <param name="objWorkOrderModel"></param> ///// <returns></returns> //public Result SaveWorkOrder(WorkOrderModel objWorkOrderModel) //{ // try // { // objWorkOrderRepository = new WorkOrderRepository(); // objWorkRequestRepository = new WorkRequestRepository(); // WorkOrder _WorkOrder = new WorkOrder(); // string TaskStatus = Convert.ToString(WorkOrderStatus.Pending); // if (objWorkOrderModel.WorkOrderID == 0) // { // objWorkOrderModel.TaskStatus = objGlobalCodesRepository.GetSingleOrDefault(g => g.CodeName == TaskStatus).GlobalCodeId; // AutoMapper.Mapper.CreateMap<WorkOrderModel, WorkOrder>(); // _WorkOrder = AutoMapper.Mapper.Map(objWorkOrderModel, _WorkOrder); // objWorkOrderRepository.Add(_WorkOrder); // objWorkOrderRepository.SaveChanges(); // var data = objWorkRequestRepository.GetSingleOrDefault(s => s.WorkRequestID == objWorkOrderModel.WorkRequestID); // if (data != null) // { // data.status = Convert.ToString(WorkRequestStatus.Assigned); // objWorkRequestRepository.SaveChanges(); // } // return Result.Completed; // } // return Result.Failed; // } // catch (Exception) // { // throw; // } //} ///// <summary>ChkDuplicateWorkRequest ///// ///// </summary> ///// <param name="objWorkRequestModel"></param> ///// <returns></returns> //public bool ChkDuplicateWorkRequest(WorkRequestModel objWorkRequestModel) //{ // objWorkRequestRepository = new WorkRequestRepository(); // int count = objWorkRequestRepository.GetAll(w => w.AssetID == objWorkRequestModel.AssetID && EntityFunctions.TruncateTime(w.CreatedDate) == EntityFunctions.TruncateTime(DateTime.Now) && w.ProjectId == objWorkRequestModel.ProjectId).Count(); // if (count > 0) // return false; // return true; //} ///// <summary>DeleteWorkRequest ///// ///// </summary> ///// <param name="id"></param> ///// <returns></returns> //public Result DeleteWorkRequest(long id) //{ // objWorkRequestRepository = new WorkRequestRepository(); // try // { // var data = objWorkRequestRepository.GetSingleOrDefault(w => w.WorkRequestID == id); // if (data != null) // { // data.IsDeleted = true; // data.DeletedDate = DateTime.Now; // objWorkRequestRepository.SaveChanges(); // return Result.Delete; // } // else // { // return Result.Failed; // } // } // catch (Exception) // { // throw; // } //} #endregion WorkRequest #region Manage Asset //public Result SaveAsset(AssetMasterModel _AssetMasterModel) //{ // objAssetMasterRepository = new AssetMasterRepository(); // AssetMaster _AssetMaster = new AssetMaster(); // try // { // if (chkDuplicateAsset(_AssetMasterModel.AssetName, _AssetMasterModel.AssetID, _AssetMasterModel.ProjectID, _AssetMasterModel.AssetMasterID)) // { // if (_AssetMasterModel.AssetMasterID == 0) // { // AutoMapper.Mapper.CreateMap<AssetMasterModel, AssetMaster>(); // _AssetMaster = AutoMapper.Mapper.Map(_AssetMasterModel, _AssetMaster); // objAssetMasterRepository.Add(_AssetMaster); // objAssetMasterRepository.SaveChanges(); // if (_AssetMaster.AssetMasterID > 0) // return Result.Completed; // else // return Result.Failed; // } // //else // //{ // // var data = objInventoryMasterRepository.GetSingleOrDefault(i => i.InventoryID == _InventoryMasterModel.InventoryID); // // if (data != null) // // { // // data.ItemName = _InventoryMasterModel.ItemName; // // data.ItemCode = _InventoryMasterModel.ItemCode; // // data.ItemType = _InventoryMasterModel.ItemType; // // data.Description = _InventoryMasterModel.Description; // // data.Quantity = _InventoryMasterModel.Quantity; // // objInventoryMasterRepository.SaveChanges(); // // return Result.UpdatedSuccessfully; // // } // //} // } // else // return Result.DuplicateRecord; // } // catch (Exception) // { // throw; // } // return Result.Completed; //} //public bool chkDuplicateAsset(string AssetName, string AssetID, long? ProjectId, long AssetMasterID) //{ // objAssetMasterRepository = new AssetMasterRepository(); // int count = objAssetMasterRepository.GetAll(a => a.AssetName == AssetName && a.AssetID == AssetID && a.ProjectID != ProjectId && a.AssetMasterID != AssetMasterID).Count(); // if (count > 0) // return false; // return true; //} #endregion #region new code for vehicle #endregion /// <summary> /// TO GET THE COUNTS FOR THE MANAGER /// </summary> /// <CreatedBy>Mano Jaswal</CreatedBy> /// <CretaedDate>2015-2-25</CretaedDate> /// <param name="LoginUserType"></param> /// <param name="LocationID"></param> /// <returns></returns> public long GetTotalManagerCount(string LoginUserType, long LocationID, long iUserID) { ManagerRepositroy obj_ManagerRepositroy = new ManagerRepositroy(); return(obj_ManagerRepositroy.GetTotalCountOfUsers(LoginUserType, LocationID, iUserID).Count()); }