public ResponseModel GetSubCategoryByMultiCategoryID(string CategoryIDs) { List <SubCategory> objSubCategory = new List <SubCategory>(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { MasterCaller newMasterSubCat = new MasterCaller(); objSubCategory = newMasterSubCat.GetSubCategoryByMultiCategoryID(new SubCategoryService(Cache, Db), CategoryIDs); statusCode = objSubCategory.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = objSubCategory; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel UpdatePriorityOrder(int selectedPriorityID, int currentPriorityID, int PriorityFor = 1) { ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); MasterCaller _newMaster = new MasterCaller(); bool iStatus = _newMaster.UpdatePriorityOrder(new PriorityService(Cache, Db), authenticate.TenantId, selectedPriorityID, currentPriorityID, PriorityFor); statusCode = iStatus ? (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.InternalServerError; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = iStatus; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel CreateClaimCategory([FromBody] ClaimCategory claimCategory) { MasterCaller newMasterCaller = new MasterCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); claimCategory.CreatedBy = authenticate.UserMasterID; claimCategory.TenantID = authenticate.TenantId; int result = newMasterCaller.CreateClaimCategory(new CategoryServices(Cache, Db), claimCategory); statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel AddDepartment(string DepartmentName) { ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; int result = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); MasterCaller newMasterBrand = new MasterCaller(); result = newMasterBrand.AddDepartment(new MasterServices(Cache, Db), DepartmentName, authenticate.TenantId, authenticate.UserMasterID); statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel getStoreDepartmentList() { List <StoreDepartmentModel> objDepartmentList = new List <StoreDepartmentModel>(); ResponseModel objResponseModel = new ResponseModel(); int StatusCode = 0; string statusMessage = ""; try { string _token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(radisCacheServerAddress, SecurityService.DecryptStringAES(_token)); MasterCaller newMasterBrand = new MasterCaller(); objDepartmentList = newMasterBrand.GetStoreDepartmentList(new StoreDepartmentService(connectioSting), authenticate.TenantId); StatusCode = objDepartmentList.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode); objResponseModel.Status = true; objResponseModel.StatusCode = StatusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = objDepartmentList; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel GetCountryStateCityList(string Pincode) { List <CommonModel> objcommonModels = new List <CommonModel>(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { ////Get token (Double encrypted) and get the tenant id string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); MasterCaller newMasterCaller = new MasterCaller(); objcommonModels = newMasterCaller.GetCountryStateCityList(new MasterServices(Cache, Db), authenticate.TenantId, Pincode); statusCode = objcommonModels.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = objcommonModels; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel DeleteClaimCategory(int CategoryID) { MasterCaller newMasterCategory = new MasterCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token)); int result = newMasterCategory.DeleteClaimCategory(new CategoryServices(_connectioSting), CategoryID, authenticate.TenantId); statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel AddClaimIssueType(int SubcategoryID, string IssuetypeName) { ResponseModel objResponseModel = new ResponseModel(); int StatusCode = 0; string statusMessage = ""; int result = 0; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token)); MasterCaller newMasterCategory = new MasterCaller(); result = newMasterCategory.AddClaimIssueType(new CategoryServices(_connectioSting), SubcategoryID, IssuetypeName, authenticate.TenantId, authenticate.UserMasterID); StatusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordAlreadyExists : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode); objResponseModel.Status = result == 0 ? false : true; objResponseModel.StatusCode = StatusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel GetClaimSubCategoryByCategoryID(int CategoryID, int TypeId = 0) { List <SubCategory> objSubCategory = new List <SubCategory>(); ResponseModel objResponseModel = new ResponseModel(); int StatusCode = 0; string statusMessage = ""; try { MasterCaller newMasterSubCat = new MasterCaller(); objSubCategory = newMasterSubCat.GetClaimSubCategoryByCategoryID(new CategoryServices(_connectioSting), CategoryID, TypeId); StatusCode = objSubCategory.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode); objResponseModel.Status = true; objResponseModel.StatusCode = StatusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = objSubCategory; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel GetClaimSubCategoryByCategoryOnSearch(int CategoryID, string searchText) { List <SubCategory> objSubCategory = new List <SubCategory>(); ResponseModel objResponseModel = new ResponseModel(); int StatusCode = 0; string statusMessage = ""; try { MasterCaller newMasterSubCat = new MasterCaller(); string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token)); objSubCategory = newMasterSubCat.GetClaimSubCategoryByCategoryOnSearch(new CategoryServices(_connectioSting), authenticate.TenantId, CategoryID, searchText); StatusCode = objSubCategory.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode); objResponseModel.Status = true; objResponseModel.StatusCode = StatusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = objSubCategory; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel GetStoreCodeWithStoreName() { List <StoreTypeMaster> objStoreTypeList = new List <StoreTypeMaster>(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); MasterCaller newMasterRegion = new MasterCaller(); objStoreTypeList = newMasterRegion.GetStoreNameWithStoreCode(new MasterServices(Cache, Db), authenticate.TenantId); statusCode = objStoreTypeList.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = objStoreTypeList; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel getTicketSources() { List <TicketSourceMaster> ticketSourceMasters = new List <TicketSourceMaster>(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { MasterCaller newMasterChannel = new MasterCaller(); ticketSourceMasters = newMasterChannel.GetTicketSource(new MasterServices(Cache, Db)); statusCode = ticketSourceMasters.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = ticketSourceMasters; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel DeletePriority(int PriorityID, int PriorityFor = 1) { MasterCaller masterCaller = new MasterCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); int result = masterCaller.Deletepriority(new PriorityService(Cache, Db), PriorityID, authenticate.TenantId, authenticate.UserMasterID, PriorityFor); statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordInUse : (int)EnumMaster.StatusCode.RecordDeletedSuccess; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel GetCategoryListByMultiBrandID(string BrandIDs) { List <Category> objcategory = new List <Category>(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); MasterCaller newMasterCategory = new MasterCaller(); objcategory = newMasterCategory.GetCategoryListByMultiBrandID(new CategoryServices(Cache, Db), BrandIDs, authenticate.TenantId); statusCode = objcategory.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = objcategory; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel ListCategorybrandmapping() { List <CustomCreateCategory> customCreateCategories = new List <CustomCreateCategory>(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); MasterCaller newMasterCategory = new MasterCaller(); customCreateCategories = newMasterCategory.ListCategoryBrandMapping(new CategoryServices(Cache, Db)); statusCode = customCreateCategories.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = customCreateCategories; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel AddBrand([FromBody] Brand brand) { MasterCaller newMasterBrand = new MasterCaller(); ResponseModel objResponseModel = new ResponseModel(); int StatusCode = 0; string statusMessage = ""; try { ////Get token (Double encrypted) and get the tenant id string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); brand.CreatedBy = authenticate.UserMasterID; int result = newMasterBrand.AddBrand(new BrandServices(Cache, Db), brand, authenticate.TenantId); StatusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordAlreadyExists : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode); objResponseModel.Status = true; objResponseModel.StatusCode = StatusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel DeleteBrand(int BrandID) { ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { ////Get token (Double encrypted) and get the tenant id string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); MasterCaller _newMasterBrand = new MasterCaller(); int result = _newMasterBrand.DeleteBrand(new BrandServices(Cache, Db), BrandID, authenticate.TenantId); statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordInUse : (int)EnumMaster.StatusCode.RecordDeletedSuccess; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel ForgetPassword(string EmailId) { ResponseModel objResponseModel = new ResponseModel(); try { /////Validate User securityCaller securityCaller = new securityCaller(); Authenticate authenticate = securityCaller.validateUserEmailId(new SecurityService(Cache, Db), EmailId); if (authenticate.UserMasterID > 0) { MasterCaller masterCaller = new MasterCaller(); SMTPDetails sMTPDetails = masterCaller.GetSMTPDetails(new MasterServices(Cache, Db), authenticate.TenantId); CommonService commonService = new CommonService(); string encryptedEmailId = commonService.Encrypt(EmailId); string url = Configuration.GetValue <string>("websiteURL") + "/userforgotPassword?Id:" + encryptedEmailId; // string body = "Hello, This is Demo Mail for testing purpose. <br/>" + url; string content = ""; string subject = ""; securityCaller.GetForgetPassowrdMailContent(new SecurityService(Cache, Db), authenticate.TenantId, url, EmailId, out content, out subject); bool isUpdate = securityCaller.sendMail(new SecurityService(Cache, Db), sMTPDetails, EmailId, subject, content, authenticate.TenantId); if (isUpdate) { objResponseModel.Status = true; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.Success; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.Success); objResponseModel.ResponseData = "Mail sent successfully"; } else { objResponseModel.Status = false; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.InternalServerError; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.InternalServerError); objResponseModel.ResponseData = "Mail sent failure"; } } else { objResponseModel.Status = false; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.RecordNotFound; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.RecordNotFound); objResponseModel.ResponseData = "Sorry User does not exist or active"; } } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel CreateCategorybrandmapping([FromBody] CustomCreateCategory customCreateCategory) { ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; int result = 0; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); MasterCaller newMasterCategory = new MasterCaller(); customCreateCategory.CreatedBy = authenticate.UserMasterID; result = newMasterCategory.CreateCategoryBrandMapping(new CategoryServices(Cache, Db), customCreateCategory); if (customCreateCategory.BrandCategoryMappingID == 0) { if (result == 0) { statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordAlreadyExists : (int)EnumMaster.StatusCode.Success; } else { statusCode = result > 0 ? (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.RecordNotFound; } } else { statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; } statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
public List <Category> GetCategoryList(int BrandID) { List <Category> objCategoryList = new List <Category>(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); //authenticate.TenantId = 1; MasterCaller newMasterCategory = new MasterCaller(); objCategoryList = newMasterCategory.GetCategoryList(new CategoryServices(Cache, Db), authenticate.TenantId, BrandID); } catch (Exception) { throw; } return(objCategoryList); }
public List <Category> GetClaimCategoryListByBrandID(int BrandID) { List <Category> objCategoryList = new List <Category>(); ResponseModel objResponseModel = new ResponseModel(); int StatusCode = 0; string statusMessage = ""; try { if (BrandID == 0) { return(objCategoryList); } string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token)); MasterCaller newMasterCategory = new MasterCaller(); objCategoryList = newMasterCategory.GetClaimCategoryList(new CategoryServices(_connectioSting), authenticate.TenantId, BrandID); StatusCode = objCategoryList.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode); objResponseModel.Status = true; objResponseModel.StatusCode = StatusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = objCategoryList; } catch (Exception) { throw; } return(objCategoryList); }
public ResponseModel SendReportMail([FromBody] ReportMailModel reportmailmodel) { ResponseModel objResponseModel = new ResponseModel(); TicketingCaller ticketingCaller = new TicketingCaller(); MasterCaller masterCaller = new MasterCaller(); try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); SettingsCaller _dbsearchMaster = new SettingsCaller(); bool IsSent = _dbsearchMaster.SendReportMail(new ReportService(Cache, Db), reportmailmodel.EmailID, reportmailmodel.FilePath, authenticate.TenantId, authenticate.UserMasterID); if (IsSent) { objResponseModel.Status = true; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.Success; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.Success); objResponseModel.ResponseData = "Mail sent successfully."; } else { objResponseModel.Status = false; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.InternalServerError; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.InternalServerError); objResponseModel.ResponseData = "Mail sent failure."; } } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel GetUserList( ) { List <User> objUserList = new List <User>(); ResponseModel objResponseModel = new ResponseModel(); int StatusCode = 0; string statusMessage = ""; try { ////Get token (Double encrypted) and get the tenant id string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token)); MasterCaller newMasterBrand = new MasterCaller(); objUserList = newMasterBrand.GetUserList(new UserServices(_connectioSting), authenticate.TenantId, authenticate.UserMasterID); StatusCode = objUserList.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode); objResponseModel.Status = true; objResponseModel.StatusCode = StatusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = objUserList; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel ForgetPassword(string EmailId) { ResponseModel objResponseModel = new ResponseModel(); try { /////Validate User string X_Authorized_Programcode = Convert.ToString(Request.Headers["X-Authorized-Programcode"]); string X_Authorized_Domainname = Convert.ToString(Request.Headers["X-Authorized-Domainname"]); string _data = ""; if (X_Authorized_Programcode != null) { X_Authorized_Programcode = SecurityService.DecryptStringAES(X_Authorized_Programcode); RedisCacheService cacheService = new RedisCacheService(_radisCacheServerAddress); if (cacheService.Exists("Con" + X_Authorized_Programcode)) { _data = cacheService.Get("Con" + X_Authorized_Programcode); _data = JsonConvert.DeserializeObject <string>(_data); } } if (X_Authorized_Domainname != null) { X_Authorized_Domainname = SecurityService.DecryptStringAES(X_Authorized_Domainname); } securityCaller securityCaller = new securityCaller(); Authenticate authenticate = securityCaller.validateUserEmailId(new SecurityService(_data, _radisCacheServerAddress), EmailId); if (authenticate.UserMasterID > 0) { MasterCaller masterCaller = new MasterCaller(); SMTPDetails sMTPDetails = masterCaller.GetSMTPDetails(new MasterServices(_data), authenticate.TenantId); CommonService commonService = new CommonService(); string encryptedEmailId = commonService.Encrypt(EmailId); string url = X_Authorized_Domainname.TrimEnd('/') + "/storeUserforgotPassword?Id:" + encryptedEmailId; // string body = "Hello, This is Demo Mail for testing purpose. <br/>" + url; string content = ""; string subject = ""; securityCaller.GetForgetPassowrdMailContent(new SecurityService(_connectioSting), authenticate.TenantId, url, EmailId, out content, out subject); bool isUpdate = securityCaller.sendMail(new SecurityService(_connectioSting), sMTPDetails, EmailId, subject, content, authenticate.TenantId); if (isUpdate) { objResponseModel.Status = true; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.Success; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.Success); objResponseModel.ResponseData = "Mail sent successfully"; } else { objResponseModel.Status = false; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.InternalServerError; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.InternalServerError); objResponseModel.ResponseData = "Mail sent failure"; } } else { objResponseModel.Status = false; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.RecordNotFound; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.RecordNotFound); objResponseModel.ResponseData = "Sorry User does not exist or active"; } } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel BulkUploadCategory(IFormFile File, int CategoryFor = 1) { string downloadFilePath = string.Empty; string bulkUploadFilesPath = string.Empty; bool errorfilesaved = false; bool successFilesaved = false; int count = 0; MasterCaller masterCaller = new MasterCaller(); SettingsCaller fileU = new SettingsCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; DataSet dataSetCSV = new DataSet(); string fileName = ""; string finalAttchment = ""; string timeStamp = DateTime.Now.ToString("ddmmyyyyhhssfff"); string[] filesName = null; List <string> CSVlist = new List <string>(); try { var files = Request.Form.Files; if (files.Count > 0) { for (int i = 0; i < files.Count; i++) { fileName += files[i].FileName.Replace(".", timeStamp + ".") + ","; } finalAttchment = fileName.TrimEnd(','); } var Keys = Request.Form; var exePath = Path.GetDirectoryName(System.Reflection .Assembly.GetExecutingAssembly().CodeBase); Regex appPathMatcher = new Regex(@"(?<!fil)[A-Za-z]:\\+[\S\s]*?(?=\\+bin)"); var appRoot = appPathMatcher.Match(exePath).Value; string Folderpath = appRoot + "\\" + UploadedBulkFile; if (files.Count > 0) { filesName = finalAttchment.Split(","); for (int i = 0; i < files.Count; i++) { using (var ms = new MemoryStream()) { files[i].CopyTo(ms); var fileBytes = ms.ToArray(); MemoryStream msfile = new MemoryStream(fileBytes); FileStream docFile = new FileStream(Folderpath + "\\" + filesName[i], FileMode.Create, FileAccess.Write); msfile.WriteTo(docFile); docFile.Close(); ms.Close(); msfile.Close(); string s = Convert.ToBase64String(fileBytes); byte[] a = Convert.FromBase64String(s); // act on the Base64 data } } } string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); #region FilePath bulkUploadFilesPath = appRoot + "\\" + "BulkUpload\\UploadFiles" + "\\" + CommonFunction.GetEnumDescription((EnumMaster.FileUpload)CategoryFor); downloadFilePath = appRoot + "\\" + "BulkUpload\\DownloadFiles" + "\\" + CommonFunction.GetEnumDescription((EnumMaster.FileUpload)CategoryFor); #endregion dataSetCSV = CommonService.csvToDataSet(Folderpath + "\\" + finalAttchment); CSVlist = masterCaller.CategoryBulkUpload(new CategoryServices(Cache, Db), authenticate.TenantId, authenticate.UserMasterID, CategoryFor, dataSetCSV); #region Create Error and Succes files and Insert in FileUploadLog if (!string.IsNullOrEmpty(CSVlist[0])) { errorfilesaved = CommonService.SaveFile(downloadFilePath + "\\Category\\ Error" + "\\" + "CategoryErrorFile.csv", CSVlist[0]); } if (!string.IsNullOrEmpty(CSVlist[1])) { successFilesaved = CommonService.SaveFile(downloadFilePath + "\\Category\\Success" + "\\" + "CategorySuccessFile.csv", CSVlist[1]); } count = fileU.CreateFileUploadLog(new FileUploadService(Cache, Db), authenticate.TenantId, "Categorymaster.csv", errorfilesaved, "CategoryErrorFile.csv", "CategorySuccessFile.csv", authenticate.UserMasterID, "Category", downloadFilePath + "\\Category\\Error" + "\\" + "CategoryErrorFile.csv", downloadFilePath + "\\Category\\ Success" + "\\" + "CategorySuccessFile.csv", CategoryFor ); #endregion statusCode = count > 0 ? (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.RecordNotFound; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = CSVlist.Count; } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel SendMailforchangepassword(int userID, int IsStoreUser = 1) { CustomChangePassword customChangePassword = new CustomChangePassword(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); UserCaller userCaller = new UserCaller(); customChangePassword = userCaller.SendMailforchangepassword(new UserServices(Cache, Db), userID, authenticate.TenantId, IsStoreUser); if (customChangePassword.UserID > 0 && customChangePassword.Password != null && customChangePassword.EmailID != null) { MasterCaller masterCaller = new MasterCaller(); SMTPDetails sMTPDetails = masterCaller.GetSMTPDetails(new MasterServices(Cache, Db), authenticate.TenantId); securityCaller securityCaller = new securityCaller(); CommonService commonService = new CommonService(); string encryptedEmailId = SecurityService.Encrypt(customChangePassword.EmailID); string decriptedPassword = SecurityService.DecryptStringAES(customChangePassword.Password); string url = Configuration.GetValue <string>("websiteURL") + "/ChangePassword"; string body = "Dear User, <br/>Please find the below details. <br/><br/>" + "Your Email ID : " + customChangePassword.EmailID + "<br/>" + "Your Password : "******"<br/><br/>" + "Click on Below link to change the Password <br/>" + url + "?Id:" + encryptedEmailId; bool isUpdate = securityCaller.sendMailForChangePassword(new SecurityService(Cache, Db), sMTPDetails, customChangePassword.EmailID, body, authenticate.TenantId); if (isUpdate) { objResponseModel.Status = true; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.Success; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.Success); objResponseModel.ResponseData = "Mail sent successfully"; } else { objResponseModel.Status = false; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.InternalServerError; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.InternalServerError); objResponseModel.ResponseData = "Mail sent failure"; } } else { objResponseModel.Status = false; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.RecordNotFound; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.RecordNotFound); objResponseModel.ResponseData = "Sorry User does not exist or active"; } /* StatusCode = * isUpdate !=true ? * (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; * statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode); * * objResponseModel.Status = true; * objResponseModel.StatusCode = StatusCode; * objResponseModel.Message = statusMessage; * objResponseModel.ResponseData = "Email Sent";*/ } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel SendMailforchangepassword(int userID, int IsStoreUser = 1) { CustomChangePassword customChangePassword = new CustomChangePassword(); ResponseModel objResponseModel = new ResponseModel(); try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token)); string _data = ""; string ProgramCode = authenticate.ProgramCode; RedisCacheService cacheService = new RedisCacheService(_radisCacheServerAddress); if (cacheService.Exists("Con" + ProgramCode)) { _data = cacheService.Get("Con" + ProgramCode); _data = JsonConvert.DeserializeObject <string>(_data); } string X_Authorized_Domainname = Convert.ToString(Request.Headers["X-Authorized-Domainname"]); if (X_Authorized_Domainname != null) { X_Authorized_Domainname = SecurityService.DecryptStringAES(X_Authorized_Domainname); } UserCaller userCaller = new UserCaller(); customChangePassword = userCaller.SendMailforchangepassword(new UserServices(_data), userID, authenticate.TenantId, IsStoreUser); if (customChangePassword.UserID > 0 && customChangePassword.Password != null && customChangePassword.EmailID != null) { MasterCaller masterCaller = new MasterCaller(); SMTPDetails sMTPDetails = masterCaller.GetSMTPDetails(new MasterServices(_data), authenticate.TenantId); securityCaller _securityCaller = new securityCaller(); CommonService commonService = new CommonService(); string encryptedEmailId = SecurityService.Encrypt(customChangePassword.EmailID); string decriptedPassword = SecurityService.DecryptStringAES(customChangePassword.Password); string url = configuration.GetValue <string>("websiteURL") + "/ChangePassword"; string body = "Dear User, <br/>Please find the below details. <br/><br/>" + "Your Email ID : " + customChangePassword.EmailID + "<br/>" + "Your Password : "******"<br/><br/>" + "Click on Below link to change the Password <br/>" + url + "?Id:" + encryptedEmailId; bool isUpdate = _securityCaller.sendMailForChangePassword(new SecurityService(_connectioSting), sMTPDetails, customChangePassword.EmailID, body, authenticate.TenantId); if (isUpdate) { objResponseModel.Status = true; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.Success; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.Success); objResponseModel.ResponseData = "Mail sent successfully"; } else { objResponseModel.Status = false; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.InternalServerError; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.InternalServerError); objResponseModel.ResponseData = "Mail sent failure"; } } else { objResponseModel.Status = false; objResponseModel.StatusCode = (int)EnumMaster.StatusCode.RecordNotFound; objResponseModel.Message = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)(int) EnumMaster.StatusCode.RecordNotFound); objResponseModel.ResponseData = "Sorry User does not exist or active"; } } catch (Exception) { throw; } return(objResponseModel); }
public ResponseModel BulkUploadClaimCategory(int CategoryFor = 3) { string DownloadFilePath = string.Empty; string BulkUploadFilesPath = string.Empty; bool errorFileSaved = false; bool successFileSaved = false; int count = 0; MasterCaller masterCaller = new MasterCaller(); StoreFileUploadCaller fileU = new StoreFileUploadCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; DataSet dataSetCSV = new DataSet(); string fileName = ""; string finalAttchment = ""; string timeStamp = DateTime.Now.ToString("ddmmyyyyhhssfff"); string[] filesName = null; List <string> CSVlist = new List <string>(); try { var files = Request.Form.Files; if (files.Count > 0) { for (int i = 0; i < files.Count; i++) { fileName += files[i].FileName.Replace(".", timeStamp + ".") + ","; } finalAttchment = fileName.TrimEnd(','); } var Keys = Request.Form; string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token)); #region FilePath string Folderpath = Directory.GetCurrentDirectory(); filesName = finalAttchment.Split(","); BulkUploadFilesPath = Path.Combine(Folderpath, BulkUpload, UploadFiles, CommonFunction.GetEnumDescription((EnumMaster.FileUpload)CategoryFor)); DownloadFilePath = Path.Combine(Folderpath, BulkUpload, DownloadFile, CommonFunction.GetEnumDescription((EnumMaster.FileUpload)CategoryFor)); if (!Directory.Exists(BulkUploadFilesPath)) { Directory.CreateDirectory(BulkUploadFilesPath); } if (files.Count > 0) { for (int i = 0; i < files.Count; i++) { using (var ms = new MemoryStream()) { files[i].CopyTo(ms); var fileBytes = ms.ToArray(); MemoryStream msfile = new MemoryStream(fileBytes); FileStream docFile = new FileStream(Path.Combine(BulkUploadFilesPath, filesName[i]), FileMode.Create, FileAccess.Write); msfile.WriteTo(docFile); docFile.Close(); ms.Close(); msfile.Close(); string s = Convert.ToBase64String(fileBytes); byte[] a = Convert.FromBase64String(s); // act on the Base64 data } } } #endregion dataSetCSV = CommonService.csvToDataSet(Path.Combine(BulkUploadFilesPath, filesName[0])); CSVlist = masterCaller.ClaimCategoryBulkUpload(new CategoryServices(_connectioSting), authenticate.TenantId, authenticate.UserMasterID, CategoryFor, dataSetCSV); #region Create Error and Success files and Insert in FileUploadLog string SuccessFileName = "Store_CategorySuccessFile_" + timeStamp + ".csv"; string ErrorFileName = "Store_CategoryErrorFile_" + timeStamp + ".csv"; string SuccessFileUrl = !string.IsNullOrEmpty(CSVlist[0]) ? rootPath + BulkUpload + "/" + DownloadFile + "/" + CommonFunction.GetEnumDescription((EnumMaster.FileUpload)CategoryFor) + "/Success/" + SuccessFileName : string.Empty; string ErrorFileUrl = !string.IsNullOrEmpty(CSVlist[1]) ? rootPath + BulkUpload + "/" + DownloadFile + "/" + CommonFunction.GetEnumDescription((EnumMaster.FileUpload)CategoryFor) + "/Error/" + ErrorFileName : string.Empty; if (!string.IsNullOrEmpty(CSVlist[0])) { successFileSaved = CommonService.SaveFile(Path.Combine(DownloadFilePath, "Success", SuccessFileName), CSVlist[0]); } if (!string.IsNullOrEmpty(CSVlist[1])) { errorFileSaved = CommonService.SaveFile(Path.Combine(DownloadFilePath, "Error", ErrorFileName), CSVlist[1]); } count = fileU.CreateFileUploadLog(new StoreFileUploadService(_connectioSting), authenticate.TenantId, filesName[0], true, ErrorFileName, SuccessFileName, authenticate.UserMasterID, "Store_Category", SuccessFileUrl, ErrorFileUrl, CategoryFor); #endregion statusCode = count > 0 ? (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.RecordNotFound; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = CSVlist.Count; } catch (Exception) { throw; } return(objResponseModel); }