Beispiel #1
0
        public HttpResponseMessage SendOtpEmail(String UserName)
        {
            BAL.AdminMasterBAL        objUser   = new BAL.AdminMasterBAL();
            List <ENT.AspNetUsersSUB> lstResult = new List <ENT.AspNetUsersSUB>();
            string ResponseMessage = "";
            string OTPGenerated    = "";

            try
            {
                lstResult = objUser.GetUserInfoByName(UserName);
                if (lstResult.Count > 0)
                {
                    int OTP = COM.ExtendedMethods.GenerateOTP();
                    BAL.SMTPManagement objSMTP = new BAL.SMTPManagement();
                    ResponseMessage = objSMTP.SendForgetPasswordOTP(lstResult[0].Email, OTP);
                    ENT.OTPCodeMaster objENTOTP = new ENT.OTPCodeMaster();
                    objENTOTP.otp_user_id = new Guid(lstResult[0].Id);
                    objENTOTP.otp_code    = OTP;
                    if (new BAL.OTPCodeMaster().Insert(objENTOTP))
                    {
                        OTPGenerated = "OTP Generated Successfully.";
                    }
                    else
                    {
                        OTPGenerated = "Internal Server Error.";
                    }
                }
            }
            catch (Exception ex)
            {
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { lstResult, ResponseMessage, ErrorMessage = ex.Message.ToString(), OTPGenerated = OTPGenerated }));
            }
            return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { lstResult, ResponseMessage, OTPGenerated = OTPGenerated }));
        }
Beispiel #2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main()
 {
     if (Environment.UserInteractive)
     {
         BAL.SMTPManagement objSendMail = new BAL.SMTPManagement();
         objSendMail.SendPlantDailyMail();
     }
     else
     {
         ServiceBase[] ServicesToRun;
         ServicesToRun = new ServiceBase[]
         {
             new srvReadInverterData()
         };
         ServiceBase.Run(ServicesToRun);
     }
 }