public JsonResult UpdateAppUserInformation(AppUserInformationModel appUserInformationModel)
        {
            Response <bool> response = new Response <bool>();

            appUserProvider = new AppUserProvider();

            AppUserModel appUserModel = SessionExtension.GetSessionUser(HttpContext.Session);

            if (appUserModel != null)
            {
                AppUserModel appUserTokenModel = SessionExtension.GetSessionUser(HttpContext.Session);

                appUserInformationModel.TokenKey = appUserModel.TokenKey;

                appUserInformationModel.AppUserId = appUserModel.AppUser.AppUserId;

                InfrastructureModel <bool> infrastructureModel = appUserProvider.Update(appUserInformationModel);

                response = new Response <bool>
                {
                    Data    = infrastructureModel.ResultStatus,
                    Message = "success",
                    Status  = infrastructureModel.ResultStatus,
                };
            }
            return(Json(response));
        }
        public JsonResult ChangePassword(AppUserLoginModel appUserLoginModel)
        {
            Response <bool> response = new Response <bool>();

            appUserProvider = new AppUserProvider();

            AppUserModel appUserModel = SessionExtension.GetSessionUser(HttpContext.Session);

            if (appUserModel != null)
            {
                AppUserModel appUserTokenModel = SessionExtension.GetSessionUser(HttpContext.Session);

                appUserLoginModel.TokenKey  = appUserModel.TokenKey;
                appUserLoginModel.AppUserId = appUserModel.AppUser.AppUserId;

                InfrastructureModel <bool> infrastructureModel = appUserProvider.ChangePassword(appUserLoginModel);

                response = new Response <bool>()
                {
                    Data    = infrastructureModel.ResultModel,
                    Message = infrastructureModel.Message,
                    Status  = true,
                    Refresh = true
                };
            }
            return(Json(response));
        }
        public JsonResult GetJsonPost()
        {
            informationContentProvider = new InformationContentProvider();
            tokenProvider = new TokenProvider();
            string token = string.Empty;
            InfrastructureModel <InformationContentSingleDataModel> infrastructureModel = new InfrastructureModel <InformationContentSingleDataModel>();

            if (SessionExtension.GetSessionUser(HttpContext.Session) == null)
            {
                token = tokenProvider.GetAnonimToken();
                SessionExtension.Set(HttpContext.Session, "FreeToken", token);
                infrastructureModel = informationContentProvider.GetInformationContentSingleData(new InformationContentPostModel()
                {
                    TokenKey = token
                });
            }
            else
            {
                AppUserModel appUserModel = SessionExtension.GetSessionUser(HttpContext.Session);
                if (appUserModel != null)
                {
                    token = appUserModel.TokenKey;

                    infrastructureModel = informationContentProvider.GetInformationContentSingleData(new InformationContentPostModel()
                    {
                        AppUserId = appUserModel.AppUser.AppUserId, TokenKey = token
                    });
                }
            }
            return(Json(infrastructureModel));
        }
