예제 #1
0
        public JsonResult Submit(FormCollection form)
        {
            ServiceToClient someServiceToClient = db.ServiceToClients.Find(Convert.ToInt32(form["ServiceToClientId"]));

            if (someServiceToClient != null)
            {
                someServiceToClient.Value          = Convert.ToInt16(form["ClientValue"]);
                someServiceToClient.ValueSet       = DateTime.Now;
                someServiceToClient.ClientFeedback = form["CommentForViolation"];

                for (int i = 0; i < form.AllKeys.Count(); i++)
                {
                    if (form.AllKeys[i].IndexOf("violationType_") < 0)
                    {
                        continue;
                    }

                    int violationType = Convert.ToInt32(form.AllKeys[i].ToString().Replace("violationType_", ""));
                    if (db.FoundViolations.Where(m => m.ServiceToClientId == someServiceToClient.Id).Where(m => m.ViolationTypeId == violationType).Any() == false)
                    {
                        FoundViolation someFoundViolation = new FoundViolation {
                            ServiceToClientId = someServiceToClient.Id, ViolationTypeId = violationType
                        };
                        db.FoundViolations.Add(someFoundViolation);
                        db.SaveChanges();
                    }
                }

                db.SaveChanges();
                return(Json("1", JsonRequestBehavior.DenyGet));
            }

            return(Json("0", JsonRequestBehavior.DenyGet));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "Id,Name")] City city)
        {
            if (ModelState.IsValid)
            {
                db.Cities.Add(city);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(city));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "Id,Name,Description,CityId")] Organization organization)
        {
            if (ModelState.IsValid)
            {
                db.Organizations.Add(organization);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CityId = new SelectList(db.Cities, "Id", "Name", organization.CityId);
            return(View(organization));
        }
예제 #4
0
        public ActionResult Create([Bind(Include = "Id,UserName,PasswordHash,SecurityStamp,Name,PhotoId,PhoneNumber,Skype,Viber,Website,About,FacebookProfile,VkontakteProfile,RequiresModeration,Email,EmailConfirmed,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,IsDeleted,UserId,TaxNumber,Index,Photo,Discriminator")] AspNetUser aspnetuser)
        {
            if (ModelState.IsValid)
            {
                db.AspNetUsers.Add(aspnetuser);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PhotoId = new SelectList(db.PublicImages, "Id", "FileName", aspnetuser.PhotoId);
            return(View(aspnetuser));
        }
        public ActionResult Create([Bind(Include = "Id,DivisionId,Name,Description")] WorkPlace workplace)
        {
            if (ModelState.IsValid)
            {
                db.WorkPlaces.Add(workplace);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DivisionId = new SelectList(db.Divisions, "Id", "Name", workplace.DivisionId);
            return(View(workplace));
        }
예제 #6
0
        public ActionResult Create([Bind(Include = "Id,Name,Description,OrganizationId")] ViolationType violationtype)
        {
            if (ModelState.IsValid)
            {
                db.ViolationTypes.Add(violationtype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Name", violationtype.OrganizationId);
            return(View(violationtype));
        }
        public ActionResult Create([Bind(Include = "Id,Name,ParentDivisionId,OrganizationId")] Division division)
        {
            if (ModelState.IsValid)
            {
                db.Divisions.Add(division);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ParentDivisionId = new SelectList(db.Divisions, "Id", "Name", division.ParentDivisionId);
            ViewBag.OrganizationId   = new SelectList(db.Organizations, "Id", "Name", division.OrganizationId);
            return(View(division));
        }
예제 #8
0
        public ActionResult Create([Bind(Include = "Id,WorkPlaceId,IsFormer,StartDate,EndDate,AspNetUserId")] Worker worker)
        {
            if (ModelState.IsValid)
            {
                db.Workers.Add(worker);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.WorkPlaceId  = new SelectList(db.WorkPlaces, "Id", "Name", worker.WorkPlaceId);
            ViewBag.AspNetUserId = new SelectList(db.AspNetUsers, "Id", "UserName", worker.AspNetUserId);
            return(View(worker));
        }
예제 #9
0
        public ActionResult Create([Bind(Include = "Id,ServiceTypeId,ViolationTypeId")] AllowedViolation allowedviolation)
        {
            if (ModelState.IsValid)
            {
                db.AllowedViolations.Add(allowedviolation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ServiceTypeId   = new SelectList(db.ServiceTypes, "Id", "Name", allowedviolation.ServiceTypeId);
            ViewBag.ViolationTypeId = new SelectList(db.ViolationTypes, "Id", "Name", allowedviolation.ViolationTypeId);
            return(View(allowedviolation));
        }
예제 #10
0
        public ActionResult Create([Bind(Include = "Id,ServiceToClientId,ViolationTypeId")] FoundViolation foundviolation)
        {
            if (ModelState.IsValid)
            {
                db.FoundViolations.Add(foundviolation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ServiceToClientId = new SelectList(db.ServiceToClients, "Id", "UniqueKey", foundviolation.ServiceToClientId);
            ViewBag.ViolationTypeId   = new SelectList(db.ViolationTypes, "Id", "Name", foundviolation.ViolationTypeId);
            return(View(foundviolation));
        }
        public ActionResult Create([Bind(Include = "Id,WorkerId,ServiceTypeId,Value,UniqueKey,ValueSet,IsCallbackAllowed,ClientFeedback,Assigned,Started,Finished,ClientId")] ServiceToClient servicetoclient)
        {
            if (ModelState.IsValid)
            {
                db.ServiceToClients.Add(servicetoclient);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.WorkerId      = new SelectList(db.Workers, "Id", "AspNetUser.UserName", servicetoclient.WorkerId);
            ViewBag.ServiceTypeId = new SelectList(db.ServiceTypes, "Id", "Name", servicetoclient.ServiceTypeId);
            ViewBag.ClientId      = new SelectList(db.AspNetUsers, "Id", "UserName", servicetoclient.ClientId);
            return(View(servicetoclient));
        }
예제 #12
0
        public ActionResult Create([Bind(Include = "Id,Name,Description,TimeLimit,UseTimeLimit,WorkPlaceId")] ServiceType servicetype, FormCollection form)
        {
            if (servicetype.UseTimeLimit.HasValue && servicetype.UseTimeLimit.Value == true)
            {
                servicetype.TimeLimit = new TimeSpan(0, Convert.ToInt32(form["TimeLimit"]), 0);
            }
            else
            {
                servicetype.TimeLimit = new TimeSpan(0, 0, 0);
            }

            if (ModelState.IsValid)
            {
                db.ServiceTypes.Add(servicetype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.WorkPlaceId = new SelectList(db.WorkPlaces, "Id", "Name", servicetype.WorkPlaceId);
            return(View(servicetype));
        }