Exemplo n.º 1
0
        public static SysMenuGroup PopulateSysMenuGroup(IDataReader reader)
        {
            SysMenuGroup item = new SysMenuGroup();

            item.MgID   = (short)reader["Mg_ID"];
            item.MgName = reader["Mg_Name"] as string;
            if (reader["Mg_Tip"] != DBNull.Value)
            {
                item.MgTip = reader["Mg_Tip"] as string;
            }
            if (reader["Mg_Normal_Icon"] != DBNull.Value)
            {
                item.MgNormalIcon = reader["Mg_Normal_Icon"] as string;
            }
            if (reader["Mg_Hot_Icon"] != DBNull.Value)
            {
                item.MgHotIcon = reader["Mg_Hot_Icon"] as string;
            }
            if (reader["Mg_Disable_Icon"] != DBNull.Value)
            {
                item.MgDisableIcon = reader["Mg_Disable_Icon"] as string;
            }
            item.MgIconIndex = (short)reader["Mg_Icon_Index"];
            if (reader["Mg_Function"] != DBNull.Value)
            {
                item.MgFunction = reader["Mg_Function"] as string;
            }
            item.MgStatus = (short)reader["Mg_Status"];
            item.MgOrder  = (short)reader["Mg_Order"];

            return(item);
        }
Exemplo n.º 2
0
        public static void CreateUpdateDeleteSysMenuGroup(SysMenuGroup item, DataProviderAction action)
        {
            if (item == null)
            {
                return;
            }

            SqlConnection conn = DBUtils.GetConnection();
            SqlCommand    cmd  = DBUtils.GetCommand();

            try
            {
                cmd.Transaction = conn.BeginTransaction();

                ArrayList paras = new ArrayList();

                paras.Add(DBUtils.MakeInParam("@Mg_ID", SqlDbType.SmallInt, item.MgID));
                paras.Add(DBUtils.MakeInParam("@Mg_Name", SqlDbType.NVarChar, 40, item.MgName));
                paras.Add(DBUtils.MakeInParam("@Mg_Tip", SqlDbType.NVarChar, 80, item.MgTip));
                paras.Add(DBUtils.MakeInParam("@Mg_Normal_Icon", SqlDbType.NVarChar, 32, item.MgNormalIcon));
                paras.Add(DBUtils.MakeInParam("@Mg_Hot_Icon", SqlDbType.NVarChar, 32, item.MgHotIcon));
                paras.Add(DBUtils.MakeInParam("@Mg_Disable_Icon", SqlDbType.NVarChar, 32, item.MgDisableIcon));
                paras.Add(DBUtils.MakeInParam("@Mg_Icon_Index", SqlDbType.SmallInt, item.MgIconIndex));
                paras.Add(DBUtils.MakeInParam("@Mg_Function", SqlDbType.NVarChar, 64, item.MgFunction));
                paras.Add(DBUtils.MakeInParam("@Mg_Status", SqlDbType.SmallInt, item.MgStatus));
                paras.Add(DBUtils.MakeInParam("@Mg_Order", SqlDbType.SmallInt, item.MgOrder));
                paras.Add(DBUtils.MakeInParam("@Action", SqlDbType.Int, action));

                DBUtils.ExecuteNonQuery(conn, cmd, CommandType.StoredProcedure, PublicConsts.DatabaseOwner + ".P_CreateUpdateDelete_SysMenuGroup", paras);

                cmd.Transaction.Commit();
            }
            catch
            {
                cmd.Transaction.Rollback();
                throw;
            }
            finally
            {
                DBUtils.SetDispose(conn, cmd);
            }
        }
Exemplo n.º 3
0
        public static SysMenuGroup GetSysMenuGroup(short mgid)
        {
            SysMenuGroup item = new SysMenuGroup();

            try
            {
                ArrayList paras = new ArrayList();
                paras.Add(DBUtils.MakeInParam("@Mg_ID", SqlDbType.SmallInt, mgid));
                paras.Add(DBUtils.MakeInParam("@Get_Action", SqlDbType.NVarChar, 10, DataGetAction.Row.ToString().ToLower()));

                SqlDataReader reader = DBUtils.ExecuteReader(CommandType.StoredProcedure, PublicConsts.DatabaseOwner + ".P_Get_SysMenuGroup", paras);

                if (reader.Read())
                {
                    item = PopulateSysMenuGroup(reader);
                }

                reader.Close();
            }
            catch { throw; }

            return(item);
        }