Beispiel #4
0
        public async Task <IActionResult> Login(LoginViewModel user)
        {
            if (ModelState.IsValid)
            {
                var result = await _signInManager.PasswordSignInAsync(user.Email, user.Password, user.RememberMe, false);

                if (result.Succeeded)
                {
                    ApplicationIdentityUserModel applicationUser = await _aplicationIdentityUser.GetApplicationIdentityUserListByEmail(user.Email);

                    UserSessionModel userSessionModel = new UserSessionModel();

                    userSessionModel.UserId   = applicationUser.Id;
                    userSessionModel.UserName = applicationUser.UserName;

                    //start temporary avoid branch/financial year  selection

                    userSessionModel.CompanyId       = 1;
                    userSessionModel.FinancialYearId = 1;

                    //temporary avoid branch/financial year  selection


                    SessionExtension.SetComplexData(HttpContext.Session, "UserSession", userSessionModel);

                    return(RedirectToAction("Index", "Home", new { area = "Common" }));
                }

                ModelState.AddModelError(string.Empty, "Invalid Login Attempt");
            }
            return(View(user));
        }
        public JsonResult Login(AppUserLoginModel appUserLoginModel)
        {
            Response response = new Response();

            tokenProvider = new TokenProvider();
            try
            {
                appUserProvider = new AppUserProvider();

                AppUserModel appuserModel = appUserProvider.GetLoginUser(appUserLoginModel).ResultModel;

                if (appuserModel != null)
                {
                    SessionExtension.Set <AppUserModel>(HttpContext.Session, "Login", appuserModel);

                    response = new Response()
                    {
                        Message     = "success",
                        Status      = true,
                        RedirectUrl = Url.Action("Index", "Home")
                    };
                }
            }
            catch (Exception ex)
            {
                response = new Response()
                {
                    Message = "Fail",
                    Status  = false,
                };
            }
            return(Json(response));
        }
        /// <summary>
        /// add new invoice master.
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> AddInvoiceMaster()
        {
            ViewBag.CustomerList = await _ledger.GetLedgerSelectList((int)LedgerName.SundryDebtor);

            ViewBag.BankLedgerList = await _ledger.GetLedgerSelectList((int)LedgerName.BankAccount);

            ViewBag.AccountLedgerList = await _ledger.GetLedgerSelectList(0);

            ViewBag.TaxRegisterList = await _taxRegister.GetTaxRegisterSelectList();

            ViewBag.CurrencyList = await _currency.GetCurrencySelectList();

            ViewBag.TaxModelTypeList = EnumHelper.GetEnumListFor <TaxModelType>();
            ViewBag.DiscountTypeList = EnumHelper.GetEnumListFor <DiscountType>();

            UserSessionModel  userSession       = SessionExtension.GetComplexData <UserSessionModel>(HttpContext.Session, "UserSession");
            SalesInvoiceModel salesInvoiceModel = new SalesInvoiceModel();

            salesInvoiceModel.CompanyId       = userSession.CompanyId;
            salesInvoiceModel.FinancialYearId = userSession.FinancialYearId;

            // generate no.
            GenerateNoModel generateNoModel = await _salesInvoice.GenerateInvoiceNo(userSession.CompanyId, userSession.FinancialYearId);

            salesInvoiceModel.InvoiceNo   = generateNoModel.VoucherNo;
            salesInvoiceModel.InvoiceDate = DateTime.Now;

            return(await Task.Run(() =>
            {
                return PartialView("_AddInvoiceMaster", salesInvoiceModel);
            }));
        }
        public IViewComponentResult Invoke()
        {
            AppUserModel userModel = new AppUserModel();

            userModel = SessionExtension.Get <AppUserModel>(HttpContext.Session, "Login");
            return(View(userModel));
        }
