/// <summary> /// Get Active Proxy based on Creator Employee and ServiceType /// </summary> /// <param name="FromEmployeeCodeID"></param> /// <param name="EServiceType"></param> /// <returns></returns> public EServicesProxiesBLL GetActiveByFromEmployeeCodeID(int FromEmployeeCodeID, EServicesTypesEnum EServiceType) { try { EServicesProxies EServiceProxy = new EServicesProxiesDAL().GetByFromEmployeeCodeID(FromEmployeeCodeID, (int)EServiceType) .FirstOrDefault(x => x.IsActive == true); return(this.MapEServiceProxy(EServiceProxy)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Get All Active Proxies based on Proxied(To) Employee /// </summary> /// <param name="ToEmployeeCodeID"></param> /// <returns></returns> public List <EServicesProxiesBLL> GetActiveByToEmployeeCodeID(int ToEmployeeCodeID) { try { List <EServicesProxies> EServiceProxyList = new EServicesProxiesDAL().GetActiveByToEmployeeCodeID(ToEmployeeCodeID).ToList(); List <EServicesProxiesBLL> EServiceProxyBLLList = new List <EServicesProxiesBLL>(); foreach (EServicesProxies item in EServiceProxyList) { EServiceProxyBLLList.Add(this.MapEServiceProxy(item)); } return(EServiceProxyBLLList); } catch (Exception ex) { throw ex; } }
public List <EServicesProxiesBLL> Get(EServicesTypesEnum EServiceType) { try { List <EServicesProxies> EServiceProxyList = new EServicesProxiesDAL().Get((int)EServiceType).ToList(); List <EServicesProxiesBLL> EServiceProxyBLLList = new List <EServicesProxiesBLL>(); foreach (EServicesProxies item in EServiceProxyList) { EServiceProxyBLLList.Add(this.MapEServiceProxy(item)); } return(EServiceProxyBLLList); } catch (Exception ex) { throw ex; } }
/// <summary> /// Get All Proxies based on Creator Employee /// </summary> /// <param name="FromEmployeeCodeID"></param> /// <param name="EServiceType"></param> /// <returns></returns> public List <EServicesProxiesBLL> GetByFromEmployeeCodeID(int FromEmployeeCodeID, EServicesTypesEnum?EServiceType) { try { List <EServicesProxies> EServiceProxyList = new EServicesProxiesDAL().GetByFromEmployeeCodeID(FromEmployeeCodeID, (int?)EServiceType).ToList(); List <EServicesProxiesBLL> EServiceProxyBLLList = new List <EServicesProxiesBLL>(); foreach (EServicesProxies item in EServiceProxyList) { EServiceProxyBLLList.Add(this.MapEServiceProxy(item)); } return(EServiceProxyBLLList); } catch (Exception ex) { throw ex; } }
public Result RevokeEServiceProxy(int EServiceProxyID, EServicesProxiesStatusEnum Status, string CancellationReason = "") { try { Result result = new Result(); EServicesProxies EServiceProxy = new EServicesProxiesDAL().GetActiveByEServiceProxyID(EServiceProxyID); if (EServiceProxy == null || EServiceProxy.EServiceProxyID <= 0) { result = new Result(); result.Entity = null; result.EnumType = typeof(EServicesAuthorizationsEnum); result.EnumMember = EServicesProxiesEnum.RejectedBecauseEServiceProxyIsNotActive.ToString(); return(result); } int ToEmployeeCodeID = EServiceProxy.ToEmployeeCodeID; int FromEmployeeCodeID = EServiceProxy.FromEmployeeCodeID; EServiceProxy = new EServicesProxies() { EServiceProxyID = EServiceProxyID, EndDate = DateTime.Now, EServiceProxyStatusID = (int)Status, IsActive = false, CancellationReason = CancellationReason, LastUpdatedDate = DateTime.Now, LastUpdatedBy = this.LoginIdentity.EmployeeCodeID }; this.EServiceProxyID = new EServicesProxiesDAL().Revoke(EServiceProxy); #region Send SMS on revoke to "ToEmployee" EmployeesCodesBLL FromEmployeeCodeBLL = new EmployeesCodesBLL().GetByEmployeeCodeID(FromEmployeeCodeID); EmployeesCodesBLL ToEmployeeCodeBLL = new EmployeesCodesBLL().GetByEmployeeCodeID(ToEmployeeCodeID); SMSBLL SMSObj = new SMSBLL(); SMSObj.SendSMS(new SMSLogsBLL() { BusinssSubCategory = BusinessSubCategoriesEnum.EServicesProxies, DetailID = this.EServiceProxyID, MobileNo = ToEmployeeCodeBLL.Employee.EmployeeMobileNo, Message = string.Format(Globalization.SMSEServicesProxiesRevokeText, ToEmployeeCodeBLL.Employee.EmployeeNameAr, FromEmployeeCodeBLL.Employee.EmployeeNameAr), CreatedBy = this.LoginIdentity, }); #endregion #region Send SMS on revoke to "FromEmployee" in case of Proxy cancelled by System if (Status == EServicesProxiesStatusEnum.CancelledBySystem) { SMSObj.SendSMS(new SMSLogsBLL() { BusinssSubCategory = BusinessSubCategoriesEnum.EServicesProxies, DetailID = this.EServiceProxyID, MobileNo = FromEmployeeCodeBLL.Employee.EmployeeMobileNo, Message = string.Format(Globalization.SMSEServicesProxiesRevokeBySytemText, FromEmployeeCodeBLL.Employee.EmployeeNameAr, CancellationReason), CreatedBy = this.LoginIdentity, }); } #endregion result.Entity = this; result.EnumType = typeof(EServicesProxiesEnum); result.EnumMember = EServicesProxiesEnum.Done.ToString(); return(result); } catch (Exception ex) { throw ex; } }