Exemple #1
0
        public ActionResult Create([Bind(Include = "ChallanNo,IssueDate,LicenceNo,RCNo,totalFine,Paid")] Challan challan)
        {
            if (Request.Cookies.Get("tAdmin") != null)
            {
                string t = Request.Cookies.Get("tAdmin").Value;
                if (t == "Yes")
                {
                    if (ModelState.IsValid)
                    {
                        db.Challans.Add(challan);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }

                    return(View(challan));
                }
                else
                {
                    return(RedirectToAction("Index", "TrafficLogin"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "TrafficLogin"));
            }
        }
Exemple #2
0
        public ActionResult Create([Bind(Include = "RuleId,Rule,Fine")] RULES rULES)
        {
            if (Request.Cookies.Get("tAdmin") != null)
            {
                string t = Request.Cookies.Get("tAdmin").Value;
                if (t == "Yes")
                {
                    if (ModelState.IsValid)
                    {
                        db.RULESs.Add(rULES);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }

                    return(View(rULES));
                }
                else
                {
                    return(RedirectToAction("Index", "TrafficLogin"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "TrafficLogin"));
            }
        }
        public ActionResult Remove(int id, string number)
        {
            if (Request.Cookies.Get("uid") != null)
            {
                string temp = Request.Cookies["uemail"].Value.ToString();

                pu = db.pus.Where(p => p.UserEmail == temp).FirstOrDefault();

                if (id == 1)
                {
                    DL tdl = db.DLs.Where(p => p.LicenceNo.Equals(number)).FirstOrDefault();
                    pu.dl.Remove(tdl);
                    if (pu.dl.Count == 0)
                    {
                        pu.isDLPresent = false;
                    }
                    else
                    {
                        pu.isDLPresent = true;
                    }
                }
                else if (id == 2)
                {
                    RC trc = db.Rcs.Where(p => p.VehicleNo.Equals(number)).FirstOrDefault();
                    pu.rc.Remove(trc);
                    if (pu.rc.Count == 0)
                    {
                        pu.isRCPresent = false;
                    }
                    else
                    {
                        pu.isRCPresent = true;
                    }
                }
                else if (id == 3)
                {
                    PUC tpuc = db.PUCs.Where(p => p.PUCNo.Equals(number)).FirstOrDefault();
                    pu.puc.Remove(tpuc);
                    if (pu.puc.Count == 0)
                    {
                        pu.isPUCPresent = false;
                    }
                    else
                    {
                        pu.isPUCPresent = true;
                    }
                }
                db.SaveChanges();
                //alert "Successfully Removed Virtual Document!!"
                return(RedirectToAction("Index", "PUHome"));
            }
            else
            {
                return(RedirectToAction("Index", "PULogin"));
            }
        }
Exemple #4
0
        public ActionResult OTP(string otp)
        {
            if (Request.Cookies["rotp"].Value.ToString().Equals("signup"))
            {
                int motp = int.Parse(otp);
                int sotp = int.Parse(Session["sotp"].ToString());
                if (motp == sotp)
                {
                    PublicUser puu = new PublicUser();
                    puu.PublicUserId = "PU" + DateTime.Now.GetHashCode().ToString().Substring(5) + (db.pus.ToArray().Length + 1).ToString();
                    puu.UserName     = Request.Cookies["tname"].Value.ToString();
                    puu.UserEmail    = Request.Cookies["temail"].Value.ToString();
                    puu.Password     = Request.Cookies["tpass"].Value.ToString();
                    puu.ConfPassword = puu.Password;
                    puu.AadharNo     = Request.Cookies["aadharno"].Value;
                    db.pus.Add(puu);
                    db.SaveChanges();

                    PublicUser pu = db.pus.Where(p => p.UserEmail == puu.UserEmail).FirstOrDefault();
                    Response.Cookies.Add(new HttpCookie("uemail", pu.UserEmail));
                    Response.Cookies.Add(new HttpCookie("uname", pu.UserName));
                    Response.Cookies.Add(new HttpCookie("uid", pu.PublicUserId.ToString()));

                    Response.Cookies["rotp"].Expires   = DateTime.Now.AddDays(-1);
                    Response.Cookies["tname"].Expires  = DateTime.Now.AddDays(-1);
                    Response.Cookies["temail"].Expires = DateTime.Now.AddDays(-1);
                    Response.Cookies["tpass"].Expires  = DateTime.Now.AddDays(-1);
                    return(RedirectToAction("Index", "PUHome"));
                }
                else
                {
                    ViewBag.msg = "Unmatched OTP!!!";
                    return(View());
                }
            }
            else if (Request.Cookies["rotp"].Value.ToString().Equals("forgot"))
            {
                int motp = int.Parse(otp);
                int sotp = int.Parse(Session["sotp"].ToString());
                if (motp == sotp)
                {
                    Response.Cookies.Add(new HttpCookie("sotp", "success"));
                    return(RedirectToAction("changepass", "PULogin"));
                }
                else
                {
                    ViewBag.msg = "Unmatched OTP!!!";
                    return(View());
                }
            }
            else
            {
                return(RedirectToAction("forgot", "PULogin"));
            }
        }
Exemple #5
0
        public ActionResult challanDL(string dl_no, string IssueDate, string[] Rules, string paid)
        {
            if (Request.Cookies.Get("tpid") != null)
            {
                Challan chln = new Challan();
                chln.IssueDate = DateTime.Parse(IssueDate);
                int sum = 0;
                int ct  = 1;
                foreach (string item in Rules)
                {
                    int i = int.Parse(item);
                    if (ct == 1)
                    {
                        ICollection <RULES> rl = db.RULESs.Where(m => m.RuleId == i).ToList();
                        chln.rules = rl;
                        sum       += (rl.First().Fine);
                    }
                    else
                    {
                        RULES rl = db.RULESs.Where(m => m.RuleId == i).First();
                        chln.rules.Add(rl);
                        sum += (rl.Fine);
                    }



                    ct++;
                }
                chln.totalFine = sum;



                if (paid == "true")
                {
                    chln.Paid = true;
                }
                else
                {
                    chln.Paid = false;
                }
                if (ModelState.IsValid)
                {
                }
                chln.LicenceNo = dl_no;
                chln.ChallanNo = "CH" + DateTime.Now.GetHashCode().ToString().Substring(6) + "DL" + DateTime.Now.GetHashCode().ToString().Substring(6);
                db.Challans.Add(chln);
                db.SaveChanges();
                return(RedirectToAction("Home", "TPHome"));
            }
            else
            {
                return(RedirectToAction("Index", "TPLogin"));
            }
        }
        public ActionResult Create([Bind(Include = "PublicUserId,UserName,UserEmail,Password,ConfPassword,AadharNo")] PublicUser publicUser)
        {
            if (ModelState.IsValid)
            {
                publicUser.isDLPresent  = false;
                publicUser.isPUCPresent = false;
                publicUser.isRCPresent  = false;
                db.pus.Add(publicUser);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(publicUser));
        }
Exemple #7
0
        public ActionResult Create([Bind(Include = "IssueDate,CO,HC")] PUC pUC, string VehNo)
        {
            if (Request.Cookies.Get("tAdmin") != null)
            {
                string t = Request.Cookies.Get("tAdmin").Value;
                if (t == "Yes")
                {
                    if (ModelState.IsValid)
                    {
                        Random r   = new Random();
                        RC     trc = db.Rcs.Where(m => m.VehicleNo.Equals(VehNo)).FirstOrDefault();
                        var    ti  = trc.puc;
                        if (ti != null)
                        {
                            string tpucid = ti.PUCNo;
                            PUC    p      = db.PUCs.Find(tpucid);
                            db.PUCs.Remove(p);
                        }

                        pUC.rc         = db.Rcs.Where(m => m.VehicleNo.Equals(VehNo)).ToList();
                        pUC.ExpiryDate = pUC.IssueDate.AddYears(1);
                        pUC.PUCNo      = "PUC" + DateTime.Now.GetHashCode().ToString() + VehNo.Substring(4) + r.Next(10000).ToString("D4");
                        db.PUCs.Add(pUC);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }

                    ViewBag.VehNo = new SelectList(db.Rcs, "VehicleNo", "VehicleNo");

                    return(View(pUC));
                }
                else
                {
                    return(RedirectToAction("Index", "TrafficLogin"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "TrafficLogin"));
            }
        }
        public ActionResult Create([Bind(Include = "OwnerName,RegDate,Vehicletype,RTO,OwnerAddress,AadharNo")] RC rC)
        {
            if (Request.Cookies.Get("tAdmin") != null)
            {
                string t = Request.Cookies.Get("tAdmin").Value;
                if (t == "Yes")
                {
                    if (ModelState.IsValid)
                    {
                        Random r = new Random();
                        System.Text.StringBuilder b = new System.Text.StringBuilder();
                        char ch;
                        ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * r.NextDouble() + 65)));
                        b.Append(ch);
                        ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * r.NextDouble() + 65)));
                        b.Append(ch);
                        rC.VehicleNo          = rC.RTO.Substring(0, 4) + b.ToString().ToUpper() + r.Next(10000).ToString("D4");
                        rC.OwnerName          = rC.OwnerName.ToUpper();
                        rC.OwnerAddress       = rC.OwnerAddress.ToUpper();
                        rC.ExpiryDate         = rC.RegDate.AddYears(10);
                        rC.RTO                = "RTO," + rC.RTO.Substring(4).ToUpper();
                        rC.VehicleDescription = rC.Vehicletype.Substring(6).ToUpper();
                        rC.Vehicletype        = rC.Vehicletype.Substring(0, 6).Trim().ToUpper();
                        rC.ChasisNo           = r.Next(10000000).ToString("D4");
                        rC.EngineNo           = r.Next(10000000).ToString("D4");

                        db.Rcs.Add(rC);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }

                    List <SelectListItem> RTOLIST = new List <SelectListItem>();
                    RTOLIST.Add(new SelectListItem {
                        Text = "Surat", Value = "GJ05Surat"
                    });
                    RTOLIST.Add(new SelectListItem {
                        Text = "Ahmedabad", Value = "GJ01Ahmedabad"
                    });
                    RTOLIST.Add(new SelectListItem {
                        Text = "Vadodra", Value = "GJ06Vadodra"
                    });
                    RTOLIST.Add(new SelectListItem {
                        Text = "Amravati", Value = "MH02Amravati"
                    });
                    RTOLIST.Add(new SelectListItem {
                        Text = "Panvel", Value = "MH21Panvel"
                    });
                    RTOLIST.Add(new SelectListItem {
                        Text = "Borivali", Value = "MH22Borivali"
                    });
                    RTOLIST.Add(new SelectListItem {
                        Text = "Udaipur", Value = "RJ01Udaipur"
                    });
                    RTOLIST.Add(new SelectListItem {
                        Text = "Bikaner", Value = "RJ07Bikaner"
                    });
                    RTOLIST.Add(new SelectListItem {
                        Text = "Kota", Value = "RJ20Kota"
                    });

                    List <SelectListItem> VehTypeList = new List <SelectListItem>();
                    VehTypeList.Add(new SelectListItem {
                        Text = "MC50CC", Value = "MC50CCMotorcycles with an engine capacity of 50 cc or less"
                    });
                    VehTypeList.Add(new SelectListItem {
                        Text = "MCWOG", Value = "MCWOG Motorcycles with any engine capacity, but without gears, including mopeds and scooters"
                    });
                    VehTypeList.Add(new SelectListItem {
                        Text = "LMV-NT", Value = "LMV-NTLight motor vehicles that are used for non-transport purposes "
                    });
                    VehTypeList.Add(new SelectListItem {
                        Text = "MCWG", Value = "MCWG  Motorcycles with gear"
                    });

                    ViewBag.VehTypeList = VehTypeList;
                    ViewBag.RTOList     = RTOLIST;
                    ViewBag.VehicleNo   = new SelectList(db.Challans, "ChallanNo", "ChallanNo", rC.VehicleNo);
                    ViewBag.VehicleNo   = new SelectList(db.PUCs, "PUCNo", "PUCNo", rC.VehicleNo);
                    return(View(rC));
                }
                else
                {
                    return(RedirectToAction("Index", "TrafficLogin"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "TrafficLogin"));
            }
        }
        public ActionResult Create([Bind(Include = "OwnerName,IssueDate,OwnerAddress,DOB,RTO,Vehicletype,AadharNo")] DL dL, HttpPostedFileBase profilepic)
        {
            if (Request.Cookies.Get("tAdmin") != null)
            {
                string t = Request.Cookies.Get("tAdmin").Value;
                if (t == "Yes")
                {
                    if (ModelState.IsValid)
                    {
                        if (profilepic != null)
                        {
                            if (profilepic.ContentType == "image/jpg" || profilepic.ContentType == "image/jpeg" || profilepic.ContentType == "image/png")
                            {
                                string ext = System.IO.Path.GetExtension(profilepic.FileName);
                                int    num = db.DLs.ToArray().Length + 1;
                                dL.LicenceNo = dL.RTO.Substring(0, 4) + " " + dL.IssueDate.Year + "00" + num;
                                profilepic.SaveAs(Server.MapPath("/") + "/Content/DrivingLicence/" + dL.LicenceNo + ext);
                                dL.profilepic = dL.LicenceNo + ext;
                            }
                            else
                            {
                                TempData["ErrorMsg"] = "image must be in formate of jpg/png/jpeg only";
                                return(RedirectToAction("Create"));
                            }
                        }

                        dL.OwnerName          = dL.OwnerName.ToUpper();
                        dL.ExpiryDate         = dL.IssueDate.AddYears(10);
                        dL.VehicleDescription = dL.Vehicletype.Substring(6).ToUpper();
                        dL.Vehicletype        = dL.Vehicletype.Substring(0, 6).Trim().ToUpper();
                        dL.RTO          = "RTO," + dL.RTO.Substring(4).ToUpper();
                        dL.OwnerAddress = dL.OwnerAddress.ToUpper();


                        db.DLs.Add(dL);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        List <SelectListItem> RTOLIST = new List <SelectListItem>();
                        RTOLIST.Add(new SelectListItem {
                            Text = "Surat", Value = "GJ05Surat"
                        });
                        RTOLIST.Add(new SelectListItem {
                            Text = "Ahmedabad", Value = "GJ01Ahmedabad"
                        });
                        RTOLIST.Add(new SelectListItem {
                            Text = "Vadodra", Value = "GJ06Vadodra"
                        });
                        RTOLIST.Add(new SelectListItem {
                            Text = "Amravati", Value = "MH02Amravati"
                        });
                        RTOLIST.Add(new SelectListItem {
                            Text = "Panvel", Value = "MH21Panvel"
                        });
                        RTOLIST.Add(new SelectListItem {
                            Text = "Borivali", Value = "MH22Borivali"
                        });
                        RTOLIST.Add(new SelectListItem {
                            Text = "Udaipur", Value = "RJ01Udaipur"
                        });
                        RTOLIST.Add(new SelectListItem {
                            Text = "Bikaner", Value = "RJ07Bikaner"
                        });
                        RTOLIST.Add(new SelectListItem {
                            Text = "Kota", Value = "RJ20Kota"
                        });

                        List <SelectListItem> VehTypeList = new List <SelectListItem>();
                        VehTypeList.Add(new SelectListItem {
                            Text = "MC50CC", Value = "MC50CCMotorcycles with an engine capacity of 50 cc or less"
                        });
                        VehTypeList.Add(new SelectListItem {
                            Text = "MCWOG", Value = "MCWOG Motorcycles with any engine capacity, but without gears, including mopeds and scooters"
                        });
                        VehTypeList.Add(new SelectListItem {
                            Text = "LMV-NT", Value = "LMV-NTLight motor vehicles that are used for non-transport purposes "
                        });
                        VehTypeList.Add(new SelectListItem {
                            Text = "MCWG", Value = "MCWG  Motorcycles with gear"
                        });

                        ViewBag.VehTypeList = VehTypeList;
                        ViewBag.RTOList     = RTOLIST;
                        return(View(dL));
                    }
                }
                else
                {
                    return(RedirectToAction("Index", "TrafficLogin"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "TrafficLogin"));
            }
        }