Exemplo n.º 4
0
        public static void GetManMenus(UserCache uc, string manid)
        {
            if (uc == null)
            {
                return;
            }

            SysMenuGroups ag = uc.Menus;
            SysMenu       fm;
            SysMenuGroup  fg;

            RibTabs  rts = uc.Ribbons;
            RibTab   rt;
            RibPanel rp;

            try
            {
                ArrayList paras = new ArrayList();
                paras.Add(DBUtils.MakeInParam("@Man_ID", SqlDbType.NVarChar, 6, manid));

                SqlDataReader reader = DBUtils.ExecuteReader(CommandType.StoredProcedure, PublicConsts.DatabaseOwner + ".P_Get_Man_Menus", paras);

                #region Read MenuGroups

                while (reader.Read())
                {
                    SysMenuGroup mgItem = new SysMenuGroup();

                    mgItem.MgID   = (short)reader["mg_id"];
                    mgItem.MgName = reader["mg_name"] as string;

                    if (reader["mg_tip"] != DBNull.Value)
                    {
                        mgItem.MgTip = reader["mg_tip"] as string;
                    }

                    if (reader["mg_normal_icon"] != DBNull.Value)
                    {
                        mgItem.MgNormalIcon = reader["mg_normal_icon"] as string;
                    }

                    if (reader["mg_hot_icon"] != DBNull.Value)
                    {
                        mgItem.MgHotIcon = reader["mg_hot_icon"] as string;
                    }

                    if (reader["mg_disable_icon"] != DBNull.Value)
                    {
                        mgItem.MgDisableIcon = reader["mg_disable_icon"] as string;
                    }

                    mgItem.MgIconIndex = (short)reader["mg_icon_index"];

                    if (reader["mg_function"] != DBNull.Value)
                    {
                        mgItem.MgFunction = reader["mg_function"] as string;
                    }

                    mgItem.MgStatus = (short)reader["mg_status"];
                    mgItem.MgOrder  = (short)reader["mg_order"];

                    ag.Add(mgItem);
                }

                #endregion Read MenuGroups

                #region Read Menus

                if (reader.NextResult() && (ag.Count > 0))
                {
                    while (reader.Read())
                    {
                        if ((fg = ag.FindByGroupID((short)reader["mg_id"])) != null)
                        {
                            if ((fm = fg.Menus.FindSubMenu((short)reader["m_id"])) != null)
                            {
                                fm.MAuth = (int)((AuthType)fm.MAuth | (AuthType)((int)reader["menu_auth"]));
                                continue;
                            }
                        }

                        SysMenu mItem = new SysMenu();

                        mItem.MID    = (short)reader["m_id"];
                        mItem.MName  = reader["m_name"] as string;
                        mItem.MPID   = (short)reader["m_pid"];
                        mItem.MgID   = (short)reader["mg_id"];
                        mItem.MLevel = (short)reader["m_level"];
                        mItem.MDisp  = (short)reader["m_disp"];
                        mItem.MAuth  = (int)reader["menu_auth"];

                        if (reader["m_tip"] != DBNull.Value)
                        {
                            mItem.MTip = reader["m_tip"] as string;
                        }

                        if (reader["m_function"] != DBNull.Value)
                        {
                            mItem.MFunction = reader["m_function"] as string;
                        }

                        mItem.IsLine = Convert.ToBoolean(reader["is_line"]);
                        mItem.IsSub  = Convert.ToBoolean(reader["is_sub"]);

                        if (reader["m_sid"] != DBNull.Value)
                        {
                            mItem.MSID = (short)reader["m_sid"];
                        }

                        if (reader["m_normal_icon"] != DBNull.Value)
                        {
                            mItem.MNormalIcon = reader["m_normal_icon"] as string;
                        }

                        if (reader["m_hot_icon"] != DBNull.Value)
                        {
                            mItem.MHotIcon = reader["m_hot_icon"] as string;
                        }

                        if (reader["m_disable_icon"] != DBNull.Value)
                        {
                            mItem.MDisableIcon = reader["m_disable_icon"] as string;
                        }

                        mItem.MIconIndex = (short)reader["m_icon_index"];
                        mItem.IsBase     = Convert.ToBoolean(reader["is_base"]);
                        mItem.MCode      = reader["m_code"] as string;
                        mItem.MStatus    = (short)reader["m_status"];

                        if (reader["M_Shortcut"] != DBNull.Value)
                        {
                            mItem.MShortcut = reader["M_Shortcut"] as string;
                        }

                        if (fg != null)
                        {
                            if (mItem.MID != mItem.MPID)
                            {
                                fm = fg.Menus.FindSubMenu(mItem.MPID);

                                if (fm != null)
                                {
                                    fm.SubMenus.Add(mItem);
                                }
                            }
                            else
                            {
                                fg.Menus.Add(mItem);
                            }
                        }
                    }
                }

                #endregion Read Menus

                #region Read Ribbon Tabs

                if (reader.NextResult() && (ag.Count > 0))
                {
                    while (reader.Read())
                    {
                        RibTab rtItem = new RibTab();
                        rtItem.ID         = (short)reader["Rib_Tab"];
                        rtItem.RibTabName = reader["Rib_Tab_Name"] as string;
                        rtItem.RibOrder   = (short)reader["Rib_Order"];

                        rts.Add(rtItem);
                    }
                }

                #endregion Read Ribbon Tabs

                #region Read Ribbon Panels

                if (reader.NextResult() && (ag.Count > 0))
                {
                    while (reader.Read())
                    {
                        rt = rts.FindByRibTab((short)reader["Rib_Tab"]);
                        if (rt == null)
                        {
                            continue;
                        }

                        RibPanel rpItem = new RibPanel();
                        rpItem.ID           = (short)reader["Rib_Panel"];
                        rpItem.RibPanelName = reader["Rib_Panel_Name"] as string;
                        rpItem.RibOrder     = (short)reader["Rib_Order"];
                        rpItem.RibTab       = (short)reader["Rib_Tab"];

                        rt.Panels.Add(rpItem);
                    }
                }

                #endregion Read Ribbon Panels

                #region Read Ribbon Buttons

                if (reader.NextResult() && (ag.Count > 0))
                {
                    while (reader.Read())
                    {
                        rt = rts.FindByRibTab((short)reader["Rib_Tab"]);
                        if (rt == null)
                        {
                            continue;
                        }

                        rp = rt.Panels.FindByRibPanel((short)reader["Rib_Panel"]);
                        if (rp == null)
                        {
                            continue;
                        }

                        RibButton rbItem = new RibButton();
                        rbItem.RibBtn     = (short)reader["Rib_Btn"];
                        rbItem.RibBtnName = reader["Rib_Btn_Name"] as string;
                        rbItem.RibBtnType = (short)reader["Rib_Btn_Type"];
                        rbItem.RibOrder   = (short)reader["Rib_Order"];
                        rbItem.RibPanel   = (short)reader["Rib_Panel"];
                        rbItem.RibTab     = (short)reader["Rib_Tab"];
                        if (reader["Rib_Image"] != DBNull.Value)
                        {
                            rbItem.RibImage = reader["Rib_Image"] as string;
                        }
                        rbItem.RibImageIndex = (short)reader["Rib_Image_Index"];
                        if (reader["M_Function"] != DBNull.Value)
                        {
                            rbItem.MFunction = reader["M_Function"] as string;
                        }
                        if (reader["M_Code"] != DBNull.Value)
                        {
                            rbItem.MCode = reader["M_Code"] as string;
                        }
                        rbItem.MID = (short)reader["M_ID"];
                        if (reader["Rib_Code"] != DBNull.Value)
                        {
                            rbItem.RibCode = reader["Rib_Code"] as string;
                        }

                        rp.Buttons.Add(rbItem);
                    }
                }

                #endregion Read Ribbon Buttons

                reader.Close();
            }
            catch { throw; }
        }
Exemplo n.º 5
0
 public void Add(SysMenuGroup item)
 {
     base.List.Add(item);
 }