Exemplo n.º 1
0
        /* public ActionResult Lwr_Details()
         * {
         *   if (Check_Session())
         *   {
         *       var case_exmple = new PagedData<case_exmpl>();
         *
         *
         *       int id = Convert.ToInt32(Session["Userid"]);
         *       lawyer lawyer = db.lawyers.Find(id);
         *       var lawyer_id = lawyer.lwr_id;
         *       case_exmpl cx = new case_exmpl();
         *       var related_lawyer = db.lawyers.Where(m => m.lwr_id.Equals(id)).ToList();
         *       var rlt_lwr = related_lawyer.OrderByDescending(m => m.case_exmpl.OrderBy(n => n.Date_time));
         *       case_exmple.NumberOfPages = Convert.ToInt32(Math.Ceiling((double)db.case_exmpl.Count() / PageSize));
         *       case_exmple.CurrentPage = 1;
         *      case_exmple.Data= rlt_lwr.OrderByDescending(v => v.DOB).Take(PageSize);
         *       return View();
         *
         *   }
         *   return RedirectToAction("SignIn", "user");
         * }*/

        public lawyer getLoginLawyer()
        {
            int    id     = Convert.ToInt32(Session["UserId"]);
            lawyer lawyer = db.lawyers.Find(id);

            return(lawyer);
        }
Exemplo n.º 2
0
        public ActionResult addnewrecord(FormCollection form1)
        {
            int    id    = Convert.ToInt32(Session["userid"]);
            lawyer lawyr = db.lawyers.Find(id);

            if (lawyr != null)
            {
                string     cat_name    = form1["crime"].ToString();
                string     summary     = form1["summary"];
                string     discription = form1["addDescription"].ToString();
                case_exmpl case_record = new case_exmpl();
                var        v           = db.law_catagry.Where(m => m.catgry_name.Equals(cat_name)).First();
                case_record.lwr_id      = lawyr.lwr_id;
                case_record.Cat_name    = v.catgry_name;
                case_record.Summary     = summary;
                case_record.cat_id      = v.Law_cat_id;
                case_record.discription = discription;
                case_record.Date_time   = DateTime.Now;
                db.case_exmpl.Add(case_record);
                db.SaveChanges();
                ViewBag.message = "Successfully Added....!! ";
                ViewBag.lawyer  = getLoginLawyer();
            }
            return(View());
        }
Exemplo n.º 3
0
        public ActionResult Save_profile(lawyer lr)
        {
            int    id    = Convert.ToInt32(Session["userid"]);
            lawyer lawyr = db.lawyers.Find(id);

            if (lawyr != null)
            {
                lawyr.Address         = lr.Address;
                lawyr.First_Name      = lr.First_Name;
                lawyr.court_Level     = lr.court_Level;
                lawyr.Experience      = lr.Experience;
                lawyr.Second_Name     = lr.Second_Name;
                lawyr.DOB             = lr.DOB;
                lawyr.Area            = lr.Area;
                lawyr.Vision          = lr.Vision;
                lawyr.Objective       = lr.Objective;
                db.Entry(lawyr).State = EntityState.Modified;
                db.SaveChanges();
                ViewBag.lawyer = getLoginLawyer();
                return(RedirectToAction("Lwr_Details", "Lawyer", new { id = lawyr.lwr_id }));
            }
            else
            {
                return(RedirectToAction("Edit_Profile", "Lawyer"));
            }
        }
Exemplo n.º 4
0
        public ActionResult AddNewRecord()
        {
            int id = 0;

            id = Convert.ToInt32(Session["userid"]);
            lawyer lawyer = db.lawyers.Find(id);

            if (lawyer == null)
            {
                return(RedirectToAction("SignIn", "user"));
            }
            var crime_list = db.law_catagry.ToList().OrderBy(m => m.catgry_name);
            List <SelectListItem> crime_listItem = new List <SelectListItem>();

            foreach (var crime in crime_list)
            {
                crime_listItem.Add(new SelectListItem()
                {
                    Value = crime.catgry_name, Text = crime.catgry_name
                });
            }
            ViewBag.lawyer       = getLoginLawyer();
            ViewBag.crim_list_dp = new SelectList(crime_listItem, "Text", "Value");
            return(View());
        }
