예제 #1
0
        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);
        }