Exemplo n.º 1
0
 public int AddPassenger(PassengerModel model)
 {
     Hashtable HT = new Hashtable();
     HT.Add("PassengerID", 0);
     HT.Add("UserId", model.UserId);
     HT.Add("FirstName", model.FirstName);
     HT.Add("Email", model.Email);
     HT.Add("Mobile", model.Mobile);
     HT.Add("Password", model.Password);
     HT.Add("Language", model.Language);
     HT.Add("CrDate", model.CrDate);
     HT.Add("nWayPoint", model.nWayPoint);
     HT.Add("nWayInfo", model.nWayInfo);
     HT.Add("Paypal", model.Paypal);
     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("PhotoUrl", model.PhotoUrl);
     HT.Add("CreateTimeM", model.CreateTimeM);
     HT.Add("UpdateTimeM", model.UpdateTimeM);
     HT.Add("VarifyTime", model.VarifyTime);
     HT.Add("PhoneVerified", model.PhoneVerified);
     HT.Add("PhoneCode", model.PhoneCode);
     int i = dbContext.ExecuteSP("udp_Passenger_ups", HT);
     return i;
 }
Exemplo n.º 2
0
 //update customer
 public HttpResponseMessage Put(int id, PassengerModel Passenger)
 {
     if (!ModelState.IsValid)
     {
         return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
     }
     if (id != Passenger.PassengerID)
     {
         return Request.CreateResponse(HttpStatusCode.BadRequest);
     }
     try
     {
         db.EditPassenger(Passenger);
     }
     catch (DbUpdateConcurrencyException ex)
     {
         return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
     }
     return Request.CreateResponse(HttpStatusCode.OK);
 }
Exemplo n.º 3
0
 //insert customer
 public HttpResponseMessage Post(PassengerModel Passenger)
 {
     if (ModelState.IsValid)
     {
         db.AddPassenger(Passenger);
         HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, Passenger);
         response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = Passenger.PassengerID }));
         return response;
     }
     else
     {
         return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
     }
 }
Exemplo n.º 4
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);
        }