Exemplo n.º 5
0
        public ActionResult Edit_Profile(HttpPostedFileBase file)
        {
            try
            {
                int id = Convert.ToInt32(Session["userid"]);

                /*Geting the file name*/
                string filename = System.IO.Path.GetFileName(file.FileName);
                /*Saving the file in server folder*/
                file.SaveAs(Server.MapPath("~/images/" + filename));
                string filepathtosave = "~/images/" + filename;
                /*Storing image path to show preview*/
                ViewBag.ImageURL = filepathtosave;

                /*
                 * HERE WILL BE YOUR CODE TO SAVE THE FILE DETAIL IN DATA BASE
                 *
                 */
                lawyer lawyr = db.lawyers.Find(id);
                if (lawyr != null)
                {
                    lawyr.photo           = filepathtosave;
                    db.Entry(lawyr).State = EntityState.Modified;
                    db.SaveChanges();
                    ViewBag.Message = "File Uploaded successfully.";
                    ViewBag.lawyer  = getLoginLawyer();
                    return(RedirectToAction("Edit_Profile", "lawyer", new { id = lawyr.lwr_id }));
                }
            }
            catch
            {
                ViewBag.Message = "Error while uploading the files.";
            }
            return(View());
        }
Exemplo n.º 6
0
        public ActionResult Account_setting(FormCollection set)
        {
            int    id = Convert.ToInt32(Session["userid"]);
            lawyer lr = db.lawyers.Find(id);

            if (lr != null)
            {
                string oldpswd = set["oldpassword"].ToString();
                string newpswd = set["newpassword"].ToString();
                if (oldpswd == lr.PASSWORD)
                {
                    lr.PASSWORD        = newpswd;
                    db.Entry(lr).State = EntityState.Modified;
                    db.SaveChanges();
                    ViewBag.message = "Password Successfully changed..!";
                    ViewBag.lawyer  = lr;
                    return(View());
                }
                else
                {
                    ViewBag.message = "Enter correct Old password..!";
                    return(View());
                }
            }

            RedirectToAction("SignIn", "user");
            return(View());
        }
Exemplo n.º 7
0
        public ActionResult LawyerProfile(int id)
        {
            lawyer lawyer = db.lawyers.Find(id);

            ViewBag.adminlogin = Check_Session();

            return(View(lawyer));
        }
Exemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            lawyer lawyer = db.lawyers.Find(id);

            db.lawyers.Remove(lawyer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 9
0
        public ActionResult confirmLawyer(string Verfy_code)
        {
            lawyer lwr = db.lawyers.Where(lr => lr.VERIFY_CODE == Verfy_code).FirstOrDefault();

            lwr.IS_ACTIVE       = true;
            db.Entry(lwr).State = EntityState.Modified;
            db.SaveChanges();
            return(View(lwr));
        }
Exemplo n.º 10
0
 public ActionResult Edit(lawyer lwr)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lwr).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(lwr));
 }
Exemplo n.º 11
0
        //
        // GET: /Lawyer/Delete/5

        public ActionResult Delete(int id = 0)
        {
            lawyer lawyer = db.lawyers.Find(id);

            if (lawyer == null)
            {
                return(HttpNotFound());
            }
            return(View(lawyer));
        }
Exemplo n.º 12
0
        public Boolean Check_Session()
        {
            int    id  = Convert.ToInt32(Session["UserId"]);
            lawyer lwr = db.lawyers.Find(id);

            if (Session["UserEmail"] != null && Session["UserPassword"] != null && Session["UserId"].Equals(lwr.lwr_id.ToString()))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 13
0
        public ActionResult delete_lawyer(int id)
        {
            if (!Check_Session())
            {
                return(RedirectToAction("SignIn", "user"));
            }
            lawyer lwr = db.lawyers.Find(id);

            if (lwr == null)
            {
                return(HttpNotFound());
            }
            db.lawyers.Remove(lwr);
            db.SaveChanges();
            return(RedirectToAction("lawyer_list"));
        }
Exemplo n.º 14
0
        public ActionResult SignUp(SignUp su)
        {
            SignUpUser spu = new SignUpUser();

            if (spu.SignUpBO(su))
            {
                pladbEntities    pladb = new pladbEntities();
                lawyer           lwr   = pladb.lawyers.Where(lr => lr.EMAIL == su.Email).FirstOrDefault();
                LawyerController lrc   = new LawyerController();
                lrc.SendMail(lwr);
                pladb.Dispose();
                return(RedirectToAction("ConfirmationMessage", "lawyer"));
            }

            return(View(su));
        }
Exemplo n.º 15
0
        public ActionResult block_lawyer(int id)
        {
            if (!Check_Session())
            {
                return(RedirectToAction("SignIn", "user"));
            }
            lawyer usr = db.lawyers.Find(id);

            if (usr == null)
            {
                return(HttpNotFound());
            }
            usr.IS_ACTIVE       = false;
            db.Entry(usr).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("User_List"));
        }
