Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value))
            {
                this.currentEntity = new Module();
            }
            else
            {
                this.currentEntity = this.ownerPage.AdminClientRef.GetModuleByID(this.hdnRowMasterKey.Value);

                if (this.currentEntity == null)
                {
                    this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Setting_Not_Found_By_ID"), this.hdnRowMasterKey.Value);
                    this.ownerPage.FormLoad();
                    return;
                }

            }


            currentEntity.ModuleName = this.tbxModuleName.Text;
            currentEntity.ModuleSysName = this.tbxModuleSysName.Text;
            currentEntity.Comment = this.tbxComment.Text;
            currentEntity.NeedCheck = this.chbxNeedCheck.Checked;

            CallContext resultContext = new CallContext();

            resultContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;

            resultContext = this.ownerPage.AdminClientRef.ModuleSave(currentEntity, resultContext);

            this.lbResultContext.Text = resultContext.Message;
            this.hdnRowMasterKey.Value = resultContext.EntityID;
            this.CurrentEntityMasterID = resultContext.EntityID;


            this.ownerPage.ReloadModuleDataViewApplication();

            this.ownerPage.FormLoad();

        }
Ejemplo n.º 2
0
        public override void UserControlLoad()
        {
            if (this.ownerPage == null)
            {
                throw new UMSException("Current Page is null or is not inheritor of BasicPage.");
            }


            this.pnlFormData.Visible = true;
            this.currentEntity = this.ownerPage.AdminClientRef.GetModuleByID(this.CurrentEntityMasterID);

            if (currentEntity != null)
            {

                this.tbxModuleName.Text = currentEntity.ModuleName;
                this.tbxModuleSysName.Text = currentEntity.ModuleSysName;
                this.tbxComment.Text = currentEntity.Comment;
                this.chbxNeedCheck.Checked = currentEntity.NeedCheck;

                this.hdnRowMasterKey.Value = currentEntity.EntityID.ToString();

            }
            else
            {
                this.lbResultContext.Text = "";

                this.tbxModuleName.Text = string.Empty;
                this.tbxModuleSysName.Text = string.Empty;
                this.tbxComment.Text = string.Empty;
                this.chbxNeedCheck.Checked = false;


                this.hdnRowMasterKey.Value = string.Empty;
            }


        }
Ejemplo n.º 3
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);



            ///Страници, които не изискват login
            if (
                this.UserProps == null &&

                this.CurrentPageFullName() != Share.Login.formResource.PageFullName

                )
            {
                Response.Redirect(Share.Login.formResource.PagePath);
            }


            UserProps userProps = GetOnlineUsers().Where(s => s.SessionID == this.Session.SessionID).FirstOrDefault() as UserProps;

            if (userProps != null && userProps.IsKilled)
            {
                Session.RemoveAll();
                Session.Abandon();
                Response.Redirect(Share.Login.formResource.PagePath);
            }


            if (userProps != null && CurrentPagePath() != OnlineUsersList.formResource.PagePath)
            {
                userProps.LastPageName = CurrentPagePath();

                ModuleDataView module = DictionaryModules.Where(m => m.Key == CurrentModule()).FirstOrDefault().Value;

                MenuNodeDataView node = null;

                if (FormContext.QueryString["Node"] != null)
                {
                    node = DictionaryMenuNodes.Where(m => m.Key == FormContext.QueryString["Node"].ToString()).FirstOrDefault().Value;
                }

                if (module != null)
                {
                    userProps.LastModuleName = module.ModuleName;
                }

                if (node != null)
                {
                    userProps.LastPageName = node.name;
                }
            }

            #region filter by ip



            this.currentModuleObject = this.AdminClientRef.GetModuleBySysName(this.CurrentModule());

            if (this.CurrentPageFullName() != Share.Login.formResource.PageFullName &&
                this.currentModuleObject != null &&
                this.currentModuleObject.NeedCheck && !Request.UserHostAddress.Equals("::1"))
            {
                AllowIP allowIP = this.AdminClientRef.GetEntityByIPAddress(Request.UserHostAddress);

                if (allowIP == null || !allowIP.Allow)
                {
                    Response.Redirect("~/UI/InternalPageInfo.aspx");
                }
            }

            #endregion

            #region filter by modules

            List <string> listPermittedModules = new List <string>()
            {
                Constants.MODULE_NOMENCLATURES,
                Constants.MODULE_SUPPORT_HISTORY,
                Constants.MODULE_SETTINGS,
                Constants.MODULE_PERMISSION,
                Constants.MODULE_INOUTDOCUMENT,
            };

            if (this.CurrentPageFullName() != Share.Login.formResource.PageFullName &&

                currentModuleObject != null && this.UserProps.Roles.Any(a => a.Name == "VIEW") &&
                listPermittedModules.Any(s => s == currentModuleObject.ModuleSysName))
            {
                Response.Redirect("~/UI/InternalPageInfo.aspx");
            }


            #endregion


            if (!IsPostBack)
            {
                InitReloadParentPageControl();
            }

            AjaxControlToolkit.ToolkitScriptManager.RegisterClientScriptBlock(this,
                                                                              this.GetType(),
                                                                              "IsNumeric",
                                                                              BaseHelper.JS_SCRIPT_IS_NUMERIC,
                                                                              false);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a new Module object.
 /// </summary>
 /// <param name="idModule">Initial value of the idModule property.</param>
 /// <param name="moduleName">Initial value of the ModuleName property.</param>
 /// <param name="moduleSysName">Initial value of the ModuleSysName property.</param>
 /// <param name="needCheck">Initial value of the NeedCheck property.</param>
 public static Module CreateModule(global::System.Int32 idModule, global::System.String moduleName, global::System.String moduleSysName, global::System.Boolean needCheck)
 {
     Module module = new Module();
     module.idModule = idModule;
     module.ModuleName = moduleName;
     module.ModuleSysName = moduleSysName;
     module.NeedCheck = needCheck;
     return module;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Modules EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToModules(Module module)
 {
     base.AddObject("Modules", module);
 }
Ejemplo n.º 6
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);




            ///Страници, които не изискват login
            if (
                this.UserProps == null &&

                this.CurrentPageFullName() != Share.Login.formResource.PageFullName

                )
            {
                Response.Redirect(Share.Login.formResource.PagePath);
            }


            UserProps userProps = GetOnlineUsers().Where(s => s.SessionID == this.Session.SessionID).FirstOrDefault() as UserProps;

            if (userProps != null && userProps.IsKilled)
            {

                Session.RemoveAll();
                Session.Abandon();
                Response.Redirect(Share.Login.formResource.PagePath);
            }


            if (userProps != null && CurrentPagePath() != OnlineUsersList.formResource.PagePath)
            {
                userProps.LastPageName = CurrentPagePath();

                ModuleDataView module = DictionaryModules.Where(m => m.Key == CurrentModule()).FirstOrDefault().Value;

                MenuNodeDataView node = null;

                if (FormContext.QueryString["Node"] != null)
                {
                    node = DictionaryMenuNodes.Where(m => m.Key == FormContext.QueryString["Node"].ToString()).FirstOrDefault().Value;
                }

                if (module != null)
                {
                    userProps.LastModuleName = module.ModuleName;
                }

                if (node != null)
                {
                    userProps.LastPageName = node.name;
                }

            }

            #region filter by ip



            this.currentModuleObject = this.AdminClientRef.GetModuleBySysName(this.CurrentModule());

            if (this.CurrentPageFullName() != Share.Login.formResource.PageFullName &&
                this.currentModuleObject != null &&
                this.currentModuleObject.NeedCheck && !Request.UserHostAddress.Equals("::1"))
            {


                AllowIP allowIP = this.AdminClientRef.GetEntityByIPAddress(Request.UserHostAddress);

                if (allowIP == null || !allowIP.Allow)
                {

                    Response.Redirect("~/UI/InternalPageInfo.aspx");

                }
            }

            #endregion

            #region filter by modules

            List<string> listPermittedModules = new List<string>()
            {
               Constants.MODULE_NOMENCLATURES,
               Constants.MODULE_SUPPORT_HISTORY, 
               Constants.MODULE_SETTINGS,
               Constants.MODULE_PERMISSION, 
               Constants.MODULE_INOUTDOCUMENT,
               
            };

            if (this.CurrentPageFullName() != Share.Login.formResource.PageFullName &&
                
                currentModuleObject != null && this.UserProps.Roles.Any(a => a.Name == "VIEW") &&
                 listPermittedModules.Any(s => s == currentModuleObject.ModuleSysName))
            {
                Response.Redirect("~/UI/InternalPageInfo.aspx");
            }


            #endregion


            if (!IsPostBack)
            {
                InitReloadParentPageControl();
            }

            AjaxControlToolkit.ToolkitScriptManager.RegisterClientScriptBlock(this,
                                                                              this.GetType(),
                                                                              "IsNumeric",
                                                                              BaseHelper.JS_SCRIPT_IS_NUMERIC,
                                                                              false);
        }