Beispiel #1
0
        public ActionResult New(ClientAccess model)
        {
            if (!CurUser.HasAccess(AdGroup.ServiceClaimClientAccess))
            {
                RedirectToAction("AccessDenied", "Error");
            }
            try
            {
                ResponseMessage responseMessage;
                //dep.Creator = new Employee(){AdSid = GetCurUser().Sid};
                string ctrIdStr = Request.Form["ctrList"];
                int    idClientEtalon;
                int.TryParse(ctrIdStr, out idClientEtalon);
                model.IdClientEtalon = idClientEtalon;
                bool complete = model.SaveNew(out responseMessage);
                if (!complete)
                {
                    throw new Exception(responseMessage.ErrorMessage);
                }

                return(RedirectToAction("List"));
            }
            catch (Exception ex)
            {
                TempData["error"] = ex.Message;
                return(View("New", model));
            }
        }
Beispiel #2
0
        public ActionResult Edit(int id)
        {
            if (!CurUser.HasAccess(AdGroup.ServiceClaimClientAccess, AdGroup.ServiceControler))
            {
                RedirectToAction("AccessDenied", "Error");
            }
            var model = new ClientAccess(id);

            return(View(model));
        }
Beispiel #3
0
        public ActionResult List()
        {
            if (!CurUser.HasAccess(AdGroup.ServiceClaimClientAccess, AdGroup.ServiceControler))
            {
                RedirectToAction("AccessDenied", "Error");
            }
            //var list = UserList.GetUserSelectionList(AdGroup.ZipClaimClient);
            var list = ClientAccess.GetList().OrderBy(x => x.Name);

            return(View(list));
        }
        public async Task <IActionResult> PostData([FromBody] RecordData data)
        {
            var div = _device.AsQueryable().Where(x => x.mac == data.mac).FirstOrDefault();

            ClientAccess access = new ClientAccess();
            var          res    = access.postMedicalRecord(div.userId, "set", Convert.ToBase64String(Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(data))));

            if (res != null)
            {
                var r = await _clientKey.SwatoothKeyStore(res.encoderSettings, res.obj);

                return(Ok("Success"));
            }

            return(BadRequest("Invalid Request"));
        }
Beispiel #5
0
        public async Task <IActionResult> Records(RecordSearch record)
        {
            ViewBag.user = HttpContext.User.IsInRole("Admin") ? "" : _user.Users.Where(x => x.Id == ObjectId.Parse(HttpContext.User.Identity.Name)).FirstOrDefault().UserName;

            var dlist = new List <MRecord>();

            if (!ModelState.IsValid)
            {
                ViewBag.mRecord = dlist;
            }
            else
            {
                ClientAccess client = new ClientAccess();
                var          res    = client.GetMedicalRecord(record.data);
                ViewBag.mRecord = await _clientKey.SwatoothRetriveData(res, record.data);
            }
            return(View());
        }
Beispiel #6
0
 public void Delete(int id)
 {
     if (!CurUser.HasAccess(AdGroup.ServiceClaimClientAccess))
     {
         RedirectToAction("AccessDenied", "Error");
     }
     try
     {
         ResponseMessage responseMessage;
         bool            complete = ClientAccess.Delete(id, out responseMessage);
         if (!complete)
         {
             throw new Exception(responseMessage.ErrorMessage);
         }
     }
     catch (Exception ex)
     {
         TempData["error"] = ex.Message;
     }
 }
Beispiel #7
0
        public ActionResult Edit(ClientAccess model)
        {
            if (!CurUser.HasAccess(AdGroup.ServiceClaimClientAccess))
            {
                RedirectToAction("AccessDenied", "Error");
            }
            try
            {
                ResponseMessage responseMessage;
                bool            complete = model.Update(out responseMessage);
                if (!complete)
                {
                    throw new Exception(responseMessage.ErrorMessage);
                }

                return(RedirectToAction("List"));
            }
            catch (Exception ex)
            {
                TempData["error"] = ex.Message;
                return(View("Edit", model));
            }
        }
Beispiel #8
0
        public ActionResult ClientSheet(int id)
        {
            var model = new ClientAccess(id);

            return(View(model));
        }
        public void AddEditUserPermissions(UsersPermission Permission, List <PermissionAccess> PermissionAccessList, List <ClientAccess> ClientAccessList, List <ReportAccess> ReportAccessList)
        {
            SqlCommand     command     = null;
            SqlTransaction transaction = null;
            StringBuilder  process     = null;

            try
            {
                process = new StringBuilder();
                // Build xml criteria.

                // Define command.
                command             = mDbConnection.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Proc_AddEditUserPermissions";

                command.Parameters.Add("@DataPermission", SqlDbType.Xml).Value            = Permission.GetXml();
                command.Parameters.Add("@DataPermissionAccess", SqlDbType.Xml).Value      = PermissionAccess.GetXml(PermissionAccessList);
                command.Parameters.Add("@DataClientAccess", SqlDbType.Xml).Value          = ClientAccess.GetXml(ClientAccessList);
                command.Parameters.Add("@DataReportAccess", SqlDbType.Xml).Value          = ReportAccess.GetXml(ReportAccessList);
                command.Parameters.Add("@hasError", SqlDbType.Bit).Direction              = ParameterDirection.Output;
                command.Parameters.Add("@ErrorMessage", SqlDbType.VarChar, 255).Direction = ParameterDirection.Output;

                try
                {
                    // Execute command within transaction.
                    transaction         = mDbConnection.BeginTransaction();
                    command.Transaction = transaction;
                    command.ExecuteNonQuery();
                    transaction.Commit();
                }
                catch
                {
                    if (transaction != null)
                    {
                        if (transaction.Connection != null)
                        {
                            transaction.Rollback();
                        }
                    }

                    throw;
                }

                // Get output parameters.
                bool   IshasError   = bool.Parse(command.Parameters["@hasError"].Value.ToString());
                string errorMessage = command.Parameters["@ErrorMessage"].Value.ToString();

                if (IshasError)
                {
                    // Create exception instance.
                    ValidationException exception = new ValidationException("Validation error occurred.");
                    exception.Data.Add("PERMISSION_Error", errorMessage);

                    throw exception;
                }
            }
            catch { throw; }
            finally
            {
                if (transaction != null)
                {
                    transaction.Dispose();
                }
                if (command != null)
                {
                    command.Dispose();
                }
            }
        }
 public JsonResult LoadTsCallByParamsWithEnum(string name, string vorname, int alter, ClientAccess access)
 {
     return Json(new Auto() { Marke = name, Alter = alter }, JsonRequestBehavior.AllowGet);
 }
 public JsonResult LoadJsCallByParamsWithEnum(string name, string vorname, int alter, ClientAccess access)
 {
     return Json(new Person() { Name = name, Id = alter }, JsonRequestBehavior.AllowGet);
 }
Beispiel #12
0
 public JsonResult LoadTsCallByParamsWithEnum(string name, string vorname, int alter, ClientAccess access)
 {
     return(Json(new Auto()
     {
         Marke = name, Alter = alter
     }, JsonRequestBehavior.AllowGet));
 }
Beispiel #13
0
 public JsonResult LoadJsCallByParamsWithEnum(string name, string vorname, int alter, ClientAccess access)
 {
     return(Json(new Person()
     {
         Name = name, Id = alter
     }, JsonRequestBehavior.AllowGet));
 }
Beispiel #14
0
 public ClientManager(DbContextOptions <CarMechanicContext> options)
 {
     _options      = options;
     _clientAccess = new ClientAccess(_options);
 }