Esempio n. 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);
     }
 }
Esempio n. 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);
            }
        }
Esempio n. 3
0
        public void Addtocart(Addtotemp addobj)
        {
            try
            {
                bool tknVld = GF.ValidateToken(addobj.DEVICEID, addobj.TOKEN);
                if (tknVld == true)
                {
                    var ordDetails = addobj.ITEMDETAILS;
                    foreach (var item in ordDetails)
                    {
                        TEMP_PA_CART_DATA tp = new TEMP_PA_CART_DATA();
                        tp.CUSTOMER_ID = addobj.USER_ID;
                        tp.ITEM_ID     = item.ITEM_ID;
                        tp.QUANTITY    = item.ITEM_QUANTITY;
                        tp.CREATED_ON  = DateTime.Now;
                        tp.ISACTIVE    = true;
                        db.TEMP_PA_CART_DATA.Add(tp);
                        db.SaveChanges();
                    }

                    var routedata = new CMNObject
                    {
                        STATUS_CODE = 200,
                        MESSAGE     = "Product Saved on Db"
                    };
                    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();
        }
Esempio n. 4
0
        public bool UpdateToken(MobileAppToken userToken, string TOKEN)
        {
            bool retval = false;

            try
            {
                using (VeggierhinoEntities objEntity = new VeggierhinoEntities())
                {
                    bool Result = GF.IsValidlogin(userToken.USER_ID, userToken.PASSWORD);
                    if (Result == true)
                    {
                        PA_MOB_APP_TOKEN_AUTH objToken = objEntity.PA_MOB_APP_TOKEN_AUTH.Where(e => e.LOGIN_ID == userToken.USER_ID && e.DEVICE_ID == userToken.DEVICEID).FirstOrDefault();
                        if (objToken != null)
                        {
                            objToken.TOKEN = TOKEN;
                            objToken.U_ON  = DateTime.Now;
                        }
                        else
                        {
                            objToken           = new PA_MOB_APP_TOKEN_AUTH();
                            objToken.TOKEN     = TOKEN;
                            objToken.DEVICE_ID = userToken.DEVICEID.ToUpper();
                            objToken.LOGIN_ID  = userToken.USER_ID;
                            objToken.C_ON      = DateTime.Now;
                            objToken.U_ON      = DateTime.Now;
                            objEntity.PA_MOB_APP_TOKEN_AUTH.Add(objToken);
                        }
                        objEntity.SaveChanges();
                        retval = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retval);
        }
Esempio n. 5
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();
        }