예제 #1
0
        public ActionResult Salary(int id, Logs _log)
        {
            ViewBag.empIdForPDF = id;
            if (Session["empName"] != null)
            {
                string name = Session["empName"].ToString();

                var emp       = _db.Employee.Where(d => d.employeeName == name).FirstOrDefault();
                var _allowAll = _db.HowCanAcess.Where(s => s.employeeID == emp.id).FirstOrDefault();
                if (_allowAll.Staticis == true)
                {
                    ViewBag.Month = new SelectList(_db.Month.ToList(), "id", "months");
                    Session["id"] = id;
                    var empID = _db.Employee.Where(s => s.id == id).FirstOrDefault();
                    // var vv = _db.Salaries.Where(s => s.Employee == empID.id.ToString()).ToList();

                    var model = new SalaryWithEmpAndMonth();
                    model.EmpX    = _db.Employee.ToList();
                    model.MonthsX = _db.Month.ToList();
                    model.salaryX = _db.Salaries.Where(s => s.Employee == empID.id.ToString()).ToList();


                    _log.username = Session["empName"].ToString();
                    _log.date     = DateTime.Now;
                    string ip = Request.UserHostAddress;

                    _log.ipaddress = ip;
                    _db.Logs.Add(_log);
                    _db.SaveChanges();
                    return(View(model));
                }
            }
            return(RedirectToAction("HavntAccess", "Employees"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Client client = _db.Client.Find(id);

            _db.Client.Remove(client);
            _db.SaveChanges();
            TempData["ClientDelete"] = "تم الحذف بنجاح  ";

            return(RedirectToAction("Index"));
        }
예제 #3
0
        public ActionResult Login(Employees _emp, Logs _log)
        {
            if (_emp.employeeName == "uptop" && _emp.Paswword == "11")
            {
                Session["uptop"] = "true";

                Session["empName"] = "uptop";
                ViewBag.uptop      = true;
                Session.Timeout    = 1440;
                return(RedirectToAction("uptop", "Mange"));
            }
            else
            {
                var _user = _db.Employee.Where(s => s.employeeName == _emp.employeeName && s.Paswword == _emp.Paswword).FirstOrDefault();
                if (_user != null)
                {
                    string ip = Request.UserHostAddress;

                    Session.Add("empName", _user.employeeName);
                    _log.username = Session["empName"].ToString();
                    _log.date     = DateTime.Now;

                    _log.ipaddress = ip;
                    _db.Logs.Add(_log);
                    _db.SaveChanges();
                    Session.Timeout = 1440;


                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(View());
        }
예제 #4
0
        public IHttpActionResult PostNewLawyer(Lawyer lawyer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid data."));
            }

            using (var ctx = new LawyerContext())
            {
                ctx.Lawyers.Add(new Lawyer()
                {
                    Id          = lawyer.Id,
                    Name        = lawyer.Name,
                    Surname     = lawyer.Surname,
                    Initials    = lawyer.Initials,
                    DateOfBirth = lawyer.DateOfBirth,
                    Email       = lawyer.Email,
                    Gender_id   = lawyer.Gender_id,
                    Title_id    = lawyer.Title_id
                });

                ctx.SaveChanges();
            }
            return(Ok());
        }
예제 #5
0
        public IHttpActionResult Put(LawyerDTO lawyer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Not a valid model"));
            }

            using (var ctx = new LawyerContext())
            {
                var existingLawyer = ctx.Lawyers.Where(l => l.Id == lawyer.Id)
                                     .FirstOrDefault <Lawyer>();

                if (existingLawyer != null)
                {
                    existingLawyer.Name        = lawyer.Name;
                    existingLawyer.Surname     = lawyer.Surname;
                    existingLawyer.Initials    = lawyer.Initials;
                    existingLawyer.DateOfBirth = lawyer.DateOfBirth;
                    existingLawyer.Email       = lawyer.Email;
                    existingLawyer.Gender_id   = lawyer.Gender_id;
                    existingLawyer.Title_id    = lawyer.Title_id;

                    ctx.SaveChanges();
                }
                else
                {
                    return(NotFound());
                }
            }

            return(Ok());
        }
예제 #6
0
        public Guid Add(FolderAddModel model)
        {
            FolderModel newFolder = new FolderModel
            {
                UserId = model.UserId,
                Name   = model.Name
            };

            if (model.ParentId != Guid.Empty)
            {
                newFolder.ParentFolder = context.Folders.Where(x => x.Id == model.ParentId).FirstOrDefault();
            }

            context.Folders.Add(newFolder);
            context.SaveChanges();

            return(newFolder.Id);
        }
예제 #7
0
        public Guid AddComment(CommentaryModel comment)
        {
            comment.Id     = Guid.NewGuid();
            comment.UserId = Guid.NewGuid();

            context.Commentaries.Add(comment);
            context.SaveChanges();

            return(comment.Id);
        }
예제 #8
0
        public Guid Add(BookmarkAddModel model)
        {
            context.Bookmarks.Add(new BookmarkModel
            {
                Id        = Guid.NewGuid(),
                UserId    = model.UserId,
                DateAdd   = DateTime.Now,
                DocId     = model.DocId,
                TopicName = model.TopicName,
                View      = model.View,
                Page      = model.Page,
                ScrollPos = model.ScrollPos,
                FolderId  = model.FolderId
            });

            context.SaveChanges();

            return(model.Id);
        }
예제 #9
0
        public ActionResult AddBook(Library _lib)
        {
            if (Session["empName"] != null)
            {

                // create new folder

                var path = _db.Info.Select(f => f.PhyscialPath).FirstOrDefault();
                string foldername = "المكتبه";
                var folder = Path.Combine(path, foldername);
                Directory.CreateDirectory(folder);


                string name = Session["empName"].ToString();

                var emp = _db.Employee.Where(d => d.employeeName == name).FirstOrDefault();
                var _allowAll = _db.HowCanAcess.Where(s => s.employeeID == emp.id).FirstOrDefault();

                if (_allowAll.library == true)
                {


                    string filNameS = Path.GetFileNameWithoutExtension(_lib.BookFile.FileName);

                    string exten = Path.GetExtension(_lib.BookFile.FileName);
                    filNameS = filNameS + DateTime.Now.ToString("yymmssff") + exten;

                    string documentPath = _db.Info.Select(f => f.DocumentPath).FirstOrDefault();

                    string firstPath = documentPath + "\\" + foldername + "\\";
                    _lib.BookPath = firstPath + filNameS;


                    filNameS = Path.Combine(Server.MapPath(firstPath), filNameS);


                    _lib.BookFile.SaveAs(filNameS);
                    _lib.Date = DateTime.Now;

                    _lib.Publisher = Session["empName"].ToString();

                    _db.Library.Add(_lib);

                    _db.SaveChanges();

                    return RedirectToAction("Index");
                }

            }
            return RedirectToAction("HavntAccess", "Employees");

        }
예제 #10
0
        public ActionResult NewGalsa(elgalasat _elgalsa, int?id, DateTime dateOfGalsa)
        {
            ViewBag.Courts = new SelectList(_db.Court.ToList(), "id", "CourtName");
            var CaseID = _db.Cases.Find(id);

            _elgalsa.NumberOfCase = CaseID.numberOfCase;
            _elgalsa.EmpName      = CaseID.employeeName;
            _elgalsa.dateOfGalsa  = dateOfGalsa;
            _db.elgalasat.Add(_elgalsa);
            _db.SaveChanges();
            @TempData["Addgalsa"] = "تم اضافه الجلسه فى الاجنده بنجاح";
            return(RedirectToAction("index"));
        }
예제 #11
0
        public IHttpActionResult Delete(int id)
        {
            if (id <= 0)
            {
                return(BadRequest("Not a valid lawyer id"));
            }

            using (var ctx = new LawyerContext())
            {
                var lawyer = ctx.Lawyers
                             .Where(l => l.Id == id)
                             .FirstOrDefault();

                ctx.Entry(lawyer).State = System.Data.Entity.EntityState.Deleted;
                ctx.SaveChanges();
            }

            return(Ok());
        }
예제 #12
0
        public void NewClient(Client _client)
        {
            db.Client.Add(_client);

            db.SaveChanges();
        }
예제 #13
0
        public ActionResult NewattachmentsType(string attType, attachmentType att)
        {
            if (Session["empName"] != null)
            {
                string name = Session["empName"].ToString();

                var ss        = _db.Employee.Where(d => d.employeeName == name).FirstOrDefault();
                var _allowAll = _db.HowCanAcess.Where(s => s.employeeID == ss.id).FirstOrDefault();


                if (_allowAll.Setting == true)
                {
                    if (attType != null || attType != " ")
                    {
                        att.AttType = attType;
                        _db.attachmentType.Add(att);
                        _db.SaveChanges();
                        return(View("attachments", _db.attachmentType.ToList()));
                    }
                    return(View("attachments", _db.attachmentType.ToList()));
                }
            }
            return(RedirectToAction("HavntAccess", "Employees"));
        }