Exemplo n.º 1
0
 public int EditDriver(DriverModel model)
 {
     Hashtable HT = new Hashtable();
     HT.Add("DriverID", model.DriverID);
     HT.Add("UserId", model.UserId);
     HT.Add("DriverName", model.DriverName);
     HT.Add("Email", model.Email);
     HT.Add("Mobile", model.Mobile);
     HT.Add("Password", model.Password);
     HT.Add("CrDate", model.CrDate);
     HT.Add("Language", model.Language);
     HT.Add("nWayInfo", model.nWayInfo);
     HT.Add("Paypal", model.Paypal);
     HT.Add("nWayPoint", model.nWayPoint);
     HT.Add("TaxiType", model.TaxiType);
     HT.Add("Status", model.Status);
     HT.Add("Latitute", model.Latitude);
     HT.Add("Longitude", model.Longitude);
     HT.Add("UpdateTime", model.UpdateTime);
     HT.Add("DeviceType", model.DeviceType);
     HT.Add("DeviceToken", model.DeviceToken);
     HT.Add("PhootUrl", model.PhotoUrl);
     HT.Add("CreateTimeM", model.CreateTimeM);
     HT.Add("UpdateTimeM", model.UpdateTimeM);
     HT.Add("AuthorityCardUrl", model.AuthorityCardUrl);
     HT.Add("DriverLicenceUrl", model.DriverLicenceUrl);
     HT.Add("TaxiNumber", model.TaxiNumber);
     HT.Add("VarifyTime", model.VarifyTime);
     HT.Add("PhoneVerified", model.PhoneVerified);
     int i = dbContext.ExecuteSP("udp_Driver_ups", HT);
     return i;
 }
Exemplo n.º 2
0
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                string filename = ConfigurationManager.AppSettings["PhotoDir"].TrimStart('~') + "user.png";
                var user = new ApplicationUser { UserName = model.UserName, Email = model.Email };
                var result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
                    EmailModel em = new EmailModel();
                    string token = usService.GetSecurityStamp(user.Id);
                    em.UserName = model.Name;
                    em.Subject = "[Lira Taxi]- Your Registration Successfully.";
                    em.Summary = "Please active your account to click on below button.";
                    em.ModuleLink = ConfigurationManager.AppSettings["WebDomain"] + "Account/ConfirmEmail?UserId=" + user.Id + "&code=" + token;
                    em.LeadName = "Thanks for Register on Lirataxi.com";
                    em.EmailTo = ConfigurationManager.AppSettings["EstimationMail"] + ";" + model.Email; // ; saperated email ids.
                    var bl = await sendMail.ActivationMail(em);

                    int i = 0;
                    if (model.UserType == "1")
                    {
                        DriverService db = new DriverService();
                        DriverModel md = new DriverModel();
                        md.UserId = user.Id;
                        md.DriverName = model.Name;
                        md.Email = model.Email;
                        md.Mobile = model.Mobile;
                        md.Password = model.Password;
                        md.Longitude = "0";
                        md.Latitude = "0";
                        md.DeviceToken = "";
                        md.DeviceType = "";
                        md.UpdateTime = DateTime.Now;
                        md.nWayPoint = 0;
                        md.nWayInfo = "";
                        md.Paypal = "";
                        md.Status = "OffDuty";
                        md.Language = "En";
                        md.CrDate = DateTime.Now;
                        md.PhotoUrl = filename;
                        i = db.AddDriver(md);
                        if (i == 0)
                        {
                            return View(model);
                        }
                        else
                        {
                            return RedirectToAction("Index", "Driver", new { area = "En" });
                        }
                    }
                    else if (model.UserType == "2")
                    {
                        PassengerService db = new PassengerService();
                        PassengerModel md = new PassengerModel();
                        md.UserId = user.Id;
                        md.FirstName = model.Name;
                        md.Email = model.Email;
                        md.Mobile = model.Mobile;
                        md.Password = model.Password;
                        md.Longitude = "0";
                        md.Latitude = "0";
                        md.DeviceToken = "";
                        md.DeviceType = "";
                        md.UpdateTime = DateTime.Now;
                        md.nWayPoint = 0;
                        md.nWayInfo = "";
                        md.Paypal = "";
                        md.Language = "En";
                        md.CrDate = DateTime.Now;
                        md.PhotoUrl = filename;
                        i = db.AddPassenger(md);
                        if (i == 0)
                        {
                            return View(model);
                        }
                        else
                        {
                            return RedirectToAction("Index", "Passenger", new { area = "En" });
                        }
                    }
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }