コード例 #1
0
 public override int AddModuleControl(ModuleControlInfo moduleControl)
 {
     return (int)SqlHelper.ExecuteScalar(this.ConnectionString, "Portal_ModuleControls_Insert", moduleControl.ModuleID,
                 moduleControl.ControlName, moduleControl.ControlTitle, moduleControl.ControlKey, moduleControl.ControlPath,
           moduleControl.ControlRole, moduleControl.ControlIcon, moduleControl.ControlDescription, moduleControl.ControlOrder,
                                          moduleControl.ControlHeader);
 }
コード例 #2
0
        public void InstantiateIn(Control container)
        {
            DataTable         dtCurrentRoles = null;
            ModuleControlInfo moduleControl  = ModuleControlController.GetModuleControl(ControlID);

            if (moduleControl == null)
            {
                return;
            }
            if (moduleControl.ControlRole == string.Empty)
            {
                container.Controls.Add(this);
                return;
            }
            else if (CurrentUser != null)
            {
                dtCurrentRoles = RoleController.GetRoles(CurrentUser.UserID);
                string[] roleList = moduleControl.ControlRole.Split("|".ToCharArray());
                for (int i = 0; i < roleList.Length; i++)
                {
                    if (dtCurrentRoles.Select("RoleID = " + roleList[i]).Length > 0)
                    {
                        container.Controls.Add(this);
                    }
                }
            }
        }
コード例 #3
0
 public static int AddModuleControl(ModuleControlInfo moduleControl)
 {
     int id = DataAccessProvider.Instance().AddModuleControl(moduleControl);
     DataCaching data = new DataCaching();
     data.RemoveCache(key);
     return id;
 }
コード例 #4
0
        public static void UpdateModuleControl(ModuleControlInfo moduleControl)
        {
            DataAccessProvider.Instance().UpdateModuleControl(moduleControl);
            DataCaching data = new DataCaching();

            data.RemoveCache(key);
        }
コード例 #5
0
        public static int AddModuleControl(ModuleControlInfo moduleControl)
        {
            int         id   = DataAccessProvider.Instance().AddModuleControl(moduleControl);
            DataCaching data = new DataCaching();

            data.RemoveCache(key);
            return(id);
        }
コード例 #6
0
        public static ModuleControlInfo GetModuleControl(string controlKey)
        {
            string            param   = "GetModuleControl?controlKey=" + controlKey.ToString();
            DataCaching       data    = new DataCaching();
            ModuleControlInfo setting = (ModuleControlInfo)data.GetHashCache(key, param);

            if (setting != null)
            {
                return(setting);
            }
            setting = DataAccessProvider.Instance().GetModuleControl(controlKey);
            data.SetHashCache(key, param, AppEnv.GetTimeCacheExpire(), setting);
            return(setting);
        }
コード例 #7
0
 public override void UpdateModuleControl(ModuleControlInfo moduleControl)
 {
     SqlHelper.ExecuteNonQuery(this.ConnectionString, "Portal_ModuleControls_Update", moduleControl.ControlID, moduleControl.ModuleID, moduleControl.ControlName,
                              moduleControl.ControlTitle, moduleControl.ControlKey, moduleControl.ControlPath, moduleControl.ControlRole,
                                                                              moduleControl.ControlIcon, moduleControl.ControlDescription, moduleControl.ControlOrder, moduleControl.ControlHeader);
 }
コード例 #8
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {

                if (controlId == 0) // add control
                {
                    if (txtControlKey.Text != string.Empty && ModuleControlController.CheckExistsControlKey(txtControlKey.Text))
                    {
                        this.lblUpdateStatus.Text = MiscUtility.MSG_CONTROKEY_EXISTS;
                        return;
                    }
                    ModuleInfo module = ModuleController.GetModule(moduleId);
                    if (module == null) return;
                    ModuleControlInfo moduleControl = new ModuleControlInfo();
                    moduleControl.ModuleID = module.ModuleID;
                    moduleControl.ControlName = txtControlName.Text.Trim();
                    moduleControl.ControlKey = txtControlKey.Text.Trim();
                    moduleControl.ControlPath = dropPath.SelectedValue;
                    moduleControl.ControlIcon = txtControlIcon.Text.Trim();
                    moduleControl.ControlOrder = ConvertUtility.ToInt32(dropControlOrder.SelectedValue);
                    moduleControl.ControlHeader = chkControlHeader.Checked;
                    string roleList = "|";
                    foreach (ListItem item in chkControlType.Items)
                    {
                        if (item.Selected)
                            roleList += item.Value + "|";
                    }
                    if (roleList.Length < 2) roleList = string.Empty;
                    moduleControl.ControlTitle = txtControlTitle.Text;
                    moduleControl.ControlRole = roleList;
                    moduleControl.ControlDescription = txtControlDescription.Text.Trim();

                    ModuleControlController.AddModuleControl(moduleControl);
                }
                else // update control
                {
                    ModuleControlInfo moduleControl = ModuleControlController.GetModuleControl(controlId);
                    moduleControl.ControlName = txtControlName.Text.Trim();
                    moduleControl.ControlDescription = txtControlDescription.Text;
                    moduleControl.ControlKey = txtControlKey.Text.Trim();
                    moduleControl.ControlPath = dropPath.SelectedValue;
                    moduleControl.ControlIcon = txtControlIcon.Text.Trim();
                    moduleControl.ControlOrder = ConvertUtility.ToInt32(dropControlOrder.SelectedValue);
                    string roleList = "|";
                    foreach (ListItem item in chkControlType.Items)
                    {
                        if (item.Selected)
                            roleList += item.Value + "|";
                    }
                    //if (roleList.Length < 2) roleList = string.Empty;
                    moduleControl.ControlRole = roleList;
                    moduleControl.ControlDescription = txtControlDescription.Text.Trim();
                    moduleControl.ControlHeader = chkControlHeader.Checked;
                    ModuleControlController.UpdateModuleControl(moduleControl);
                }
                this.lblUpdateStatus.Text = MiscUtility.MSG_UPDATE_SUCCESS;
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
コード例 #9
0
 public static void UpdateModuleControl(ModuleControlInfo moduleControl)
 {
     DataAccessProvider.Instance().UpdateModuleControl(moduleControl);
     DataCaching data = new DataCaching();
     data.RemoveCache(key);
 }