Beispiel #1
0
        public async Task <IActionResult> OnPostSave([FromBody] CreatePersonCommand command)
        {
            try
            {
                // Untill application of Identity
                command.ModifiedBy = "TEST USER";
                command.CreatedBy  = 10;
                command.CreatedOn  = DateTime.Now;

                command.ModuleID       = HttpContext.Session.GetInt32("ModuleID").Value;
                command.ProcessID      = HttpContext.Session.GetInt32("ProcessID").Value;
                command.OrganizationId = await _currentUser.GetUserOrganizationID();

                List <SearchedPersonModel> SaveResult = new List <SearchedPersonModel>();

                SaveResult = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = SaveResult },
                    Status = UIStatus.Success,
                    Text = "اطلاعات مستخدم موفقانه ثبت سیستم شد",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostSave([FromBody] SavePlanCommand command)
        {
            try
            {
                List <SearchedPlan> dbResult = await Mediator.Send(command);

                if (dbResult.Any())
                {
                    int ModuleID  = HttpContext.Session.GetInt32("ModuleID").Value;
                    int ProcessID = HttpContext.Session.GetInt32("ProcessID").Value;
                    await Mediator.Send(new SaveProcessTracksCommand()
                    {
                        ModuleId = ModuleID, ProcessId = ProcessID, RecordId = dbResult.FirstOrDefault().Id
                    });
                }

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = dbResult },
                    Status = UIStatus.Success,
                    Text = "تشکیل موفقانه ثبت سیستم شد",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Beispiel #3
0
        public async Task <IActionResult> OnPostSave([FromBody] CreateUserCommand command)
        {
            try
            {
                List <string> result = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = result },
                    Status = UIStatus.Success,
                    Text = "کاربر موفقانه ثبت سیستم شد" + "\n" + "رمز عبور: " + result[0].ToString(),
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Beispiel #4
0
        public async Task <IActionResult> OnPostSave([FromBody] SaveOrganiztionCommand command)
        {
            try
            {
                List <SearchedOrganizationModel> dbResult = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = dbResult },
                    Status = UIStatus.Success,
                    Text = "ارگان موفقانه ثبت سیستم شد",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Beispiel #5
0
        public async Task <IActionResult> OnPostSearch([FromBody] GetIdentityCardsQuery searchQuery)
        {
            try
            {
                List <SearchedIdentityCardModel> listOfCards = new List <SearchedIdentityCardModel>();
                listOfCards = await Mediator.Send(searchQuery);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = listOfCards },
                    Status = UIStatus.SuccessWithoutMessage,
                    Text = string.Empty,
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Beispiel #6
0
        public async Task <IActionResult> OnPostSearch([FromBody] SearchPositionQuery command)
        {
            try
            {
                List <SearchedPosition> result = new List <SearchedPosition>();
                result = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = result },
                    Status = UIStatus.Success,
                    Text = string.Empty,
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Beispiel #7
0
        public async Task <IActionResult> OnPostSave([FromBody] SetIdentityCardCommand command)
        {
            List <SearchedIdentityCardModel> listOfCards = new List <SearchedIdentityCardModel>();

            try
            {
                listOfCards = await Mediator.Send(command);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = listOfCards },
                    Status = UIStatus.Success,
                    Text = "اطلاعات کارت هویت موفقانه تنظیم گردید",
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Beispiel #8
0
        public async Task <IActionResult> OnPostSearch([FromBody] SearchPersonQuery searchQuery)
        {
            try
            {
                searchQuery.OrganizationId = await _currentUser.GetUserOrganizationID();

                List <SearchedPersonModel> SearchedResult = new List <SearchedPersonModel>();
                SearchedResult = await Mediator.Send(searchQuery);

                return(new JsonResult(new UIResult()
                {
                    Data = new { list = SearchedResult },
                    Status = UIStatus.SuccessWithoutMessage,
                    Text = string.Empty,
                    Description = string.Empty
                }));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }
Beispiel #9
0
        public async Task <IActionResult> GetEmployeeImage([FromRoute] string hrCode)
        {
            try
            {
                string fileName = await _mediator.Send(new GetEmployeePhotoPath()
                {
                    HrCode = hrCode
                });

                FileStorage fileStorage = new FileStorage();
                string      FilePath    = _configuration["Photo"] + fileName;

                System.IO.Stream filecontent = await fileStorage.GetAsync(FilePath);

                var filetype = fileStorage.GetContentType(FilePath);
                return(File(filecontent, filetype, fileName));
            }
            catch (Exception ex)
            {
                return(new JsonResult(CustomMessages.FabricateException(ex)));
            }
        }