Exemple #1
0
 public ActionResult ChangePSD(Forgot_Password fp)
 {
     try
     {
         if (true)
         {
             if (fp.Password == fp.ConfirmPassword)
             {
                 if (db.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.CUST_ID == fp.CUST_ID).Count() > 0)
                 {
                     PA_MOB_CUST_SIGHN_UP cfs = db.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.CUST_ID == fp.CUST_ID).SingleOrDefault();
                     cfs.PASSWORD        = EncryptDecrypt.Encrypt(fp.Password);
                     db.Entry(cfs).State = EntityState.Modified;
                     db.SaveChanges();
                 }
                 ViewBag.msg = "Password Succefully Changed .";
             }
             return(View("Change_Password"));
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Exemple #2
0
        public bool VerifyAccount(int Customer_id, string Date, string Tm)
        {
            try
            {
                TimeSpan time      = TimeSpan.Parse(Tm);
                DateTime f_time    = DateTime.ParseExact(Date, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                DateTime f_time112 = f_time + time;

                DateTime d1  = new DateTime(f_time112.Year, f_time112.Month, f_time112.Day, f_time112.Hour, f_time112.Minute, f_time112.Second);
                DateTime d2  = d1.AddHours(2);
                DateTime d3  = DateTime.Now;
                int      res = DateTime.Compare(d2, d3);
                if (res > 0)
                {
                    PA_MOB_CUST_SIGHN_UP cfs = dbCon.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.CUST_ID == Customer_id).SingleOrDefault();
                    cfs.ISACTIVE = true;;
                    dbCon.SaveChanges();
                    dbCon.Entry(cfs).State = EntityState.Detached;
                    return(true);
                    //ViewBag.verifiedAccount = "Your Account verified Sucessfully Now Uou can Log in from App.";
                }
                else
                {
                    return(false);
                    //ViewBag.verifiedAccount = "Sorry Link Validity Has Been Expired";
                }
                //return View("VerifyAccount");
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemple #3
0
 public void updateprofile(profileupdate prof)
 {
     try
     {
         bool tknVld = GF.ValidateToken(prof.DEVICE_ID, prof.TOKEN);
         if (tknVld == true)
         {
             PA_MOB_CUST_SIGHN_UP cfs = db.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.EMAIL_ID.ToUpper().Trim() == prof.USER_ID.ToUpper().Trim() && x.ISACTIVE == true).SingleOrDefault();
             if (cfs != null)
             {
                 cfs.MOBILE_NO = prof.MOBILE_NO;
                 cfs.ADDRESS   = prof.ADDRESS;
                 db.SaveChanges();
                 db.Entry(cfs).State = EntityState.Detached;
                 var routData = new CMNObject
                 {
                     STATUS_CODE = 200,
                     MESSAGE     = "Profile Successfully Updated"
                 };
                 json = JsonConvert.SerializeObject(routData, Formatting.Indented);
             }
             else
             {
                 var routedata = new CMNObject
                 {
                     STATUS_CODE = 401,
                     MESSAGE     = "Invalid USER ID"
                 };
                 json = JsonConvert.SerializeObject(routedata, Formatting.Indented);
             }
         }
         else
         {
             var routedata = new CMNObject
             {
                 STATUS_CODE = 401,
                 MESSAGE     = "Invalid User"
             };
             json = JsonConvert.SerializeObject(routedata, Formatting.Indented);
         }
     }
     catch (Exception ex)
     {
         var routData = new CMNObject
         {
             STATUS_CODE = 401,
             MESSAGE     = ex.Message
         };
         json = JsonConvert.SerializeObject(routData, Formatting.Indented);
     }
     HttpContext.Current.Response.Clear();
     HttpContext.Current.Response.Buffer          = true;
     HttpContext.Current.Response.Charset         = "UTF-8";
     HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
     HttpContext.Current.Response.ContentType     = "application/json";
     HttpContext.Current.Response.Write(json);
     HttpContext.Current.Response.End();
 }
Exemple #4
0
        public void UserSignUp(P_GHAR_API.Classes.SignUp data)
        {
            try
            {
                if (db.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.EMAIL_ID.ToUpper().Trim() == data.EMAIL_ID.ToUpper().Trim()).Count() > 0)
                {
                    var routData = new CMNObject
                    {
                        STATUS_CODE = 201,
                        MESSAGE     = "Credential already exists."
                    };
                    json = JsonConvert.SerializeObject(routData, Formatting.Indented);
                }
                else
                {
                    PA_MOB_CUST_SIGHN_UP SU = new PA_MOB_CUST_SIGHN_UP();
                    SU.FIRST_NAME = data.FIRST_NAME;
                    SU.LAST_NAME  = data.LAST_NAME;
                    SU.EMAIL_ID   = data.EMAIL_ID;
                    SU.MOBILE_NO  = data.MOBILE_NO;
                    SU.ISACTIVE   = false;
                    SU.PASSWORD   = EncryptDecrypt.Encrypt(data.PASSWORD);
                    SU.C_ON       = DateTime.Now.ToString("dd/MM/yyyy");
                    db.PA_MOB_CUST_SIGHN_UP.Add(SU);
                    db.SaveChanges();

                    string CUSTNAME      = data.FIRST_NAME + " " + data.LAST_NAME;
                    var    senderEmail   = new MailAddress("*****@*****.**", "Welcome " + CUSTNAME);
                    var    receiverEmail = new MailAddress(data.EMAIL_ID, "Receiver");
                    // var password = "******";
                    string subject = "VeggieRhino";
                    string htmlBody;
                    htmlBody = GF.PopulateBody(db.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.EMAIL_ID == data.EMAIL_ID).Select(x => x.CUST_ID).FirstOrDefault(), CUSTNAME);

                    MailMessage mail = new MailMessage();
                    mail.To.Add(data.EMAIL_ID);
                    mail.From       = new MailAddress("*****@*****.**", "VeggieRhino Customer Verification");
                    mail.Subject    = subject;
                    mail.IsBodyHtml = true;
                    string sbody = htmlBody;

                    mail.Body = sbody;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host        = "smtp.gmail.com";
                    smtp.Port        = 25;
                    smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "VeggieRhino@2020");
                    smtp.EnableSsl   = true;
                    if (data.EMAIL_ID != "")
                    {
                        smtp.Send(mail);
                    }

                    var routData = new CMNObject
                    {
                        STATUS_CODE = 200,
                        MESSAGE     = "Succesfully Sign Up,Link Shared on your email id please Verify Your Account."
                    };
                    json = JsonConvert.SerializeObject(routData, Formatting.Indented);
                    // bool ismailsent =   GF.SendEmail(data.EMAIL_ID, db.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.EMAIL_ID == data.EMAIL_ID).Select(x => x.CUST_ID).FirstOrDefault(), data.FIRST_NAME);
                    // if(ismailsent==true)
                    // {
                    //     var routData = new CMNObject
                    //     {
                    //         STATUS_CODE = 200,
                    //         MESSAGE = "Succesfully Sign Up,Link Shared on your email id please Verify Your Account"
                    //     };
                    //     json = JsonConvert.SerializeObject(routData, Formatting.Indented);
                    // }
                    //else
                    // {
                    //     var routData = new CMNObject
                    //     {
                    //         STATUS_CODE = 200,
                    //         MESSAGE = "Succesfully Sign Up,Some problem Occured during sending verification mail on your email id."
                    //     };
                    //     json = JsonConvert.SerializeObject(routData, Formatting.Indented);
                    // }
                }
            }
            catch (Exception ex)
            {
                var routData = new CMNObject
                {
                    STATUS_CODE = 401,
                    MESSAGE     = ex.Message
                };
                json = JsonConvert.SerializeObject(routData, Formatting.Indented);
            }
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Buffer          = true;
            HttpContext.Current.Response.Charset         = "UTF-8";
            HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
            HttpContext.Current.Response.ContentType     = "application/json";
            HttpContext.Current.Response.Write(json);
            HttpContext.Current.Response.End();
        }