Exemplo n.º 16
0
        public ActionResult Lwr_Details()
        {
            if (Check_Session())
            {
                int    id        = Convert.ToInt32(Session["Userid"]);
                lawyer lawyer    = db.lawyers.Find(id);
                var    lawyer_id = lawyer.lwr_id;
                ViewData["User"] = lawyer.First_Name;
                ViewBag.lawyer   = getLoginLawyer();
                //case_exmpl cx = new case_exmpl();
                //var related_lawyer = db.lawyers.Where(m=> m.lwr_id.Equals(id)).ToList();
                //var rlt_lwr=related_lawyer.OrderByDescending(m=>m.case_exmpl.OrderBy(n=>n.Date_time));
                //return View(rlt_lwr.OrderByDescending(v => v.DOB).ToPagedList(page, 3));

                return(View(lawyer));
            }
            return(RedirectToAction("SignIn", "user"));
        }
Exemplo n.º 17
0
        public ActionResult Case_list(int page = 1)
        {
            if (Check_Session())
            {
                var case_exmple = new PagedData();


                int    id        = Convert.ToInt32(Session["Userid"]);
                lawyer lawyer    = db.lawyers.Find(id);
                var    lawyer_id = lawyer.lwr_id;
                //case_exmpl cx = new case_exmpl();
                var related_cases = db.case_exmpl.Where(m => m.lwr_id.Equals(id)).ToList();
                case_exmple.NumberOfPages = Convert.ToInt32(Math.Ceiling((double)db.case_exmpl.Count() / PageSize));
                case_exmple.CurrentPage   = 1;
                return(PartialView(related_cases.OrderBy(v => v.Date_time).Take(PageSize)));
            }
            return(RedirectToAction("SignIn", "user"));
        }
Exemplo n.º 18
0
        //public ActionResult Create(lawyer user)
        //{


        //        Session["userid"] = lwr.lwr_id;
        //        Session["UserEmail"]=lwr.EMAIL;
        //        Session["UserPassword"] =lwr.PASSWORD;


        //        return RedirectToAction("edit_profile", "Lawyer");


        //    return View(user);
        //}



        //
        // GET: /Lawyer/Edit/5

        public ActionResult Edit_Profile()
        {
            ViewBag.lawyer = getLoginLawyer();
            int    id     = Convert.ToInt32(Session["userid"]);
            lawyer lawyer = db.lawyers.Find(id);

            if (lawyer == null)
            {
                return(RedirectToAction("SignIn", "user"));
            }
            law_catagry law_ct = new law_catagry();

            ViewBag.categories  = db.law_catagry.ToList();
            ViewBag.statevalues = new SelectList(gn.Get_City_list(), "Text", "Value");


            return(View(lawyer));
        }
Exemplo n.º 19
0
        public bool SendMail(lawyer lwr)
        {
            string from = "*****@*****.**";

            using (MailMessage mail = new MailMessage(from, lwr.EMAIL))
            {
                mail.Subject = "Verification Mail";

                mail.Body       = "Hi Dear " + lwr.First_Name + "! <html><body><a href='http://localhost:22118/Lawyer/confirmLawyer/?Verfy_code=" + lwr.VERIFY_CODE + "'>Click Here</a></body></html>";
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host      = "smtp.gmail.com";
                smtp.EnableSsl = true;
                NetworkCredential networkCredential = new NetworkCredential(from, "pyxel757673");
                smtp.UseDefaultCredentials = true;
                smtp.Credentials           = networkCredential;
                smtp.Port = 587;
                smtp.Send(mail);
            }
            return(true);
        }
Exemplo n.º 20
0
        public ActionResult account_deactive(FormCollection fc)
        {
            int    id = Convert.ToInt32(Session["userid"]);
            lawyer u  = db.lawyers.Find(id);

            if (u != null)
            {
                string pswd = fc["password"].ToString();
                if (pswd == u.PASSWORD)
                {
                    u.IS_ACTIVE       = false;
                    db.Entry(u).State = EntityState.Modified;
                    db.SaveChanges();
                    ViewBag.message = "Account Deactivate Successfully..!";
                    return(RedirectToAction("index", "home"));
                }
                else
                {
                    ViewBag.message = "Sorry your account is not deactivated..";
                    return(RedirectToAction("user", "Account_setting"));
                }
            }
            return(RedirectToAction("user", "Account_setting"));
        }
Exemplo n.º 21
0
        public ActionResult LawyerProfile(int id)
        {
            lawyer lwr = db.lawyers.Find(id);

            return(View(lwr));
        }