Beispiel #8
0
        /// <summary>
        /// override save changes async
        /// </summary>
        /// <param name="acceptAllChangesOnSuccess"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public override async Task <int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default(CancellationToken))
        {
            try
            {
                UserSessionModel userSessionModel = SessionExtension.GetComplexData <UserSessionModel>(_session, "UserSession");
                var changeSet = ChangeTracker.Entries <IAuditable>();
                if (null != changeSet)
                {
                    foreach (var entry in changeSet.Where(c => c.State != EntityState.Unchanged))
                    {
                        switch (entry.State)
                        {
                        case EntityState.Added:
                            if (entry.Entity.GetType().GetProperty("PreparedByUserId") != null)
                            {
                                entry.Property("PreparedByUserId").CurrentValue = userSessionModel.UserId;
                            }
                            if (entry.Entity.GetType().GetProperty("PreparedDateTime") != null)
                            {
                                entry.Property("PreparedDateTime").CurrentValue = DateTime.Now;
                            }
                            if (entry.Entity.GetType().GetProperty("UpdatedByUserId") != null)
                            {
                                entry.Property("UpdatedByUserId").CurrentValue = userSessionModel.UserId;
                            }
                            if (entry.Entity.GetType().GetProperty("UpdatedDateTime") != null)
                            {
                                entry.Property("UpdatedDateTime").CurrentValue = DateTime.Now;
                            }
                            break;

                        case EntityState.Modified:
                            if (entry.Entity.GetType().GetProperty("UpdatedByUserId") != null)
                            {
                                entry.Property("UpdatedByUserId").CurrentValue = userSessionModel.UserId;
                            }
                            if (entry.Entity.GetType().GetProperty("UpdatedDateTime") != null)
                            {
                                entry.Property("UpdatedDateTime").CurrentValue = DateTime.Now;
                            }
                            break;

                        default:
                            // dont' update anything.
                            break;
                        }
                    }
                }

                return(await base.SaveChangesAsync(true, cancellationToken));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public JsonResult Insert(InformationContentCRUDModel informationContentCRUDModel)
        {
            Response response = new Response();

            try
            {
                informationContentProvider = new InformationContentProvider();

                AppUserModel appUserModel = SessionExtension.GetSessionUser(HttpContext.Session);

                InformationApiContentCRUDModel apiContentCRUDModel = new InformationApiContentCRUDModel()
                {
                    CategoryId  = informationContentCRUDModel.CategoryId,
                    Explanation = informationContentCRUDModel.Explanation,
                    Title       = informationContentCRUDModel.Title,
                    LikeCount   = 0,
                    AuthorId    = appUserModel.AppUser.AppUserId,
                    TokenKey    = appUserModel.TokenKey
                };


                if (informationContentCRUDModel.InformationImage != null)
                {
                    byte[] data;
                    using (var ms = new MemoryStream())
                    {
                        informationContentCRUDModel.InformationImage.CopyTo(ms);
                        apiContentCRUDModel.PostImagePath = Path.GetExtension(informationContentCRUDModel.InformationImage.FileName);
                        data = ms.ToArray();
                    }

                    var fileContent = new ByteArrayContent(data);

                    apiContentCRUDModel.ImageArrayList = fileContent;

                    informationContentProvider.InsertInformationContent(apiContentCRUDModel);
                }
                response = new Response()
                {
                    Message = "success",
                    Status  = true,
                };
            }
            catch (Exception ex)
            {
                response = new Response()
                {
                    Message = "Failed",
                    Status  = false
                };
            }

            return(Json(response));
        }
Beispiel #10
0
        public async Task <JsonResult> ChooseCommpany(int companyId)
        {
            JsonData <JsonStatus> data = new JsonData <JsonStatus>(new JsonStatus());

            return(await Task.Run(() =>
            {
                UserSessionModel userSessionModel = SessionExtension.GetComplexData <UserSessionModel>(HttpContext.Session, "UserSession");
                userSessionModel.CompanyId = companyId;
                SessionExtension.SetComplexData(HttpContext.Session, "UserSession", userSessionModel);

                return Json(data);
            }));
        }
        public PartialViewResult _UserInfo()
        {
            AppUserModel userModel = new AppUserModel();

            userModel = SessionExtension.Get <AppUserModel>(HttpContext.Session, "Login");
            if (userModel != null)
            {
                return(PartialView(userModel));
            }
            else
            {
                return(null);
            }
        }
        public IActionResult Login()
        {
            AppUserModel userModel = new AppUserModel();

            userModel = SessionExtension.Get <AppUserModel>(HttpContext.Session, "Login");
            if (userModel != null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(View());
            }
        }
Beispiel #13
0
        public async Task <PartialViewResult> AddVoucherSetupDetail()
        {
            VoucherSetupDetailModel voucherSetupDetailModel = new VoucherSetupDetailModel();

            ViewBag.VoucherSetupList = await _voucherSetup.GetVoucherSetupSelectList();

            ViewBag.VoucherStyleList = await _voucherStyle.GetVoucherStyleSelectList();

            UserSessionModel userSession = SessionExtension.GetComplexData <UserSessionModel>(HttpContext.Session, "UserSession");

            voucherSetupDetailModel.CompanyId       = userSession.CompanyId;
            voucherSetupDetailModel.FinancialYearId = userSession.FinancialYearId;

            return(PartialView("_AddVoucherSetupDetail", voucherSetupDetailModel));
        }
        public IActionResult GetStructs()
        {
            return(ActionExecute(() =>
            {
                var file = SessionExtension.Get <FileData>(session, Key.File);

                if (file == null)
                {
                    return BadRequest("Kérem töltsön fel először fájlt!");
                }

                var structs = Analyzer.GetStructs(file.Content);

                return Ok(structs);
            }));
        }
        public IActionResult Update([FromBody] List <AnalyzeData> analyzeDatas)
        {
            return(ActionExecute(() =>
            {
                var file = SessionExtension.Get <FileData>(session, Key.File);
                var controlFlowGraphJson = session.GetString(Key.ControlFlowGraph.ToString("g"));
                var dataFlowGraphJson = session.GetString(Key.DataFlowGraph.ToString("g"));
                var analyzers = new List <Analyzer>();

                if (file == null || controlFlowGraphJson == null || dataFlowGraphJson == null)
                {
                    return BadRequest("Kérem töltsön fel először fájlt!");
                }

                analyzeDatas.ForEach(x =>
                {
                    analyzers.Add(new Analyzer(controlFlowGraphJson, dataFlowGraphJson, x, file.Content));
                });

                Parallel.ForEach(analyzers, (analyzer) =>
                {
                    analyzer.Analyze();
                    analyzer.FinishOperations();
                });

                analyzers.DistinctGraphs(out List <List <ViewNode> > controlFlowGraphs, out List <List <ViewNode> > dataFlowGraphs);
                analyzers.CreateCharts(out BarChartData readAndWriteChartData, out PieChartData useVariable, out PieChartData useful, out BarChartData headers);

                var calculateData = new CalculatedData
                {
                    ControlFlowGraphs = controlFlowGraphs,
                    DataFlowGraphs = dataFlowGraphs,
                    ReadAndWriteChartData = readAndWriteChartData,
                    UseVariable = useVariable,
                    Useful = useful,
                    Headers = headers,
                    File = file
                };

                return Ok(calculateData);
            }));
        }
Beispiel #16
0
        public IActionResult GetGraph(string type)
        {
            return(ActionExecute(() =>
            {
                var success = Enum.TryParse(type, true, out Key key);

                if (!success)
                {
                    return BadRequest("Érvénytelen behívás!");
                }

                var graph = SessionExtension.GetGraph(session, key);

                if (graph == null || !graph.Nodes.Any())
                {
                    return BadRequest("Kérem töltsön fel először fájlt!");
                }

                return Ok(graph.Serialize());
            }));
        }
Beispiel #17
0
        public IActionResult FileUpload([FromBody] FileData file)
        {
            return(ActionExecute(() =>
            {
                if (file.Content == null || string.IsNullOrWhiteSpace(file.Content))
                {
                    return BadRequest("Üres fájl!");
                }

                var content = file.Content;

                SessionExtension.Set(session, Key.File, file);

                var controlFlowGraph = P4ToGraph.ControlFlowGraph(ref content);
                SessionExtension.SetGraph(session, Key.ControlFlowGraph, controlFlowGraph);

                var dataFlowGraph = P4ToGraph.DataFlowGraph(content, controlFlowGraph);
                SessionExtension.SetGraph(session, Key.DataFlowGraph, dataFlowGraph);

                return Ok(file);
            }));
        }
        public JsonResult ResetAllInformation()
        {
            Response <bool> response = new Response <bool>();

            appUserProvider = new AppUserProvider();
            AppUserModel appUserModel = SessionExtension.GetSessionUser(HttpContext.Session);

            if (appUserModel != null)
            {
                AppUserModel appUserTokenModel = SessionExtension.GetSessionUser(HttpContext.Session);

                InfrastructureModel <bool> infrastructureModel = appUserProvider.ResetAllInformationAppUser(appUserTokenModel);

                response = new Response <bool>
                {
                    Data    = infrastructureModel.ResultStatus,
                    Message = infrastructureModel.Message,
                    Status  = infrastructureModel.ResultStatus,
                };
            }
            return(Json(response));
        }
Beispiel #19
0
        public IActionResult LogInd(User user)
        {
            try
            {
                var sendUser = _proxy.RequestInstanceAsync(user.Username, user.Password);

                sendUser.Wait();
                var tmp = sendUser.Result;
                if (sendUser.Result != null)
                {
                    //set user to session
                    SessionExtension.SetObjectAsJson(HttpContext.Session, "user", tmp);

                    return(RedirectToAction("PostLogInd", tmp));
                }
            }
            catch (Exception e)
            {
                var tmp = e.GetBaseException().Message;
            }

            return(View("LogInd"));
        }
        public JsonResult GetAppUserInformation(AppUserLoginModel appUserLoginModel)
        {
            Response <AppUserInformationModel> response = new Response <AppUserInformationModel>();

            appUserProvider = new AppUserProvider();
            AppUserModel appUserModel = SessionExtension.GetSessionUser(HttpContext.Session);

            if (appUserModel != null)
            {
                AppUserModel appUserTokenModel = SessionExtension.GetSessionUser(HttpContext.Session);
                InfrastructureModel <AppUserInformationModel> appUserInformationModel = appUserProvider.GetById(new AppUserLoginModel()
                {
                    AppUserId = appUserModel.AppUser.AppUserId, TokenKey = appUserModel.TokenKey
                });
                response = new Response <AppUserInformationModel>()
                {
                    Data    = appUserInformationModel.ResultModel,
                    Message = "succes",
                    Status  = true
                };
            }
            return(Json(response));
        }
Beispiel #21
0
        public IActionResult Index()
        {
            UserSessionModel userSessionModel = SessionExtension.GetComplexData <UserSessionModel>(HttpContext.Session, "UserSession");

            return(View());
        }
        public IActionResult Index()
        {
            informationContentProvider = new InformationContentProvider();

            InfrastructureModel <List <InformationContentSingleDataModel> > infrastructureModelList = informationContentProvider.GetListInformationContent(SessionExtension.GetSessionUserTokeyKey(HttpContext.Session));

            return(View(infrastructureModelList));
        }
        public IActionResult Insert()
        {
            InformationContentCRUDModel informationContentCRUDModel = new InformationContentCRUDModel();

            categoryProvider = new CategoryProvider();

            InfrastructureModel <List <Category> > infrastructerCategoryList = categoryProvider.GetCategoryList(SessionExtension.GetSessionUserTokeyKey(HttpContext.Session));

            informationContentCRUDModel.CategoryList = new SelectList(infrastructerCategoryList.ResultModel, "CategoryId", "Name");

            return(View(informationContentCRUDModel));
        }
        public IActionResult AddEdit(int id, string Username = "", string Etype = "", string actuator = "", string returnView = "", string sessionid = "")
        {
            try
            {
                ViewBag.flexionString   = "Flexion";
                ViewBag.extensionString = "Extension";
                List <EquipmentExercise> lExerciseString = lIEquipmentExerciseRepository.GetEquipmentExerciseString();
                if (lExerciseString != null && lExerciseString.Count > 0 && Etype == "Shoulder")
                {
                    var lexString = lExerciseString.Where(x => x.Limb == "Shoulder" && x.ExerciseEnum == actuator).FirstOrDefault();
                    if (lexString != null)
                    {
                        ViewBag.flexionString = lexString.FlexionString;
                    }
                }
                else if (lExerciseString != null && lExerciseString.Count > 0)
                {
                    var lexString = lExerciseString.Where(x => x.Limb == Etype).FirstOrDefault();
                    if (lexString != null)
                    {
                        ViewBag.flexionString   = lexString.FlexionString;
                        ViewBag.extensionString = lexString.ExtensionString;
                    }
                }
                if (string.IsNullOrEmpty(sessionid))
                {
                    List <NewProtocol> ptoList = INewPatient.GetProtocolListBypatId(id.ToString());
                    if (Etype == "Shoulder")
                    {
                        ptoList = ptoList.Where(p => p.ExcerciseEnum == actuator).ToList();
                    }
                    else
                    {
                        ptoList = ptoList.Where(p => p.ExcerciseEnum == "Flexion-Extension").ToList();
                    }
                    List <SelectListItem> list = new List <SelectListItem>();
                    foreach (NewProtocol ex in ptoList)
                    {
                        list.Add(new SelectListItem {
                            Text = ex.ProtocolName.ToString(), Value = ex.ProtocolId.ToString()
                        });
                    }
                    ViewBag.Protocol = list;
                    SessionView sv = new SessionView();
                    sv.PatientId = id;
                    sv.Patname   = Username;
                    sv.EType     = Etype;
                    sv.EEnum     = actuator;

                    if (!string.IsNullOrEmpty(returnView))
                    {
                        sv.returnView = returnView;
                    }
                    return(View(sv));
                }
                else
                {
                    Session lSession = lISessionInterface.getSession(sessionid);
                    if (lSession != null)
                    {
                        SessionView sv = SessionExtension.SessionToSessionView(lSession);
                        if (sv != null)
                        {
                            List <NewProtocol> ptoList = INewPatient.GetProtocolListBypatId(sv.PatientId.ToString());
                            if (Etype == "Shoulder")
                            {
                                ptoList = ptoList.Where(p => p.ExcerciseEnum == actuator).ToList();
                            }
                            else
                            {
                                ptoList = ptoList.Where(p => p.ExcerciseEnum == "Flexion-Extension").ToList();
                            }
                            List <SelectListItem> list = new List <SelectListItem>();
                            foreach (NewProtocol ex in ptoList)
                            {
                                list.Add(new SelectListItem {
                                    Text = ex.ProtocolName.ToString(), Value = ex.ProtocolId.ToString()
                                });
                            }
                            ViewBag.Protocol = list;
                            sv.PatientId     = id;
                            sv.Patname       = Username;
                            sv.EType         = Etype;
                            sv.EEnum         = actuator;

                            if (!string.IsNullOrEmpty(returnView))
                            {
                                sv.returnView = returnView;
                            }
                        }
                        return(View(sv));
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogDebug("User Post Error: " + ex);
            }
            return(View());
        }