public bool UpdateStatusApplicantDetail(PaymentDetails model, int?PaymentOption)
        {
            bool   IsSuccess     = false;
            string receiptPath   = string.Empty;
            int    status        = 0;
            bool   Ispaymentdone = false;

            if (model.Status == "Y")
            {
                receiptPath = ReadPaymentPDF(model.ApplicantId);
                var           result = apliDAL.GetApplicantById(model.ApplicantId);
                EmailTemplate email  = new EmailTemplate();
                email.AttachmentPath = System.Web.Hosting.HostingEnvironment.MapPath("/pdffile/" + receiptPath.Split('/')[2]);
                email.Subject        = "Payment Success";
                //email.Subject = "Payment Conformation From GulfBridge";
                email.Body  = ExternalPlugin.ReadPaymentConform(result.FullName, result.RefNumber);
                email.Email = result.EmailId.ToString();
                ExternalPlugin.SendEmailFromGmail(email);
                status        = 3;
                Ispaymentdone = true;
            }
            else
            {
                status = 4;
            }

            IsSuccess = apliDAL.UpdateStatusApplicantDetail(model.ApplicantId, Ispaymentdone, receiptPath, status, PaymentOption);
            return(IsSuccess);
        }
Ejemplo n.º 2
0
        public HttpResponseMessage SaveAdminUser(AspNetUser user)
        {
            logger.Info("Admin User Api Called");
            bool result = false;

            try
            {
                user.IsFirstLogin = true;
                user.PasswordHash = ExternalPlugin.CreateRandomPassword();
                user = Mapper.Map <GulfBridge.DAL.dbContext.AspNetUser, AspNetUser>(gulfBridgeDal.SaveUser(Mapper.Map <AspNetUser, GulfBridge.DAL.dbContext.AspNetUser>(user)));
                if (user != null && !string.IsNullOrEmpty(user.Id))
                {
                    EmailTemplate email    = new EmailTemplate();
                    AspNetUser    userinfo = new AspNetUser();
                    email.Email           = userinfo.Email = user.Email;
                    userinfo.PasswordHash = user.PasswordHash;
                    userinfo.UserName     = user.UserName;

                    email.Subject = "PSV User Login and Password";
#if DEBUG
#else
                    email.CC_Email = "*****@*****.**";
#endif
                    email.Body = ExternalPlugin.ReadEmailTemplate(userinfo);
                    result     = ExternalPlugin.SendEmail(email);

                    logger.Info("AdminUser Send Email Completed");
                }
            }
            catch (Exception e)
            {
                logger.Error("class:GulfBridgeController , method:SaveAdminUser  Exception is :", e);
            }
            return(Request.CreateResponse(result));
        }
