Example #1
0
        public ActionResult RenderFeatured()
        {
            HomeHelper          homeHelper = new HomeHelper(CurrentPage, new UmbracoHelper(UmbracoContext.Current));
            List <FeaturedItem> model      = homeHelper.GetFeaturedItemsModel();

            return(PartialView(GetViewPath("_Featured"), model));
        }
Example #2
0
        public ActionResult RenderBlog()
        {
            HomeHelper      homeHelper = new HomeHelper(CurrentPage, new UmbracoHelper(UmbracoContext.Current));
            LatestBlogPosts model      = homeHelper.GetLatestBlogPosts();

            return(PartialView(GetViewPath("_Blog"), model));
        }
Example #3
0
        private void DisplayRecentCorkboardUpdates()
        {
            UpdatesView.Items.Clear();
            UpdatesView.SelectionMode = SelectionMode.Single;
            var view = new GridView();

            UpdatesView.View = view;
            view.Columns.Add(CreateGridColumn("Title", 196));
            view.Columns.Add(CreateGridColumn("Owner", 156));
            view.Columns.Add(CreateGridColumn("Last PushPin Update Time", 188, "LastUpdate"));
            view.Columns.Add(CreateGridColumn("", 60, "Private"));
            view.Columns.Add(CreateGridColumn("", 0, "Email"));

            var corkboards = HomeHelper.GetRecentlyUpdatedCorkboards(MainWindow.User);

            if (corkboards.Count == 0)
            {
                UpdatesView.Items.Add(new { Title = "No recent updates." });
                return;
            }

            foreach (var board in corkboards)
            {
                var isPrivate = string.Empty;
                if (board.IsPrivate)
                {
                    isPrivate = "Private";
                }
                UpdatesView.Items.Add(new { Title = board.Title, Owner = board.Owner.Name, LastUpdate = board.LastUpdate, Private = isPrivate, Email = board.Owner.Email });
            }
        }
Example #4
0
        public void RandomizerTest()
        {
            List <Home> list = HomeHelper.GetMockupHomes(20);

            Assert.IsTrue(list.Count <= 20);
            Assert.IsFalse(list.Any(x => x.Rooms.Count <= 0));
        }
Example #5
0
        public ActionResult NewsConfig(int msg = 0)
        {
            HomeHelper home = new HomeHelper();

            ViewBag.News      = home.GetNews();
            ViewBag.Msg       = msg;
            ViewBag.MsgString = msg;

            switch (msg)
            {
            case 1:
                ViewBag.MsgString = "El formato de archivo seleccionado no corresponde al formato de imagen requerido";
                break;

            case 2:
                ViewBag.MsgString = "No se ha seleccionado el archivo de imagen";
                break;

            case 3:
                ViewBag.MsgString = "Se han actualizado los cambios";
                break;
            }

            return(View(home.GetNewById()));
        }
