/// <summary>
        ///   Lazy initialization of the view
        /// </summary>
        /// <returns>Actual view</returns>
        private GenericView GetView()
        {
            lock (LockObject)
            {
                if (view != null)
                {
                    return(view);
                }

                view         = new GenericView();
                view.Closed += (sender, e) =>
                {
                    if (Closed != null)
                    {
                        Closed(sender, e);
                    }

                    view = null;
                };
                view.Closing += (sender, e) =>
                {
                    if (Closing != null)
                    {
                        Closing(sender, e);
                    }
                };
                return(view);
            }
        }
        public string DispatchStudent()
        {
            var view = new GenericView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            var result = dispatchRepo.GetDispatchStudent(Auth.User().Id);

            return view.Show(result);
        }
        public string DispatchStudent()
        {
            var view = new GenericView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            var result = dispatchRepo.GetDispatchStudent(Auth.User().Id);

            return(view.Show(result));
        }
Beispiel #4
0
 private void AddTabs()
 {
     foreach (KeyValuePair <string, GenericController> tab in tabs)
     {
         TabPage     tabPage = new TabPage(tab.Key);
         GenericView view    = tab.Value.view;
         tabPage.Controls.Add(view);
         mainWindow.AddTabPage(tabPage);
     }
 }
Beispiel #5
0
        static void Main(string[] args)
        {
            GenericView view = new GenericView();

            try                  //You can view Customer.csv and Admin.csv for logins but also
            {                    //For Admin            // For User
                view.Login();    // Login: Samia        Login: Meeba
            }                    // Password: abc54     Password:09876
            catch (Exception ex) //Please Wait for 3 seconds after checking each functionality
            {                    //Terminal will automatically go to the Menu,After that,press any key
                WriteLine(ex.Message);
            }
        }
        public void CloseView(GenericView view)
        {
            Form f = this.MdiChildren.FirstOrDefault(v => v.GetType() != view.GetType());

            if (f != null)
            {
                f.Activate();
                HandleActiveView(f as GenericView);

                return;
            }

            HandleActiveView(null);
        }
Beispiel #7
0
        public override bool Handle(RouteDispatchInfo dispatchInfo, ref string message)
        {
            if (dispatchInfo.GenericPairs != null)
            {
                string sessionId = (string) dispatchInfo.GenericPairs[CourseProviderContract.KEY_AUTH];
                if (! TextUtils.isEmpty(sessionId) && Session.Has(sessionId))
                {
                    return true;
                }
            }

            message = new GenericView().Error("Please login first!");

            return false;
        }
Beispiel #8
0
        public string CreateDispatch(int id)
        {
            GenericView view = new GenericView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            Validator validator = new Validator();
            if (!validator.MatchRule(id + "", "required", "id"))
            {
                return view.Error(validator.GetDetail());
            }

            bool Ret = dispatchRepo.JoinCourse(Auth.User().Id, id);

            return Ret ? view.Success() : view.Error();
        }
        public override bool Handle(RouteDispatchInfo dispatchInfo, ref string message)
        {
            string sessionId = dispatchInfo.GenericPairs[CourseProviderContract.KEY_AUTH] as string;

            if (! TextUtils.isEmpty(sessionId))
            {
                var user = Auth.User(sessionId);
                if (user != null && user.Mode == mode)
                {
                    return true;
                }
            }

            message = new GenericView().Error("Access denied!");
            return false;
        }
Beispiel #10
0
        public string RemoveDispatch(string id)
        {
            GenericView view = new GenericView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            Validator validator = new Validator();
            if (!validator.MatchRule(id, "required", "id"))
            {
                return view.Error(validator.GetDetail());
            }

            string[] idArr = id.Split(',');
            bool Ret = dispatchRepo.RemoveCourseList(Auth.User().Id, Array.ConvertAll(idArr, int.Parse));

            return Ret ? view.Success() : view.Error();
        }
Beispiel #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mainForm"></param>
        /// <param name="newForm"></param>
        /// <param name="type"></param>
        public void ShowView(Form mainForm, GenericView newForm, Type type)
        {
            foreach (Form f in mainForm.MdiChildren)
            {
                if (f.GetType() == type)
                {
                    f.Activate();
                    HandleActiveView(f as GenericView);

                    return;
                }
            }
            newForm.MdiParent   = mainForm;
            newForm.WindowState = FormWindowState.Maximized;
            newForm.ShowIcon    = false;
            newForm.Show();

            HandleActiveView(newForm);
            newForm._closeViewCallBack = CloseView;
        }
Beispiel #12
0
 public MajorController()
 {
     view = new GenericView();
     majorRepo = new MajorRepository();
 }
 public UserManagerController()
 {
     view = new GenericView();
     userRepo = new UserRepository();
 }
Beispiel #14
0
 public ControlsBuilder AddView(GenericView genericView)
 {
     _buildedString += genericView.ToString().FirstCharToLower();
     return(this);
 }
 public void HandleActiveView(GenericView view)
 {
     this.CurrentView = view;
 }
Beispiel #16
0
        public static string GetPageView(string templateSuffix, string themeName, string pageTitle, string headerTitle, string helpUrl, string afterAction)
        {
            #region Variables

            bool enableMobileAddress = false;
            int  dataIndex           = 0;

            #endregion

            #region Get JQ Js/Css Resources

            string cssResourcesLink = "";
            string jsResourcesLink  = "";
            string currentThemeName = MobileTheme.Default.ToString();
            if (string.IsNullOrEmpty(themeName) == false)
            {
                currentThemeName = themeName;
            }
            MobileView.GetMobileHeaderResource(enableMobileAddress, currentThemeName, out cssResourcesLink, out jsResourcesLink);

            #endregion

            #region Set Mobile Page Header Html

            string htmlMobilePageHeader = "";  //"<h2>InfoList Manager</h2>";

            #endregion

            #region Get Mobile Page Security Html

            string htmlMobilePageSecure = "";

            htmlMobilePageSecure = SecurityView.GetView(dataIndex, templateSuffix, headerTitle, helpUrl, afterAction, "");

            #endregion

            #region Get Mobile Page Content Html

            string htmlMobilePageContent = "";

            if ((UtilsGeneric.ForceLogin == false) || (UtilsSecurity.IsAuthenticated() == true))
            {
                if (UtilsSecurity.HaveAdminRole() == true)
                {
                    string infoCategoryView = InfoCategoryView.GetView(dataIndex, templateSuffix);
                    htmlMobilePageContent += infoCategoryView;
                }

                string pageView = InfoPageView.GetView(dataIndex + 1, templateSuffix);
                htmlMobilePageContent += pageView;
            }

            #endregion

            #region Get Mobile Page Html

            string htmlMobilePage = MobileView.GetView(templateSuffix, htmlMobilePageHeader, htmlMobilePageSecure, htmlMobilePageContent, "");

            #endregion

            #region Get IndexPage Header Html

            string htmlPageHeader = "";

            #endregion

            #region Get IndexPage Content Html

            string htmlPageContent = htmlMobilePage;

            #endregion

            #region Get IndexPage Footer Html

            string htmlPageFooter = "";

            #endregion

            #region Get IndexPage Html

            string htmlText = GenericView.GetView(templateSuffix, pageTitle, cssResourcesLink, jsResourcesLink, htmlPageHeader, htmlPageContent, htmlPageFooter, enableMobileAddress, true);

            #endregion

            return(htmlText);
        }
 public void Close()
 {
     GetView().Close();
     view = null;
 }
 public DispatchManageController()
 {
     view = new GenericView();
     dispatchMgrRepo = new DispatchManageRepository();
 }