Ejemplo n.º 3
0
        public HttpResponseMessage PostApplicant(ApplicantRegistration app)
        {
            ApplicantDetail applicantdetals = null;
            bool            result          = false;

            try
            {
                app.AspNetUser.PasswordHash = ExternalPlugin.CreateRandomPassword();
                //app.AspNetUser.PasswordHash = "123456";
                //app.AspNetUser.PasswordHash=ExternalPlugin.EncodePasswordToBase64(app.AspNetUser.PasswordHash);
                var userrecor = accountDal.SaveUser(Mapper.Map <AspNetUser, GulfBridge.DAL.dbContext.AspNetUser>(app.AspNetUser));
                if (userrecor != null)
                {
                    //string data = RefNumberKey + ExternalPlugin.GenerateRandomNo().ToString();
                    //var rec = Mapper.Map<IEnumerable<GulfBridge.DAL.dbContext.ApplicantDetail>, IEnumerable<ApplicantDetail>>(accountDal.GetApplicants());
                    //DateTime dateref = Convert.ToDateTime("2018-10-24");
                    //rec = rec.Where(a => a.CreatedOn <= dateref).ToList();
                    //rec = rec.Where(a => a.RefNumber == data).ToList();

                    //if (rec == null)
                    //app.ApplicantDetail.RefNumber = data;
                    //else
                    //{
                    // string data1 = RefNumberKey + ExternalPlugin.GenerateRandomNo().ToString();
                    // app.ApplicantDetail.RefNumber = data1;
                    //}

                    app.ApplicantDetail.RefNumber = RefNumberKey + ExternalPlugin.GenerateRandomNo().ToString() + ExternalPlugin.GenerateRandomText().ToString();
                    DateTime date         = Convert.ToDateTime(DateTime.Now.ToString());
                    string   datewithtime = date.Year.ToString() + date.Month.ToString("00") + date.Day.ToString("00") + date.TimeOfDay.Hours.ToString("00") + date.TimeOfDay.Minutes.ToString("00");
                    app.ApplicantDetail.GBSRefNo = GBSRefNo + "" + datewithtime;
                    app.ApplicantDetail.UserId   = userrecor.Id;
                    applicantdetals = Mapper.Map <GulfBridge.DAL.dbContext.ApplicantDetail, ApplicantDetail>(accountDal.SaveApplicant(Mapper.Map <ApplicantDetail, GulfBridge.DAL.dbContext.ApplicantDetail>(app.ApplicantDetail)));
                    app.AplicantPersonalInfo.ApplicantId = applicantdetals.Id;
                }
                if (app.AplicantPersonalInfo != null)
                {
                    result = accountDal.SaveApplicantPersonal(Mapper.Map <AplicantPersonalInfo, GulfBridge.DAL.dbContext.AplicantPersonalInfo>(app.AplicantPersonalInfo));
                    if (result)
                    {
                        EmailTemplate email = new EmailTemplate();

                        email.Email             = app.AspNetUser.Email;
                        app.AspNetUser.UserName = app.ApplicantDetail.FullName;
                        email.Subject           = "PSV User Login Password";
                        email.Body = ExternalPlugin.ReadEmailTemplate(app.AspNetUser);
                        result     = ExternalPlugin.SendEmail(email);
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error("class:AccountController , method:PostApplicant  Exception is :", e);
            }
            return(Request.CreateResponse(result));
        }
Ejemplo n.º 4
0
        public HttpResponseMessage SendOtpEmail(string email)
        {
            var  password  = ExternalPlugin.CreateRandomPassword();
            bool issuccess = ResetPassword(email, password);

            if (issuccess)
            {
                EmailTemplate emailtemplate = new EmailTemplate();
                emailtemplate.Email   = email;
                emailtemplate.Subject = "User Forgot Password Alert";
                emailtemplate.Body    = "Password to login : " + password;
                var result = ExternalPlugin.SendEmail(emailtemplate);
            }
            return(Request.CreateResponse(issuccess));
        }
        public HttpResponseMessage SaveApplicant(ApplicantDetail model)
        {
            model.Status   = 1;
            model.IsActive = true;
            if (string.IsNullOrEmpty(model.RefNumber))
            {
                //model.RefNumber = RefNumberKey + ExternalPlugin.GenerateRandomNo().ToString();
                model.RefNumber = RefNumberKey + ExternalPlugin.GenerateRandomNo().ToString() + ExternalPlugin.GenerateRandomText().ToString();
            }
            if (string.IsNullOrEmpty(model.GBSRefNo))
            {
                DateTime date         = Convert.ToDateTime(DateTime.Now.ToString());
                string   datewithtime = date.Year.ToString() + date.Month.ToString("00") + date.Day.ToString("00") + date.TimeOfDay.Hours.ToString("00") + date.TimeOfDay.Minutes.ToString("00");
                model.GBSRefNo = GBSRefNo + "" + datewithtime;
            }
            var result = apliDAL.SaveApplicant(Mapper.Map <ApplicantDetail, GulfBridge.DAL.dbContext.ApplicantDetail>(model));

            return(Request.CreateResponse(result));
        }
Ejemplo n.º 6
0
        public HttpResponseMessage SaveEmployeer(EmployerDetails emp)
        {
            logger.Info("Employeer SApi Called");
            bool result = false;

            try
            {
                AspNetUser user = new AspNetUser();
                user.Email        = emp.EmployerEmailaddress;
                user.PhoneNumber  = emp.EmployeerContactNo;
                user.UserType     = 2;
                user.IsActive     = true;
                user.PasswordHash = ExternalPlugin.CreateRandomPassword();
                // user.PasswordHash = "123456";
                user       = Mapper.Map <GulfBridge.DAL.dbContext.AspNetUser, AspNetUser>(gulfBridgeDal.SaveUser(Mapper.Map <AspNetUser, GulfBridge.DAL.dbContext.AspNetUser>(user)));
                emp.UserId = user.Id;
                result     = gulfBridgeDal.SaveEmployeer(Mapper.Map <EmployerDetails, GulfBridge.DAL.dbContext.EmployerDetail>(emp));
                if (result)
                {
                    EmailTemplate email    = new EmailTemplate();
                    AspNetUser    userinfo = new AspNetUser();
                    userinfo.Email        = emp.EmployerEmailaddress;
                    userinfo.PasswordHash = user.PasswordHash;
                    userinfo.UserName     = emp.EmployerName;
                    email.Email           = emp.EmployerEmailaddress;
                    email.Subject         = "PSV User Login and Password";

#if DEBUG
#else
                    email.CC_Email = "*****@*****.**";
#endif
                    email.Body = ExternalPlugin.ReadEmailTemplate(userinfo);
                    result     = ExternalPlugin.SendEmail(email);
                    logger.Info("Employeer Send Email Completed");
                }
            }
            catch (Exception e)
            {
                logger.Error("class:GulfBridgeController , method:SaveEmployeer  Exception is :", e);
            }
            return(Request.CreateResponse(result));
        }
Ejemplo n.º 7
0
        public HttpResponseMessage UpdateStatus(int status, int ApplicantId)
        {
            bool IsSuccess = false;
            var  result    = gulfBridgeDal.UpdateStatus(status, ApplicantId);

            if (result != null)
            {
                if (result.Status == 6)
                {
                    EmailTemplate email = new EmailTemplate();
                    email.Email   = result.EmailId;
                    email.Subject = "Applicant Process Completed";
                    //email.Body = "Applicant Process Completed Status Updated Successfully";
                    email.Body = ExternalPlugin.ReadCompleteStats();
                    ExternalPlugin.SendEmail(email);
                }
                IsSuccess = true;
            }
            return(Request.CreateResponse(IsSuccess));
        }
Ejemplo n.º 8
0
        public HttpResponseMessage PostEmployeer(EmployeerModel emper)
        {
            bool result = false;

            try
            {
                emper.usersinfo.UserType = 2;
                emper.usersinfo.IsActive = true;
                var userrecor = accountDal.SaveUser(Mapper.Map <AspNetUser, GulfBridge.DAL.dbContext.AspNetUser>(emper.usersinfo));
                if (userrecor != null)
                {
                    var userreo = Mapper.Map <GulfBridge.DAL.dbContext.AspNetUser, AspNetUser>(userrecor);
                    emper.EmpDetails.UserId    = userreo.Id;
                    emper.EmpDetails.IsActive  = true;
                    emper.EmpDetails.CreatedOn = DateTime.UtcNow;
                    var empstatus = accountDal.SaveEmplrDetails(Mapper.Map <EmployerDetails, GulfBridge.DAL.dbContext.EmployerDetail>(emper.EmpDetails));
                    if (empstatus != null)
                    {
                        var emprecord = Mapper.Map <GulfBridge.DAL.dbContext.EmployerDetail, EmployerDetails>(empstatus);
                        foreach (ApplicantDetail appl in emper.ApplicantList)
                        {
                            appl.UserId    = userrecor.Id;
                            appl.RefNumber = ExternalPlugin.GenerateRandomNo().ToString();
                            appl.IsActive  = true;
                            appl.CreatedOn = DateTime.UtcNow;
                            appl.Status    = 1;
                            //appl.EmployerId = emprecord.Id;
                        }
                        result = accountDal.SaveEmplrApplicants(Mapper.Map <List <ApplicantDetail>, List <GulfBridge.DAL.dbContext.ApplicantDetail> >(emper.ApplicantList));
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error("Exception is:" + e.Message + "Exception StackTrace" + e.StackTrace + "Exception Cls Name:AccountController & Method Name:PostEmployeer");
                result = false;
            }
            return(Request.CreateResponse(result));
        }