Example #6
0
        public JsonResult GetStores(int idCompany)
        {
            HomeHelper homeHelper = new HomeHelper();

            var listStores = homeHelper.GetStores(idCompany);

            return(Json(listStores, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public JsonResult ApproveNotice(int Ad_Note_ID, bool isAcknowldge)
        {
            objHomeHelp = new HomeHelper();
            Ctx ct  = Session["ctx"] as Ctx;
            var res = objHomeHelp.ApproveNotice(ct, Ad_Note_ID, isAcknowldge);

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Example #8
0
        public JsonResult GetCiudades(string codigoDepartamento)
        {
            HomeHelper homeHelper = new HomeHelper();

            var listaCiudades = homeHelper.GetCiudades(codigoDepartamento);


            //return Json(listaCiudades, JsonRequestBehavior.AllowGet);
            return(Json(listaCiudades));
        }
Example #9
0
        public ActionResult Index()
        {
            HomeHelper homeHelper = new HomeHelper();

            var listCompanies = homeHelper.GetCompanies();

            ViewBag.listCompanies = listCompanies;

            return(View());
        }
Example #10
0
        public ActionResult Main()
        {
            Usuarios   user = new Usuarios();
            HomeHelper home = new HomeHelper();

            user = home.GetUserInfo(int.Parse(Session["IdUser"].ToString()));

            ViewBag.UserInfo = user;
            ViewBag.News     = home.GetNews();

            return(View());
        }
Example #11
0
 public JsonResult RemoveNodeFavourite(int nodeID)
 {
     try
     {
         Helpers.HomeHelper homeHelper = new HomeHelper();
         return(Json(new { result = homeHelper.RemoveNodeFavourite(nodeID, Session["ctx"] as Ctx) }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(null);
     }
 }
Example #12
0
        public PartialViewResult Edit(int id)
        {
            HomeHelper Homehelper    = new HomeHelper();
            var        listCompanies = Homehelper.GetCompanies();

            //List<RolRegistrado> listaRol = new List<RolRegistrado>();
            ViewBag.listCompanies = listCompanies;
            UsuarioActualizar ssss = new UsuarioActualizar();

            ssss = _gestorDeUsuarios.FindById(id);
            return(PartialView("_Edit", ssss));
        }
Example #13
0
 public JsonResult GetFavouriteNode()
 {
     try
     {
         //Helpers.MenuHelper mnuHelper = new Helpers.MenuHelper(Session["ctx"] as Ctx); // inilitilize menu class
         Helpers.HomeHelper homeHelper = new HomeHelper();
         var nodes = Session["barNodes"] as List <VTreeNode>;
         Session["barNodes"] = null;
         return(Json(new { result = homeHelper.GetBarNodes(nodes) }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(null);
     }
 }
Example #14
0
        public JsonResult PostFllupsCmnt(int fllChatID, int fllSubscriberID, string cmntTxt)
        {
            objHomeHelp = new HomeHelper();
            Ctx ctx         = Session["ctx"] as Ctx;
            int usr_Role_ID = ctx.GetAD_Role_ID();

            objHomeHelp.SaveFllupsCmnt(ctx, fllChatID, fllSubscriberID, cmntTxt);
            objHomeHelp = new HomeHelper();
            HomeModels hm = new HomeModels();

            hm = objHomeHelp.getLoginUserInfo(ctx, 46, 46);
            // ViewBag.UserPic = hm.UsrImage;
            return(Json(hm.UsrImage, JsonRequestBehavior.AllowGet));
            //return Json(JsonConvert.SerializeObject(hm.UsrImage), JsonRequestBehavior.AllowGet);
        }
Example #15
0
        public ActionResult Home()
        {
            Ctx ct = Session["ctx"] as Ctx;

            ViewBag.Current_Ad_Lang = ct.GetAD_Language();
            objHomeHelp             = new HomeHelper();
            HomeModels HM = objHomeHelp.getHomeAlrtCount(ct);

            objHomeHelp = new HomeHelper();
            HomeFolloUpsInfo fllInfo = objHomeHelp.getFolloUps(ct, 10, 1);

            HM.HomeFolloUpsInfo = fllInfo;
            ViewBag.lang        = ct.GetAD_Language();
            ViewBag.User_ID     = ct.GetAD_User_ID();
            ViewBag.isRTL       = ct.GetIsRightToLeft();
            return(PartialView(HM));
        }
Example #16
0
        public PartialViewResult Create()
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("_Create"));
            }

            HomeHelper Homehelper    = new HomeHelper();
            var        listCompanies = Homehelper.GetCompanies();

            //List<RolRegistrado> listaRol = new List<RolRegistrado>();
            ViewBag.listCompanies = listCompanies;
            //return View();

            //return View();

            return(PartialView("_Create"));
        }
Example #17
0
        public JsonResult GetJSONFllups(int fllPageSize, int fllPage, Boolean isRef)
        {
            HomeFolloUpsInfo fllInfo = null;

            objHomeHelp = new HomeHelper();
            if (Session["ctx"] != null)
            {
                Ctx ct = Session["ctx"] as Ctx;

                fllInfo = new HomeFolloUpsInfo();
                fllInfo = objHomeHelp.getFolloUps(ct, fllPageSize, fllPage);
                if (isRef)
                {
                    fllInfo.FllCnt = objHomeHelp.getFllCnt(ct);
                }
            }
            return(Json(JsonConvert.SerializeObject(fllInfo), JsonRequestBehavior.AllowGet));
        }
Example #18
0
        public ActionResult UploadFile(HttpPostedFileBase file, int id = 0)
        {
            try
            {
                HomeHelper home = new HomeHelper();
                NewsFeed   n    = home.GetNewById(id);

                string archivo   = string.Empty;
                string extension = string.Empty;

                if (file == null)
                {
                    return(Redirect(Url.Action("NewsConfig", "Home", new { msg = 2 })));
                }

                extension = Path.GetExtension(file.FileName).ToLower();

                if (extension != ".png")
                {
                    if (extension != ".jpg")
                    {
                        if (extension != ".jpeg")
                        {
                            return(Redirect(Url.Action("NewsConfig", "Home", new { msg = 1 })));
                        }
                    }
                }

                archivo = "/Calidad/Image/News/Noticia" + n.Orden + "-id-" + n.IdItem + extension;

                n.Imagen = archivo;

                home.UpdateNewsFeed(n);


                file.SaveAs(Server.MapPath(archivo));

                return(Redirect(Url.Action("NewsConfig", "Home", new { msg = 3 })));
            }
            catch (Exception ex)
            {
                return(Redirect(Url.Action("ErrorPage", "Error", new { msg = ex.Message })));
            }
        }
Example #19
0
        public JsonResult GetJSONFllupsCmnt(string FllupsID, int fllCmntPageSize, int fllCmntPage)
        {
            objHomeHelp = new HomeHelper();
            Ctx ct = Session["ctx"] as Ctx;
            HomeFolloUpsInfo fllInfo = null;

            if (Session["ctx"] != null)
            {
                int usr_Role_ID = ct.GetAD_Role_ID();
                objHomeHelp = new HomeHelper();
                string[] arr          = FllupsID.Split('-');
                int      ChatID       = Util.GetValueOfInt(arr[0]);
                int      RecordID     = Util.GetValueOfInt(arr[1]);
                int      SubscriberID = Util.GetValueOfInt(arr[2]);
                int      TableID      = Util.GetValueOfInt(arr[3]);
                int      WinID        = Util.GetValueOfInt(arr[4]);
                fllInfo = new HomeFolloUpsInfo();
                fllInfo = objHomeHelp.getFolloUpsCmnt(ct, ChatID, RecordID, SubscriberID, TableID, WinID, usr_Role_ID, fllCmntPageSize, fllCmntPage);
            }
            return(Json(JsonConvert.SerializeObject(fllInfo), JsonRequestBehavior.AllowGet));
        }
Example #20
0
        public JsonResult GetJSONHomeRequest(int pagesize, int page, Boolean isTabDataRef)
        {
            int count = 0;
            List <HomeRequest> lst   = null;
            string             error = "";

            if (Session["ctx"] != null)
            {
                objHomeHelp = new HomeHelper();
                Ctx ct = Session["ctx"] as Ctx;
                lst = new List <HomeRequest>();
                if (isTabDataRef)
                {
                    count = objHomeHelp.getRequestCnt(ct);
                }
                lst = objHomeHelp.getHomeRequest(ct, pagesize, page);
            }
            else
            {
                error = "Session Expired";
            }
            return(Json(new { count = count, data = JsonConvert.SerializeObject(lst), error = error }, JsonRequestBehavior.AllowGet));
        }
Example #21
0
        public ActionResult Home()
        {
            Ctx ct = Session["ctx"] as Ctx;

            ViewBag.Current_Ad_Lang = ct.GetAD_Language();
            objHomeHelp             = new HomeHelper();
            HomeModels HM = objHomeHelp.getHomeAlrtCount(ct);

            objHomeHelp = new HomeHelper();
            HomeFolloUpsInfo fllInfo = objHomeHelp.getFolloUps(ct, 10, 1);

            HM.HomeFolloUpsInfo = fllInfo;
            ViewBag.lang        = ct.GetAD_Language();
            ViewBag.User_ID     = ct.GetAD_User_ID();
            ViewBag.isRTL       = ct.GetIsRightToLeft();

            string storedPath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "");

            storedPath += "LOG_";
            VLogMgt.Initialize(true, storedPath);

            return(PartialView(HM));
        }
Example #22
0
        public ActionResult UpdateNews(NewsFeed item, int id)
        {
            HomeHelper home   = new HomeHelper();
            NewsFeed   old    = home.GetNewById(id);
            int        result = 0;

            old.Cabecera    = item.Cabecera;
            old.Descripcion = item.Descripcion;
            old.FAlta       = DateTime.Now;
            old.Mostrar     = item.Mostrar;
            old.URL         = item.URL;

            result = home.UpdateNewsFeed(old);

            if (result > 0)
            {
                return(Redirect(Url.Action("NewsConfig", "Home", new { msg = 3 })));
            }
            else
            {
                return(Redirect(Url.Action("NewsConfig", "Home", new { msg = 3 })));
            }
        }
Example #23
0
        //[MethodImpl(MethodImplOptions.Synchronized)]
        //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
        /// <summary>
        /// Entry Point of Framework
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public ActionResult Index(FormCollection form)
        {
            //if (!User.Identity.IsAuthenticated)
            //{
            //    // Required to allow javascript redirection through to browser
            //    this.Response.TrySkipIisCustomErrors = true;
            //    this.Response.Status = "401 Unauthorized";
            //    this.Response.StatusCode = 401;
            //    // note that the following line is .NET 4.5 or later only
            //    // otherwise you have to suppress the return URL etc manually!
            //    this.Response.SuppressFormsAuthenticationRedirect = true;
            //    // If we got this far, something failed

            //}


            var url = CloudLogin.IsAllowedToLogin(Request.Url.ToString());

            if (!string.IsNullOrEmpty(url))
            {
                return(RedirectPermanent(url));
            }

            VAdvantage.DataBase.DBConn.SetConnectionString();//Init database conection
            LoginModel model = null;

            if (User.Identity.IsAuthenticated)
            {
                try
                {
                    //var conf = WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath);
                    //  SessionStateSection section = (SessionStateSection) conf.GetSection("system.web/sessionState");
                    // int timeout = (int) section.Timeout.TotalMinutes;
                    Session.Timeout = 20; // ideal timout
                }
                catch
                {
                }


                //AccountController a = new AccountController();
                //a.LogOff();
                FormsIdentity ident = User.Identity as FormsIdentity;
                Ctx           ctx   = null;
                if (ident != null)
                {
                    FormsAuthenticationTicket ticket = ident.Ticket;
                    string       loginContextString  = ticket.UserData;// get login context string from Form Ticket
                    LoginContext lCtx = JsonHelper.Deserialize(loginContextString, typeof(LoginContext)) as LoginContext;
                    IDataReader  dr   = null;



                    //create class from string
                    string key = "";
                    if (Session["ctx"] != null)
                    {
                        ctx = Session["ctx"] as Ctx;

                        //Update Old Session
                        MSession session = MSession.Get(ctx, false);
                        if (session != null)
                        {
                            session.Logout();
                        }

                        key = ctx.GetSecureKey();

                        //if (Session.Timeout < 2)
                        //{
                        SessionEventHandler.SessionEnd(ctx);
                        Session.Timeout = 17;
                        //}
                        Session["ctx"] = null;
                    }
                    ctx = new Ctx(lCtx.ctxMap); //cretae new context
                    if (key != "")
                    {
                        ctx.SetSecureKey(key);
                    }
                    Session["ctx"] = ctx;

                    //get login Language object on server
                    var loginLang = ctx.GetAD_Language();

                    Language l = Language.GetLanguage(ctx.GetAD_Language()); //Language.GetLoginLanguage();
                    l = VAdvantage.Utility.Env.VerifyLanguage(ctx, l);

                    ctx.SetContext(VAdvantage.Utility.Env.LANGUAGE, l.GetAD_Language());
                    ctx.SetContext(VAdvantage.Utility.Env.ISRIGHTTOLEFT, VAdvantage.Utility.Env.IsRightToLeft(loginLang) ? "Y" : "N");
                    new VAdvantage.Login.LoginProcess(ctx).LoadSysConfig();


                    ViewBag.culture   = ctx.GetAD_Language();
                    ViewBag.direction = ctx.GetIsRightToLeft() ? "rtl" : "ltr";

                    //Change Authentication
                    model                           = new LoginModel();
                    model.Login1Model               = new Login1Model();
                    model.Login2Model               = new Login2Model();
                    model.Login1Model.UserName      = User.Identity.Name;
                    model.Login1Model.LoginLanguage = ctx.GetAD_Language();

                    model.Login2Model.Role      = ctx.GetAD_Role_ID().ToString();
                    model.Login2Model.Client    = ctx.GetAD_Client_ID().ToString();
                    model.Login2Model.Org       = ctx.GetAD_Org_ID().ToString();
                    model.Login2Model.Warehouse = ctx.GetAD_Warehouse_ID().ToString();


                    var RoleList      = new List <KeyNamePair>();
                    var ClientList    = new List <KeyNamePair>();
                    var OrgList       = new List <KeyNamePair>();
                    var WareHouseList = new List <KeyNamePair>();

                    LoginHelper.Login(model, out RoleList);

                    //string diableMenu = ctx.GetContext("#DisableMenu");
                    Helpers.MenuHelper mnuHelper = new Helpers.MenuHelper(ctx); // inilitilize menu class

                    bool disableMenu = MRole.GetDefault(ctx).IsDisableMenu();
                    ctx.SetIsBasicDB(mnuHelper.GetIsBasicDB());


                    // If Home page not linked OR home page Linked BUT Menu is not disabled , then show home page.
                    // If Home is linked as well as menu is disabled then don't load Default Home Page Settings
                    if (MRole.GetDefault(ctx).GetHomePage_ID() == 0 || (MRole.GetDefault(ctx).GetHomePage_ID() > 0 && !disableMenu))
                    {
                        HomeModels hm = new HomeModels();
                        objHomeHelp     = new HomeHelper();
                        hm              = objHomeHelp.getLoginUserInfo(ctx, 32, 32);
                        ViewBag.UserPic = hm.UsrImage;
                    }

                    if (!disableMenu) // if menu is not disabled, only then load menu.
                    {
                        //get current user info
                        ViewBag.Menu        = mnuHelper.GetMenuTree();    // create tree
                        Session["barNodes"] = ViewBag.Menu.GetBarNodes(); /* add is session to get it in favourite call */

                        ViewBag.TreeHtml = mnuHelper.GetMenuTreeUI(ViewBag.Menu.GetRootNode(), @Url.Content("~/"));
                    }

                    ViewBag.disableMenu = disableMenu;

                    mnuHelper.dispose();

                    //  LoginHelper.GetClients(id)

                    ClientList    = LoginHelper.GetClients(ctx.GetAD_Role_ID());                                          // .Add(new KeyNamePair(ctx.GetAD_Client_ID(), ctx.GetAD_Client_Name()));
                    OrgList       = LoginHelper.GetOrgs(ctx.GetAD_Role_ID(), ctx.GetAD_User_ID(), ctx.GetAD_Client_ID()); // .Add(new KeyNamePair(ctx.GetAD_Org_ID(), ctx.GetAD_Org_Name()));
                    WareHouseList = LoginHelper.GetWarehouse(ctx.GetAD_Org_ID());                                         // .Add(new KeyNamePair(ctx.GetAD_Warehouse_ID(), ctx.GetContext("#M_Warehouse_Name")));


                    ViewBag.RoleList      = RoleList;
                    ViewBag.ClientList    = ClientList;
                    ViewBag.OrgList       = OrgList;
                    ViewBag.WarehouseList = WareHouseList;
                    lock (_lock)    // Locked bundle Object and session Creation to handle concurrent requests.
                    {
                        //Cretae new Sessin
                        MSession sessionNew = MSession.Get(ctx, true, GetVisitorIPAddress(true));


                        var lst = VAdvantage.ModuleBundles.GetStyleBundles(); //Get All Style Bundle
                        foreach (var b in lst)
                        {
                            if (!BundleTable.Bundles.Contains(b))
                            {
                                BundleTable.Bundles.Add(b); //Add in Mvc Bundle Table
                            }
                        }

                        var lstRTLStyle = VAdvantage.ModuleBundles.GetRTLStyleBundles(); //Get All Script Bundle

                        foreach (var b in lstRTLStyle)
                        {
                            if (!BundleTable.Bundles.Contains(b))
                            {
                                BundleTable.Bundles.Add(b); //Add in Mvc Bundlw Table
                            }
                        }

                        var lstScript = VAdvantage.ModuleBundles.GetScriptBundles(); //Get All Script Bundle

                        foreach (var b in lstScript)
                        {
                            if (!BundleTable.Bundles.Contains(b))
                            {
                                BundleTable.Bundles.Add(b); //Add in Mvc Bundlw Table
                            }
                        }

                        ViewBag.LibSuffix   = "";
                        ViewBag.FrameSuffix = "_v1";
                        int libFound = 0;
                        foreach (Bundle b in BundleTable.Bundles)
                        {
                            if (b.Path.Contains("ViennaBase") && b.Path.Contains("_v") && ViewBag.LibSuffix == "")
                            {
                                ViewBag.LibSuffix = Util.GetValueOfInt(ctx.GetContext("#FRONTEND_LIB_VERSION")) > 2
                                                      ? "_v3" : "_v2";
                                libFound++;
                            }

                            if (b.Path.Contains("VIS") && b.Path.Contains("_v"))
                            {
                                ViewBag.FrameSuffix = Util.GetValueOfInt(ctx.GetContext("#FRAMEWORK_VERSION")) > 1
                                                      ? "_v2" : "_v1";
                                libFound++;
                            }
                            if (libFound >= 2)
                            {
                                break;
                            }
                        }
                        //check system setting// set to skipped lib
                    }
                }
            }

            else
            {
                model             = new LoginModel();
                model.Login1Model = new Login1Model();
                //model.Login1Model.UserName = "******";
                //model.Login1Model.Password = "******";
                model.Login1Model.LoginLanguage = "en_US";
                model.Login2Model = new Login2Model();

                ViewBag.RoleList      = new List <KeyNamePair>();
                ViewBag.OrgList       = new List <KeyNamePair>();
                ViewBag.WarehouseList = new List <KeyNamePair>();
                ViewBag.ClientList    = new List <KeyNamePair>();

                ViewBag.Languages = Language.GetLanguages();

                Session["ctx"]    = null;
                ViewBag.direction = "ltr";

                ViewBag.LibSuffix = "";
                foreach (Bundle b in BundleTable.Bundles)
                {
                    if (b.Path.Contains("ViennaBase") && b.Path.Contains("_v"))
                    {
                        ViewBag.LibSuffix = "_v2";
                        break;
                    }
                }
            }
            return(View(model));
        }
Example #24
0
        //[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
        public ActionResult Index(FormCollection form)
        {
            LoginModel model = null;

            if (User.Identity.IsAuthenticated)
            {
                VAdvantage.DataBase.DBConn.SetConnectionString();//Init database conection


                //AccountController a = new AccountController();
                //a.LogOff();
                FormsIdentity ident = User.Identity as FormsIdentity;
                Ctx           ctx   = null;
                if (ident != null)
                {
                    FormsAuthenticationTicket ticket = ident.Ticket;
                    string       loginContextString  = ticket.UserData;// get login context string from Form Ticket
                    LoginContext lCtx = JsonHelper.Deserialize(loginContextString, typeof(LoginContext)) as LoginContext;



                    //create class from string
                    string key = "";
                    if (Session["ctx"] != null)
                    {
                        ctx            = Session["ctx"] as Ctx;
                        key            = ctx.GetSecureKey();
                        Session["ctx"] = null;
                    }
                    ctx = new Ctx(lCtx.ctxMap); //cretae new context
                    if (key != "")
                    {
                        ctx.SetSecureKey(key);
                    }
                    Session["ctx"] = ctx;

                    //get login Language object on server
                    var loginLang = ctx.GetAD_Language();

                    Language l = Language.GetLanguage(ctx.GetAD_Language()); //Language.GetLoginLanguage();
                    l = VAdvantage.Utility.Env.VerifyLanguage(ctx, l);

                    ctx.SetContext(VAdvantage.Utility.Env.LANGUAGE, l.GetAD_Language());
                    ctx.SetContext(VAdvantage.Utility.Env.ISRIGHTTOLEFT, VAdvantage.Utility.Env.IsRightToLeft(loginLang) ? "Y" : "N");

                    //get current user info
                    HomeModels hm = new HomeModels();
                    objHomeHelp     = new HomeHelper();
                    hm              = objHomeHelp.getLoginUserInfo(ctx, 32, 32);
                    ViewBag.UserPic = hm.UsrImage;

                    Helpers.MenuHelper mnuHelper = new Helpers.MenuHelper(ctx); // inilitilize menu class

                    ViewBag.Menu        = mnuHelper.GetMenuTree();              // create tree
                    Session["barNodes"] = ViewBag.Menu.GetBarNodes();           /* add is session to get it in favourite call */

                    ViewBag.TreeHtml = mnuHelper.GetMenuTreeUI(ViewBag.Menu.GetRootNode(), @Url.Content("~/"));
                    // create tree html

                    ViewBag.culture   = ctx.GetAD_Language();
                    ViewBag.direction = ctx.GetIsRightToLeft() ? "rtl" : "ltr";
                    ctx.SetIsBasicDB(mnuHelper.GetIsBasicDB());

                    mnuHelper.dispose();



                    //Change Authentication
                    model                           = new LoginModel();
                    model.Login1Model               = new Login1Model();
                    model.Login2Model               = new Login2Model();
                    model.Login1Model.UserName      = User.Identity.Name;
                    model.Login1Model.LoginLanguage = ctx.GetAD_Language();

                    model.Login2Model.Role      = ctx.GetAD_Role_ID().ToString();
                    model.Login2Model.Client    = ctx.GetAD_Client_ID().ToString();
                    model.Login2Model.Org       = ctx.GetAD_Org_ID().ToString();
                    model.Login2Model.Warehouse = ctx.GetAD_Warehouse_ID().ToString();


                    var RoleList      = new List <KeyNamePair>();
                    var ClientList    = new List <KeyNamePair>();
                    var OrgList       = new List <KeyNamePair>();
                    var WareHouseList = new List <KeyNamePair>();

                    LoginHelper.Login(model, out RoleList);

                    //  LoginHelper.GetClients(id)

                    ClientList    = LoginHelper.GetClients(ctx.GetAD_Role_ID());                                          // .Add(new KeyNamePair(ctx.GetAD_Client_ID(), ctx.GetAD_Client_Name()));
                    OrgList       = LoginHelper.GetOrgs(ctx.GetAD_Role_ID(), ctx.GetAD_User_ID(), ctx.GetAD_Client_ID()); // .Add(new KeyNamePair(ctx.GetAD_Org_ID(), ctx.GetAD_Org_Name()));
                    WareHouseList = LoginHelper.GetWarehouse(ctx.GetAD_Org_ID());                                         // .Add(new KeyNamePair(ctx.GetAD_Warehouse_ID(), ctx.GetContext("#M_Warehouse_Name")));


                    ViewBag.RoleList      = RoleList;
                    ViewBag.ClientList    = ClientList;
                    ViewBag.OrgList       = OrgList;
                    ViewBag.WarehouseList = WareHouseList;
                    MSession session = MSession.Get(ctx, true);
                }
            }

            else
            {
                model             = new LoginModel();
                model.Login1Model = new Login1Model();
                //model.Login1Model.UserName = "******";
                //model.Login1Model.Password = "******";
                model.Login1Model.LoginLanguage = "en_US";
                model.Login2Model = new Login2Model();

                ViewBag.RoleList      = new List <KeyNamePair>();
                ViewBag.OrgList       = new List <KeyNamePair>();
                ViewBag.WarehouseList = new List <KeyNamePair>();
                ViewBag.ClientList    = new List <KeyNamePair>();
                Session["ctx"]        = null;
                ViewBag.direction     = "ltr";
            }
            return(View(model));
        }
Example #25
0
 public HomeController(DBBlinkContext dBBlinkContext, IHostingEnvironment appEnvironment)
 {
     _dBBlinkContext = dBBlinkContext;
     _appEnvironment = appEnvironment;
     _homeHelper     = new HomeHelper(dBBlinkContext);
 }
 public HomeController(ILogger <HomeController> logger, CCLdbContext context)
 {
     _logger      = logger;
     this.context = context;
     homeHelper   = new HomeHelper(context);
 }
Example #27
0
        public JsonResult GetSubscriptionDaysLeft()
        {
            HomeHelper hel = new HomeHelper();

            return(Json(JsonConvert.SerializeObject(hel.GetSubscriptionDaysLeft(Request.UrlReferrer.ToString())), JsonRequestBehavior.AllowGet));
        }
        public void GetWidgetsData(HttpContext context)
        {
            if (!File.Exists(HostingEnvironment.MapPath("~/App_Data/HomeScreen/HomeScreen.xml")))
            {
                XmlDocument xmlDoc   = new XmlDocument();
                XmlNode     rootNode = xmlDoc.CreateElement("HomeScreen");
                xmlDoc.AppendChild(rootNode);

                var pageNode = CreateHomeNode(xmlDoc);

                rootNode.AppendChild(pageNode);

                xmlDoc.Save(HostingEnvironment.MapPath("~/App_Data/HomeScreen/HomeScreen.xml"));
            }


            StringBuilder sb = new StringBuilder();

            if (File.Exists(HostingEnvironment.MapPath("~/App_Data/HomeScreen/HomeScreen.xml")))
            {
                XmlDocument xmldoc = new XmlDocument();

                bool flag = false;

                using (StreamReader sr = new StreamReader(HostingEnvironment.MapPath("~/App_Data/HomeScreen/HomeScreen.xml")))
                {
                    xmldoc.Load(sr);

                    var node = xmldoc.SelectSingleNode("HomeScreen/HomePage[@ClientName='" + Global.Core.ClientName + "']");

                    if (node != null)
                    {
                        string xml = node.InnerXml;

                        xml = "<HomePage>" + xml + "</HomePage>";

                        context.Response.Write(HomeHelper.XmlToJSON(xml));
                    }
                    else
                    {
                        var pageNode = CreateHomeNode(xmldoc);

                        XmlNode screen = xmldoc.SelectSingleNode("HomeScreen");
                        screen.AppendChild(pageNode);

                        flag = true;

                        string xml = pageNode.InnerXml;

                        xml = "<HomePage>" + xml + "</HomePage>";

                        context.Response.Write(HomeHelper.XmlToJSON(xml));
                    }
                }

                if (flag)
                {
                    xmldoc.Save(HostingEnvironment.MapPath("~/App_Data/HomeScreen/HomeScreen.xml"));
                }
            }

            context.Response.Write(string.Empty);
        }