示例#1
0
文件: MI_Help.cs 项目: nerai/CMenu
        private void DisplayHelp(string arg, CMenuItem context, bool isInner)
        {
            if (arg == null) {
                throw new ArgumentNullException ("arg");
            }
            if (context == null) {
                throw new ArgumentNullException ("context");
            }

            if (string.IsNullOrEmpty (arg)) {
                if (!DisplayItemHelp (context, !context.Any ())) {
                    DisplayAvailableCommands (context, isInner);
                }
                return;
            }

            var cmd = arg;
            var inner = context.GetMenuItem (ref cmd, out arg, false, false, false);
            if (inner != null) {
                DisplayHelp (arg, inner, true);
                return;
            }

            OnWriteLine ("Could not find inner command \"" + cmd + "\".");
            if (context.Selector != null) {
                OnWriteLine ("Help for " + context.Selector + ":");
            }
            DisplayItemHelp (context, true);
        }
示例#2
0
        public ActionResult InsertSubMenu(string menuId, string Id, string subMenuId)
        {
            ViewBag.Languages = ConfigurationManager.AppSettings["Languages"].Split(',').ToList();
            DbDataContext db = new DbDataContext("CloudAppWebSite");

            int orgId = GetOrganizationId();

            if (orgId == 0)
            {
                return(Redirect("/blog/Admin/Home/Index"));
            }
            int userId       = GetUserId();
            int intMenuId    = Convert.ToInt32(menuId);
            int intId        = Convert.ToInt32(Id);
            int intSubMenuId = Convert.ToInt32(subMenuId);

            ViewBag.QueryMenuId    = intMenuId;
            ViewBag.QueryId        = intId;
            ViewBag.QuerySubMenuId = intSubMenuId;

            ViewBag.BreadCrumbList = GetBreadCrumbList(Id, menuId).OrderBy(item => item.Level).ToList();
            CMenuItem mMenuItem = new CMenuItem();

            if (intSubMenuId != 0)
            {
                int reelSubId = Convert.ToInt32(subMenuId);
                mMenuItem = db.MenuItems.Where(p => p.OrganizationId == orgId && p.ActiveStatus == EActiveStatus.Active && p.Id == reelSubId).FirstOrDefault();
                if (mMenuItem != null)
                {
                    ViewBag.MenuType   = (int)mMenuItem.MenuType;
                    ViewBag.TextId     = mMenuItem.TextId.HasValue == true ? mMenuItem.TextId.Value : 0;
                    ViewBag.CategoryId = mMenuItem.CategoryId.HasValue == true ? mMenuItem.CategoryId.Value : 0;
                    return(View(mMenuItem));
                }
                else
                {
                    InsertAlert(new ViewAlert {
                        AlertType = EAlertType.Warning, Title = "Uyarı", Desc = "Yetkisiz Giriş"
                    });
                    return(RedirectToAction("Dashboard", "Home"));
                }
            }
            else
            {
                ViewBag.MenuType   = 0;
                ViewBag.TextId     = 0;
                ViewBag.CategoryId = 0;
                mMenuItem          = new CMenuItem();
            }

            return(View(mMenuItem));
        }
示例#3
0
		private static bool DisplayItemHelp (CMenuItem item, bool force)
		{
			if (item == null) {
				throw new ArgumentNullException ("item");
			}

			if (item.HelpText == null) {
				if (force) {
					Console.WriteLine ("No help available for " + item.Selector);
				}
				return false;
			}
			else {
				Console.WriteLine (item.HelpText);
				return true;
			}
		}
示例#4
0
    // Update is called once per frame
    void Update()
    {
        // Check the "mouse over"
        Transform tr         = ThrowRaycastAgainstMenu();
        CMenuItem menuScript = null;

        if (tr != null)
        {
            menuScript = tr.gameObject.GetComponent <CMenuItem>();
            menuScript.OnMouseOverItem();
        }

        // Check mouse click
        if ((Input.GetMouseButton(0)) && (tr != null) && (menuScript != null))
        {
            menuScript.OnMouseClickItem();
        }
    }
示例#5
0
文件: MI_Help.cs 项目: nerai/Nibbler
        private static bool DisplayItemHelp(CMenuItem item, bool force)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (item.HelpText == null)
            {
                if (force)
                {
                    Console.WriteLine("No help available for " + item.Selector);
                }
                return(false);
            }
            else
            {
                Console.WriteLine(item.HelpText);
                return(true);
            }
        }
示例#6
0
文件: MI_Help.cs 项目: nerai/CMenu
        private void DisplayAvailableCommands(CMenuItem menu, bool inner)
        {
            if (menu == null) {
                throw new ArgumentNullException ("menu");
            }

            if (!inner) {
                OnWriteLine ("Available commands:");
            }
            var abbreviations = menu.CommandAbbreviations ().OrderBy (it => it.Key);
            foreach (var ab in abbreviations) {
                if (ab.Value == null) {
                    OnWrite ("      ");
                }
                else {
                    OnWrite (ab.Value.PadRight (3) + " | ");
                }
                OnWriteLine (ab.Key);
            }
            if (!inner) {
                OnWriteLine ("Type \"help <command>\" for individual command help.");
            }
        }
示例#7
0
        void AddButtonInToolBar(XmlDocument xmldoc)
        {
            XmlNodeList btnNodes = xmldoc.SelectNodes("/root/Action/Buttons/Button");

            if (btnNodes == null)
            {
                return;
            }
            foreach (XmlNode node in btnNodes)
            {
                CMenuItem mnu     = new CMenuItem(frm.strUid);
                XmlNode   evtnode = node.SelectSingleNode("evt");
                if (evtnode == null)
                {
                    mnu.MnuName   = XmlUtil.GetSubNodeText(node, ".");
                    mnu.LinkValue = XmlUtil.GetSubNodeText(node, "@onclick");
                    mnu.MnuId     = XmlUtil.GetSubNodeText(node, "@id");
                }
                else
                {
                    mnu = MenuProcess.GetMenu(null, evtnode, frm.strUid);
                }

                toolbarbld.AddToolBarItem(mnu, ToolBarItemType.Button, frm.ToolBarBtn_Click);
                toolbarbld.AddToolBarItem(null, ToolBarItemType.Separator);

                /* //用AddToolBarItem替代,期待实现
                 * ToolStripItem tsi;
                 * tsi = new ToolStripButton(mnu.MnuName);
                 * tsi.Tag = mnu;
                 * tsi.Click += new EventHandler(ToolBarBtn_Click);
                 * if (this.toolStrip1.Items.Count > 0)
                 *  this.toolStrip1.Items.Add(new ToolStripSeparator());
                 * this.toolStrip1.Items.Add(tsi);*/
            }
        }
示例#8
0
文件: MI_Help.cs 项目: nerai/Nibbler
        private static void DisplayHelp(string arg, CMenuItem context, bool isInner)
        {
            if (arg == null)
            {
                throw new ArgumentNullException("arg");
            }
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (string.IsNullOrEmpty(arg))
            {
                if (!DisplayItemHelp(context, !context.Any()))
                {
                    DisplayAvailableCommands(context, isInner);
                }
                return;
            }

            var cmd   = arg;
            var inner = context.GetMenuItem(ref cmd, out arg, false, false, false);

            if (inner != null)
            {
                DisplayHelp(arg, inner, true);
                return;
            }

            Console.WriteLine("Could not find inner command \"" + cmd + "\".");
            if (context.Selector != null)
            {
                Console.WriteLine("Help for " + context.Selector + ":");
            }
            DisplayItemHelp(context, true);
        }
示例#9
0
        void AddComboInToolBar(XmlDocument xmldoc)
        {
            XmlNode cmbNode = xmldoc.SelectSingleNode("/root/MainFrmComboSel/MainFrmCbx");

            if (cmbNode == null)
            {
                return;
            }
            //this.toolStrip1.Items.Add(new ToolStripLabel(XmlUtil.GetSubNodeText(cmbNode, "@caption")));
            //ToolStripComboBox combobox = new ToolStripComboBox("查看");
            //            combobox.SelectedIndexChanged += new EventHandler(combobox_SelectedIndexChanged);

            toolbarbld.AddToolBarItem(XmlUtil.GetSubNodeText(cmbNode, "@caption"), ToolBarItemType.Label);
            toolbarbld.AddToolBarItem("查看", ToolBarItemType.Combox);

            foreach (XmlNode node in cmbNode.SelectNodes("item"))
            {
                CMenuItem mnu = new CMenuItem(frm.strUid);
                mnu.MnuName   = XmlUtil.GetSubNodeText(node, ".");
                mnu.LinkValue = XmlUtil.GetSubNodeText(node, "@queryString");
                //combobox.Items.Add(mnu.MnuName);
            }
            //this.toolStrip1.Items.Add(combobox);
        }
示例#10
0
        public static bool switchToView(IXContainerControl container, IKeyForm Link, CMenuItem mnu, ref UpdateData data, List <UpdateData> injectedatas)
        {
            if (mnu == null)
            {
                return(false);
            }
            if (mnu.LinkValue == null || mnu.LinkValue.Trim().Length == 0)
            {
                return(false);
            }

            Type tFrm = Appasmb.GetType(string.Format(mnu.LinkValue, GlobalShare.SystemAppInfo.AssemName));

            if (true)
            {
                if (tFrm == null)
                {
                    MessageBox.Show(string.Format("未找到类{0}!", mnu.LinkValue));
                    return(false);
                }
            }
            if (mnu.linkType == LinkType.WebPage)
            {
                if (AllModules.ContainsKey(mnu.MnuId))
                {
                    container.CurrMainControl = AllModules[mnu.MnuId];
                    return(true);
                }
            }
            Ifrm_Model objInst;

            if (container == null)
            {
                return(false);
            }
            //container.Controls.Clear();

            //container.Controls.Clear();//清除所有控件

            if (mnu.Params == null || mnu.Params.Trim().Length == 0)
            {
                object obj = Activator.CreateInstance(tFrm, null);
                objInst = obj as Ifrm_Model;
            }
            else
            {
                objInst = Activator.CreateInstance(tFrm, mnu.Params) as Ifrm_Model;
            }
            if (objInst == null)
            {
                return(false);
            }
            objInst.FromMenu = mnu;
            objInst.strUid   = mnu.strUid;
            objInst.SetDock(XPlatformDockStyle.Fill);
            if (objInst.lb_Title != null)
            {
                objInst.lb_Title.Text = mnu.MnuName;
            }
            objInst.GridSource   = mnu.GridSource;
            objInst.DetailSource = mnu.DetailSrouce;
            objInst.UseSubItems  = mnu.UseSubItems;
            objInst.strKey       = mnu.Key;
            if (mnu.Module.Trim().Length > 0)
            {
                objInst.strModule = mnu.Module;
            }
            if (mnu.Screen.Trim().Length > 0)
            {
                objInst.strScreen = mnu.Screen;
            }
            if (mnu.Target.Trim().Length > 0)
            {
                objInst.strTarget = mnu.Target;
            }
            objInst.strKey = mnu.Key;
            objInst.Link   = Link;
            if (objInst is IMutliDataInterface)
            {
                (objInst as IMutliDataInterface).InjectedDatas = injectedatas;
            }
            if (objInst is ITranslateableInterFace && (Link is IKeyForm || Link == null))
            {
                FillTranData(Link, objInst as ITranslateableInterFace, ref mnu, ref data);
                (objInst as ITranslateableInterFace).NeedUpdateData = data;
            }
            objInst.TranData = mnu.TranDataMapping;
            //菜单数据下传
            //if (objInst.InjectedDatas == null)
            //{
            //    objInst.InjectedDatas = new List<UpdateData>();
            //}
            //if(data != null)
            //{
            //    objInst.InjectedDatas.Add(data);
            //}
            if (container != null)
            {
                container.Controls_Add(objInst);
                objInst.ToTopLevel();
            }
            if (!AllModules.ContainsKey(mnu.MnuId))
            {
                AllModules.Add(mnu.MnuId, objInst);
            }
            container.CurrMainControl = objInst;
            switch (mnu.linkType)
            {
            case LinkType.WebPage:    //winform专用
            {
                break;
            }

            case LinkType.Dialog:
            {
                if (container is IXPanel)              //容器是ixpanel 并且
                {
                    if ((container as IXPanel).InForm) //容器是在最外层main/mdi_main
                    {
                    }
                    else
                    {
                        break;
                    }
                }
                else        //如果是form
                {
                    //自加载
                    break;
                }

                IXForm frmobj = CreateForm(objInst.ControlType);
                frmobj.InitForm(mnu, SystemIcon);
                frmobj.Controls_Add(objInst);
                frmobj.ShowIXDialog();
                break;
            }

            case LinkType.Form:
            {
                break;
            }

            case LinkType.UserControl:
            {
                break;
            }

            case LinkType.PrintToPDF:
            {
                if (container is IXPanel)              //容器是ixpanel 并且
                {
                    if ((container as IXPanel).InForm) //容器是在最外层main/mdi_main
                    {
                        break;
                    }
                    else
                    {
                    }
                }
                else        //如果是form
                {
                    //自加载
                    break;
                }

                IXForm frmobj = CreateForm(objInst.ControlType);
                frmobj.InitForm(mnu, SystemIcon);
                frmobj.Controls_Add(objInst);
                frmobj.ShowIXDialog();
                break;
            }

            default:
            {
                break;
            }
            }
            return(true);
        }
示例#11
0
 public static bool switchToView(IXContainerControl container, IKeyForm Link, CMenuItem mnu, ref UpdateData data)
 {
     return(switchToView(container, Link, mnu, ref data, null));
 }
示例#12
0
        public static void FillTranData(IKeyForm currfrm, ITranslateableInterFace ifrm, ref CMenuItem mnu, ref UpdateData data, bool TranData)
        {
            if (data == null)
            {
                data = new UpdateData();
            }


            if (TranData)
            {
                ifrm.NeedUpdateData = data.Clone() as UpdateData;//传入
            }
            ifrm.TranData = mnu.CopyTranDatas();

            //上个页面查询条件下传
            if (currfrm != null && currfrm is ITranslateableInterFace && (currfrm as ITranslateableInterFace).TranData != null)
            {
                if (ifrm.TranData == null)
                {
                    ifrm.TranData = new List <DataTranMapping>();
                }
                if (ifrm.TranData != null)
                {
                    List <DataTranMapping> prevdata = (currfrm as ITranslateableInterFace).TranData;
                    for (int i = 0; i < prevdata.Count; i++)
                    {
                        DataTranMapping inputdata = prevdata[i];
                        var             mp        = ifrm.TranData.Where(a => a.FromDataPoint.Name == inputdata.ToDataPoint);
                        if (mp.Count() == 0)
                        {
                            ifrm.TranData.Add(inputdata);
                        }
                        else
                        {
                            mp.First().FromDataPoint.Text = inputdata.FromDataPoint.Text;
                        }
                        if (!data.Items.ContainsKey(inputdata.ToDataPoint))
                        {
                            data.Items.Add(inputdata.ToDataPoint, new UpdateItem(inputdata.ToDataPoint, inputdata.FromDataPoint.Text));
                        }
                        data.Items[inputdata.ToDataPoint].text = inputdata.FromDataPoint.Text;
                    }
                }
            }
            #region  输数据不为空
            if (mnu.TranDataMapping != null)
            {
                for (int i = 0; i < mnu.TranDataMapping.Count; i++)
                {
                    DataTranMapping dtm = mnu.TranDataMapping[i];
                    if (currfrm != null && currfrm is IKeyForm && currfrm.strKey == dtm.FromDataPoint.Name)//如果匹配到关键字,传送到下一个界面
                    {
                        string val = currfrm.strRowId;
                        if (mnu.Params != null && mnu.Params.Trim().Length > 0)
                        {
                            if (val.Trim().Length == 0)
                            {
                                val = mnu.Params;
                            }
                        }
                        if (data.Items.ContainsKey(dtm.ToDataPoint))
                        {
                            data.Items[dtm.ToDataPoint].value = val;
                        }
                        else
                        {
                            data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, val));
                        }
                        //break;
                    }
                    else
                    {
                        string strPoint = dtm.FromDataPoint.Name.Replace("{", "").Replace("}", "");
                        if (GlobalShare.DataPointMappings.ContainsKey(strPoint))//如果是数据点,传数据
                        {
                            if (!TranData)
                            {
                                continue;
                            }
                            //暂时无法处理
                            if (currfrm is ITranslateableInterFace)//获得该界面的所有数据
                            {
                                UpdateData currframedata = (currfrm as ITranslateableInterFace).GetCurrFrameData();

                                if (currframedata.Items.ContainsKey(strPoint))//如果数据中包括要传送的数据点
                                {
                                    if (data.Items.ContainsKey(dtm.ToDataPoint))
                                    {
                                        data.Items[dtm.ToDataPoint].value = currframedata.Items[strPoint].value;
                                    }
                                    else
                                    {
                                        data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, currframedata.Items[strPoint].value));
                                        //dtm.FromDataPoint  = currframedata.Items[dtm.FromDataPoint.Name].value;
                                    }
                                    dtm.FromDataPoint.Text = currframedata.Items[strPoint].value;
                                }
                            }
                            else//如果是顶层菜单传入,并且是系统的用户常量
                            {
                                if (GlobalShare.UserAppInfos.First().Value.appinfo.UserInfo.Items.ContainsKey(strPoint))
                                {
                                    UpdateData ud = GlobalShare.UserAppInfos.First().Value.appinfo.UserInfo;
                                    if (data.Items.ContainsKey(strPoint))
                                    {
                                        data.Items[dtm.ToDataPoint].value = ud.Items[strPoint].value;
                                    }
                                    else
                                    {
                                        data.Items.Add(dtm.ToDataPoint, new UpdateItem(strPoint, ud.Items[strPoint].value));
                                        //dtm.FromDataPoint  = currframedata.Items[dtm.FromDataPoint.Name].value;
                                    }
                                    dtm.FromDataPoint.Text = ud.Items[strPoint].value;
                                }
                            }
                        }
                        else//传常量
                        {
                            if (data.Items.ContainsKey(dtm.ToDataPoint))
                            {
                                data.Items[dtm.ToDataPoint].value = dtm.FromDataPoint.Text;
                            }
                            else
                            {
                                data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, dtm.FromDataPoint.Name));
                            }
                        }
                    }
                }
            }
            #endregion
            if (!TranData)
            {
                return;
            }
            //关键字下传
            if (currfrm == null)
            {
                return;
            }
            if (data == null)
            {
                data = new UpdateData();
            }
            if (data.Items.ContainsKey(currfrm.strKey) && currfrm.strRowId != "")
            {
                data.Items[currfrm.strKey].value = currfrm.strRowId;
            }
            else
            {
                if (!data.Items.ContainsKey(currfrm.strKey))
                {
                    data.Items.Add(currfrm.strKey, new UpdateItem(currfrm.strKey, currfrm.strRowId));
                }
            }
        }
示例#13
0
 public static void FillTranData(IKeyForm currfrm, ITranslateableInterFace ifrm, ref CMenuItem mnu, ref UpdateData data)
 {
     FillTranData(currfrm, ifrm, ref mnu, ref data, true);
 }
示例#14
0
 public static bool switchToView(IXContainerControl container, CMenuItem mnu)
 {
     return(switchToView(container, null, mnu));
 }
示例#15
0
 public abstract bool CreateTagFrame(IFrameObj Container, BaseFormHandle CurrFormHandle, CMenuItem mnu, ref UpdateData data, ref string msg);
示例#16
0
 public virtual bool Save(CMenuItem mnu)
 {
     throw new Exception("The method or operation is not implemented.");
 }
示例#17
0
 public bool SaveData(CMenuItem mnu, DataRequestType type = DataRequestType.Update)
 {
     throw new NotImplementedException();
 }
示例#18
0
 public virtual void BaseForm_ToolBar_SaveAndCreateNew(CMenuItem mnu)
 {
     throw new Exception("The method or operation is not implemented.");
 }
示例#19
0
 public static void FillTranData(IKeyForm currfrm, ITranslateableInterFace ifrm, CMenuItem mnu, ref UpdateData data)
 {
     if (data == null)
     {
         data = new UpdateData();
     }
     ifrm.NeedUpdateData = data;//传入
     ifrm.TranData       = mnu.TranDataMapping;
     #region
     if (mnu.TranDataMapping != null)
     {
         for (int i = 0; i < mnu.TranDataMapping.Count; i++)
         {
             DataTranMapping dtm = mnu.TranDataMapping[i];
             if (currfrm != null && currfrm.strKey == dtm.FromDataPoint.Name)//如果匹配到关键字,传送到下一个界面
             {
                 //break;
             }
             else
             {
                 if (GlobalShare.DataPointMappings.ContainsKey(dtm.FromDataPoint.Name))//如果是数据点,传数据
                 {
                     //暂时无法处理
                     if (currfrm is ITranslateableInterFace)//获得该界面的所有数据
                     {
                         UpdateData currframedata = (currfrm as ITranslateableInterFace).GetCurrFrameData();
                         if (currframedata.Items.ContainsKey(dtm.FromDataPoint.Name))//如果数据中包括要传送的数据点
                         {
                             if (data.Items.ContainsKey(dtm.ToDataPoint))
                             {
                                 data.Items[dtm.ToDataPoint].value = currframedata.Items[dtm.FromDataPoint.Name].value;
                             }
                             else
                             {
                                 data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, currframedata.Items[dtm.FromDataPoint.Name].value));
                             }
                         }
                     }
                 }
                 else//传常量
                 {
                     if (data.Items.ContainsKey(dtm.ToDataPoint))
                     {
                         data.Items[dtm.ToDataPoint].value = dtm.FromDataPoint.Text;
                     }
                     else
                     {
                         data.Items.Add(dtm.ToDataPoint, new UpdateItem(dtm.ToDataPoint, dtm.FromDataPoint.Text));
                     }
                 }
             }
         }
     }
     #endregion
     //关键字下传
     if (data == null)
     {
         data = new UpdateData();
     }
     if (data.Items.ContainsKey(currfrm.strKey) && currfrm.strRowId != "")
     {
         data.Items[currfrm.strKey].value = currfrm.strRowId;
     }
     else
     {
         data.Items.Add(currfrm.strKey, new UpdateItem(currfrm.strKey, currfrm.strRowId));
     }
 }
示例#20
0
        private void HtmlNodeToCMenuItem(HtmlNode nodeMenu, DbDataContext db, int orgId, int menuId)
        {
            if (nodeMenu.FirstChild.Attributes["data-type"] != null && nodeMenu.FirstChild.Attributes["data-type"].Value == "text")
            {
                string    textName     = nodeMenu.FirstChild.Attributes["data-name"].Value;
                string    categoryName = nodeMenu.FirstChild.Attributes["data-categoryname"].Value;
                CText     text;
                CCategory cat;
                text = db.Texts.Where(k => k.OrganizationId == orgId &&
                                      k.Name == textName &&
                                      k.Category.Name == categoryName &&
                                      k.ActiveStatus == EActiveStatus.Active).FirstOrDefault();

                cat = db.Categories.Where(k => k.ActiveStatus == EActiveStatus.Active &&
                                          k.OrganizationId == orgId &&
                                          k.Name == categoryName).FirstOrDefault();

                if (cat == null)
                {
                    CItemTheme itemTheme;
                    itemTheme = db.ItemThemes.Where(k => k.OrganizationId == orgId &&
                                                    k.Name == _CategoryThemeString &&
                                                    k.ActiveStatus == EActiveStatus.Active &&
                                                    k.ThemeType == EItemTheme.Category).FirstOrDefault();

                    if (itemTheme == null)
                    {
                        itemTheme                = new CItemTheme();
                        itemTheme.Name           = _CategoryThemeString;
                        itemTheme.OrganizationId = orgId;
                        itemTheme.ThemeType      = EItemTheme.Category;
                        itemTheme.ThemePath      = _CategoryThemeString;
                        itemTheme.ActiveStatus   = EActiveStatus.Active;
                        itemTheme.CreatedUserId  = 1;
                        itemTheme.CreatedDate    = DateTime.Now;
                        db.ItemThemes.Add(itemTheme);
                        db.SaveChanges();
                    }

                    cat                = new CCategory();
                    cat.Name           = categoryName;
                    cat.ActiveStatus   = EActiveStatus.Active;
                    cat.CreatedDate    = DateTime.Now;
                    cat.CreatedUserId  = 1;
                    cat.ItemThemeId    = itemTheme.Id;
                    cat.OrganizationId = orgId;
                    db.Categories.Add(cat);
                    db.SaveChanges();
                }

                if (text == null)
                {
                    if (String.IsNullOrEmpty(nodeMenu.FirstChild.Attributes["data-itemtheme"].Value))
                    {
                        throw new Exception("Yazının 'data-itemtheme' değeri boş geçilemez.");
                    }
                    string     themeName = nodeMenu.FirstChild.Attributes["data-itemtheme"].Value;
                    CItemTheme itemThemeText;
                    itemThemeText = db.ItemThemes.Where(k => k.OrganizationId == orgId &&
                                                        k.Name == themeName &&
                                                        k.ActiveStatus == EActiveStatus.Active &&
                                                        k.ThemeType == EItemTheme.Text).FirstOrDefault();

                    if (itemThemeText == null)
                    {
                        itemThemeText                = new CItemTheme();
                        itemThemeText.Name           = themeName;
                        itemThemeText.OrganizationId = orgId;
                        itemThemeText.ThemeType      = EItemTheme.Text;
                        itemThemeText.CreatedDate    = DateTime.Now;
                        itemThemeText.CreatedUserId  = 1;
                        itemThemeText.ThemePath      = themeName + ".cshtml";
                        itemThemeText.ActiveStatus   = EActiveStatus.Active;
                        db.ItemThemes.Add(itemThemeText);
                        db.SaveChanges();
                    }


                    text                = new CText();
                    text.Name           = nodeMenu.FirstChild.Attributes["data-name"].Value;
                    text.OrganizationId = orgId;
                    text.PageTitle      = nodeMenu.FirstChild.Attributes["data-name"].Value;
                    text.CategoryId     = cat.Id;
                    text.ItemThemeId    = itemThemeText.Id;
                    text.CreatedDate    = DateTime.Now;
                    text.ActiveStatus   = EActiveStatus.Active;
                    text.CreatedUserId  = 1;
                    db.Texts.Add(text);
                    db.SaveChanges();
                }
                string    menuName = nodeMenu.FirstChild.InnerHtml;
                CMenuItem cm       = db.MenuItems.Where(k => k.ActiveStatus == EActiveStatus.Active &&
                                                        k.OrganizationId == orgId &&
                                                        k.Name == menuName &&
                                                        k.MenuId == menuId).FirstOrDefault();
                if (cm != null)
                {
                    cm.MenuType = EMenuType.Text;
                    cm.TextId   = text.Id;
                    db.SaveChanges();
                    _AllowedMenuItemId.Add(cm.Id);
                }
                else
                {
                    CMenuItem cmNew = new CMenuItem();
                    cmNew.TextId         = text.Id;
                    cmNew.OrganizationId = orgId;
                    cmNew.Name           = menuName;
                    cmNew.MenuId         = menuId;
                    cmNew.MenuType       = EMenuType.Text;
                    cmNew.CreatedDate    = DateTime.Now;
                    cmNew.ActiveStatus   = EActiveStatus.Active;
                    cmNew.CreatedUserId  = 1;
                    db.MenuItems.Add(cmNew);
                    db.SaveChanges();
                    _AllowedMenuItemId.Add(cmNew.Id);
                }
            }
            else if (nodeMenu.FirstChild.Attributes["data-type"] != null && nodeMenu.FirstChild.Attributes["data-type"].Value == "url")
            {
                string    menuName = nodeMenu.FirstChild.InnerHtml;
                CMenuItem cm       = db.MenuItems.Where(k => k.ActiveStatus == EActiveStatus.Active &&
                                                        k.OrganizationId == orgId &&
                                                        k.Name == menuName &&
                                                        k.MenuId == menuId).FirstOrDefault();
                if (cm != null)
                {
                    cm.MenuType = EMenuType.Url;
                    cm.Url      = nodeMenu.FirstChild.Attributes["data-url"].Value;
                    db.SaveChanges();
                    _AllowedMenuItemId.Add(cm.Id);
                }
                else
                {
                    CMenuItem cmNew = new CMenuItem();
                    cmNew.Url            = nodeMenu.FirstChild.Attributes["data-url"].Value;
                    cmNew.OrganizationId = orgId;
                    cmNew.Name           = menuName;
                    cmNew.MenuId         = menuId;
                    cmNew.MenuType       = EMenuType.Url;
                    cmNew.CreatedDate    = DateTime.Now;
                    cmNew.CreatedUserId  = 1;
                    cmNew.ActiveStatus   = EActiveStatus.Active;
                    db.MenuItems.Add(cmNew);
                    db.SaveChanges();
                    _AllowedMenuItemId.Add(cmNew.Id);
                }
            }
            else if (nodeMenu.FirstChild.Attributes["data-type"] != null && nodeMenu.FirstChild.Attributes["data-type"].Value == "category")
            {
                string    categoryName = nodeMenu.FirstChild.Attributes["data-name"].Value;
                string    menuName     = nodeMenu.FirstChild.InnerHtml;
                CMenuItem cm           = db.MenuItems.Where(k => k.ActiveStatus == EActiveStatus.Active &&
                                                            k.OrganizationId == orgId &&
                                                            k.Name == menuName &&
                                                            k.MenuId == menuId).FirstOrDefault();
                CCategory cat;
                cat = db.Categories.Where(k => k.ActiveStatus == EActiveStatus.Active &&
                                          k.OrganizationId == orgId &&
                                          k.Name == categoryName).FirstOrDefault();
                if (cat == null)
                {
                    CItemTheme itemTheme = new CItemTheme();
                    itemTheme = db.ItemThemes.Where(k => k.OrganizationId == orgId &&
                                                    k.Name == _CategoryThemeString &&
                                                    k.ActiveStatus == EActiveStatus.Active &&
                                                    k.ThemeType == EItemTheme.Category).FirstOrDefault();

                    if (itemTheme == null)
                    {
                        itemTheme                = new CItemTheme();
                        itemTheme.Name           = _CategoryThemeString;
                        itemTheme.OrganizationId = orgId;
                        itemTheme.ThemeType      = EItemTheme.Category;
                        itemTheme.ThemePath      = _CategoryThemeString;
                        itemTheme.ActiveStatus   = EActiveStatus.Active;
                        db.ItemThemes.Add(itemTheme);
                        db.SaveChanges();
                    }

                    cat                = new CCategory();
                    cat.Name           = categoryName;
                    cat.ActiveStatus   = EActiveStatus.Active;
                    cat.CreatedDate    = DateTime.Now;
                    cat.CreatedUserId  = 1;
                    cat.OrganizationId = orgId;
                    cat.ItemThemeId    = itemTheme.Id;
                    db.Categories.Add(cat);
                    db.SaveChanges();
                }

                if (cm != null)
                {
                    cm.MenuType   = EMenuType.Category;
                    cm.CategoryId = cat.Id;
                    db.SaveChanges();
                    _AllowedMenuItemId.Add(cm.Id);
                }
                else
                {
                    CMenuItem cmNew = new CMenuItem();
                    cmNew.CategoryId     = cat.Id;
                    cmNew.OrganizationId = orgId;
                    cmNew.Name           = menuName;
                    cmNew.MenuId         = menuId;
                    cmNew.MenuType       = EMenuType.Category;
                    cmNew.CreatedDate    = DateTime.Now;
                    cmNew.CreatedUserId  = 1;
                    cmNew.ActiveStatus   = EActiveStatus.Active;
                    db.MenuItems.Add(cmNew);
                    db.SaveChanges();
                    _AllowedMenuItemId.Add(cmNew.Id);
                }
            }

            else if (nodeMenu.FirstChild.Attributes["data-type"] != null && nodeMenu.FirstChild.Attributes["data-type"].Value == "categorycontent")
            {
                string    categoryName = nodeMenu.FirstChild.Attributes["data-name"].Value;
                string    menuName     = nodeMenu.FirstChild.InnerHtml;
                CMenuItem cm           = db.MenuItems.Where(k => k.ActiveStatus == EActiveStatus.Active &&
                                                            k.OrganizationId == orgId &&
                                                            k.Name == menuName &&
                                                            k.MenuId == menuId).FirstOrDefault();
                CCategory cat;
                cat = db.Categories.Where(k => k.ActiveStatus == EActiveStatus.Active &&
                                          k.OrganizationId == orgId &&
                                          k.Name == categoryName).FirstOrDefault();
                if (cat == null)
                {
                    CItemTheme itemTheme = new CItemTheme();
                    itemTheme = db.ItemThemes.Where(k => k.OrganizationId == orgId &&
                                                    k.Name == _CategoryThemeString &&
                                                    k.ActiveStatus == EActiveStatus.Active &&
                                                    k.ThemeType == EItemTheme.Category).FirstOrDefault();

                    if (itemTheme == null)
                    {
                        itemTheme                = new CItemTheme();
                        itemTheme.Name           = _CategoryThemeString;
                        itemTheme.OrganizationId = orgId;
                        itemTheme.ThemeType      = EItemTheme.Category;
                        itemTheme.ThemePath      = _CategoryThemeString;
                        itemTheme.ActiveStatus   = EActiveStatus.Active;
                        db.ItemThemes.Add(itemTheme);
                        db.SaveChanges();
                    }

                    cat                = new CCategory();
                    cat.Name           = categoryName;
                    cat.ActiveStatus   = EActiveStatus.Active;
                    cat.CreatedDate    = DateTime.Now;
                    cat.CreatedUserId  = 1;
                    cat.OrganizationId = orgId;
                    cat.ItemThemeId    = itemTheme.Id;
                    db.Categories.Add(cat);
                    db.SaveChanges();
                }

                if (cm != null)
                {
                    cm.MenuType   = EMenuType.Category;
                    cm.CategoryId = cat.Id;
                    db.SaveChanges();
                    _AllowedMenuItemId.Add(cm.Id);
                }
                else
                {
                    CMenuItem cmNew = new CMenuItem();
                    cmNew.CategoryId     = cat.Id;
                    cmNew.OrganizationId = orgId;
                    cmNew.Name           = menuName;
                    cmNew.MenuId         = menuId;
                    cmNew.MenuType       = EMenuType.Category;
                    cmNew.CreatedDate    = DateTime.Now;
                    cmNew.CreatedUserId  = 1;
                    cmNew.ActiveStatus   = EActiveStatus.Active;
                    db.MenuItems.Add(cmNew);
                    db.SaveChanges();
                    _AllowedMenuItemId.Add(cmNew.Id);
                }
            }
        }
示例#21
0
        private void gan_right()
        {
            int  num     = 0;
            int  num2    = 0;
            bool visible = false;

            s_right = "+" + s_right.Trim('+') + "+";
            DataTable dtQuyen = new DataTable("quyen");
            CMenuItem mn      = new CMenuItem();

            dtQuyen            = mn.dm_bv_menuItem().Tables[0];
            dtQuyen.PrimaryKey = new DataColumn[1] {
                dtQuyen.Columns["id"]
            };
            CBV_loginDAO bvdlogin = new CBV_loginDAO();

            for (int i = 0; i < (this.mainMenu1.MenuItems.Count); i++)
            {
                //visible = false;
                visible = bvisable;
                for (int j = 0; j < this.mainMenu1.MenuItems[i].MenuItems.Count; j++)
                {
                    if (this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems.Count == 0)
                    {
                        if (this.mainMenu1.MenuItems[i].MenuItems[j].Text != "-")
                        {
                            string s_MergeOrder = this.mainMenu1.MenuItems[i].MenuItems[j].MergeOrder.ToString().PadLeft(4, '0');
                            this.mainMenu1.MenuItems[i].MenuItems[j].Visible = (bvisable == true) ? true :((this.s_right.IndexOf("+" + s_MergeOrder + "+") != -1) && (dtQuyen.Rows.Find(s_MergeOrder) != null));
                            if (!visible)
                            {
                                visible = this.mainMenu1.MenuItems[i].MenuItems[j].Visible;
                            }
                        }
                        else
                        {
                            this.mainMenu1.MenuItems[i].MenuItems[j].Visible = false;
                        }
                    }
                    else
                    {
                        num = 0;
                        for (int k = 0; k < this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems.Count; k++)
                        {
                            if (this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].MenuItems.Count == 0)
                            {
                                if (this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].Text != "-")
                                {
                                    string s_MergeOrder = this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].MergeOrder.ToString().PadLeft(4, '0');
                                    this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].Visible = (bvisable == true)?true:((this.s_right.IndexOf("+" + s_MergeOrder + "+") != -1) && (dtQuyen.Rows.Find(s_MergeOrder) != null));
                                }
                                else
                                {
                                    this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].Visible = false;
                                }
                                num += this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].Visible ? 1 : 0;
                            }
                            else
                            {
                                num2 = 0;
                                for (int l = 0; l < this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].MenuItems.Count; l++)
                                {
                                    if (this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].MenuItems[l].Text != "-")
                                    {
                                        string s_MergeOrder = this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].MenuItems[l].MergeOrder.ToString().PadLeft(4, '0');
                                        this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].MenuItems[l].Visible = (bvisable == true)? true :((this.s_right.IndexOf("+" + s_MergeOrder + "+") != -1) && (dtQuyen.Rows.Find(s_MergeOrder) != null));
                                    }
                                    else
                                    {
                                        this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].MenuItems[l].Visible = false;
                                    }
                                    num2 += this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].MenuItems[l].Visible ? 1 : 0;
                                }
                                this.mainMenu1.MenuItems[i].MenuItems[j].MenuItems[k].Visible = num != 0;
                            }
                        }
                        this.mainMenu1.MenuItems[i].MenuItems[j].Visible = num != 0;
                        if (!visible)
                        {
                            visible = num != 0;
                        }
                    }
                    this.mainMenu1.MenuItems[i].Visible = visible;
                }
            }
        }
示例#22
0
        public bool GetFrameHandle(IFrameObj Container, BaseFormHandle CurrFormHandle, CMenuItem mnu, ref UpdateData data, ref string msg, ref BaseFormHandle retHandle)
        {
            msg = null;
            if (mnu == null)
            {
                return(false);
            }
            if (mnu.LinkValue == null || mnu.LinkValue.Trim().Length == 0)
            {
                msg = "目标为空!";
                return(false);
            }
            Assembly ass = this.GetAssembly();

            if (ass == null)
            {
                msg = "无法获得程序集!";
                return(false);
            }
            string strFrmB = string.Format(mnu.LinkValue, GlobalShare.SystemAppInfo.AssemName) + "B";
            Type   tFrm    = ass.GetType(strFrmB);

            if (mnu.linkType != LinkType.WebPage)
            {
                if (tFrm == null)
                {
                    msg = string.Format("未找到类{0}!", mnu.LinkValue);
                    return(false);
                }
            }
            retHandle = null;
            switch (mnu.linkType)
            {
            case LinkType.WebPage:
            {
                return(CreateWebPage(Container, CurrFormHandle, mnu, ref msg));

                break;
            }

            case LinkType.Form:
            default:
            {
                BaseFormHandle objInst;
                if (mnu.Params == null || mnu.Params.Trim().Length == 0)
                {
                    objInst = Activator.CreateInstance(tFrm, null) as BaseFormHandle;
                }
                else
                {
                    objInst = Activator.CreateInstance(tFrm, mnu.Params) as BaseFormHandle;
                }
                if (objInst == null)
                {
                    msg = "无法建立实例!";
                    return(false);
                }
                objInst.strUid       = mnu.strUid;
                objInst.Title        = mnu.MnuName;
                objInst.Tag          = mnu;
                objInst.GridSource   = mnu.GridSource;
                objInst.DetailSource = mnu.DetailSrouce;
                if (mnu.Module.Trim().Length > 0)
                {
                    objInst.strModule = mnu.Module;
                }
                if (mnu.Screen.Trim().Length > 0)
                {
                    objInst.strScreen = mnu.Screen;
                }
                if (mnu.Target.Trim().Length > 0)
                {
                    objInst.strTarget = mnu.Target;
                }
                objInst.strKey   = mnu.Key;
                objInst.Link     = CurrFormHandle;
                objInst.TranData = mnu.TranDataMapping;
                if (objInst is ITranslateableInterFace && CurrFormHandle is IKeyForm)
                {
                    FillTranData(CurrFormHandle, objInst as ITranslateableInterFace, mnu, ref data);
                }
                if (!this.CreateFrame(Container, CurrFormHandle, mnu, ref data, ref msg))
                {
                    return(false);
                }
                retHandle = objInst;
                break;
            }
            }
            msg = null;
            return(true);
        }
示例#23
0
        public ActionResult InsertSubMenu(CMenuItem item)
        {
            DbDataContext db           = new DbDataContext("CloudAppWebSite");
            int           intId        = Convert.ToInt32(Request.Form["QueryId"]);
            int           intMenuId    = Convert.ToInt32(Request.Form["QueryMenuId"]);
            int           intSubMenuId = Convert.ToInt32(Request.Form["QuerySubMenuId"]);
            int           UserId       = GetUserId();
            int           orgId        = GetOrganizationId();

            if (orgId == 0)
            {
                return(Redirect("/blog/Admin/Home/Index"));
            }
            if (ModelState.IsValid)
            {
                if (intSubMenuId == 0)
                {
                    EMenuType type = ((EMenuType)Convert.ToInt32(Request.Form["MenuType"]));
                    if (type == EMenuType.Category || type == EMenuType.CategoryContent)
                    {
                        item.CategoryId = Convert.ToInt32(Request.Form["MenuConnect"]);
                    }
                    if (type == EMenuType.Text)
                    {
                        item.TextId = Convert.ToInt32(Request.Form["MenuConnect"]);
                    }
                    if (intMenuId != 0)
                    {
                        item.Level  = 0;
                        item.MenuId = intMenuId;
                    }
                    if (intId != 0)
                    {
                        item.Level     = db.MenuItems.Where(p => p.Id == intId && p.OrganizationId == orgId && p.ActiveStatus == EActiveStatus.Active).Select(m => m.Level).FirstOrDefault() + 1;
                        item.SubMenuId = intId;
                    }
                    item.OrganizationId = orgId;
                    item.CreatedUserId  = UserId;
                    item.CreatedDate    = DateTime.Now;
                    item.ActiveStatus   = EActiveStatus.Active;
                    db.MenuItems.Add(item);
                    db.SaveChanges();

                    foreach (var formItem in Request.Form)
                    {
                        if (formItem.ToString().Contains("-"))
                        {
                            string            lang           = formItem.ToString().Split('|')[0];
                            string            property       = formItem.ToString().Split('|')[1];
                            CMenuItemLanguage cImageLanguage = null;
                            if (item != null && item.LanguageValues != null)
                            {
                                cImageLanguage = item.LanguageValues.FirstOrDefault(f => f.Lang == lang);
                            }

                            string formValue = Request.Form[formItem.ToString()];
                            if (cImageLanguage != null)
                            {
                                if (property == "Name")
                                {
                                    cImageLanguage.Name = formValue;
                                }
                                db.SaveChanges();
                            }
                            else
                            {
                                CMenuItemLanguage ln = new CMenuItemLanguage();
                                if (property == "Name")
                                {
                                    ln.Name = formValue;
                                }

                                ln.ActiveStatus   = EActiveStatus.Active;
                                ln.CreatedDate    = DateTime.Now;
                                ln.CreatedUserId  = GetUserId();
                                ln.Lang           = lang;
                                ln.OrganizationId = GetOrganizationId();
                                ln.MenuItemId     = item.Id;
                                db.MenuItemLanguage.Add(ln);
                                db.SaveChanges();
                            }
                        }
                    }


                    InsertAlert(new ViewAlert {
                        Title = "Başarılı", Desc = "Alt menü başarılı bir şekilde eklenmiştir.", AlertType = EAlertType.Success
                    });
                    return(Redirect("/blog/Admin/Menu/InsertSubMenu/?Id=" + intId + "&MenuId=" + intMenuId + ""));
                    //return RedirectToAction("InsertSubMenu", "Menu", new { Id = intId, MenuId = intMenuId });
                }
                else
                {
                    CMenuItem cmm = db.MenuItems.Where(p => p.OrganizationId == orgId && p.ActiveStatus == EActiveStatus.Active && p.Id == intSubMenuId).FirstOrDefault();
                    if (cmm != null)
                    {
                        EMenuType type = ((EMenuType)Convert.ToInt32(Request.Form["MenuType"]));
                        if (type == EMenuType.Category || type == EMenuType.CategoryContent)
                        {
                            cmm.CategoryId = Convert.ToInt32(Request.Form["MenuConnect"]);
                        }
                        if (type == EMenuType.Text)
                        {
                            cmm.TextId = Convert.ToInt32(Request.Form["MenuConnect"]);
                        }
                        //cmm.Name = item.Name;
                        foreach (var formItem in Request.Form)
                        {
                            if (formItem.ToString().Contains("-"))
                            {
                                string            lang           = formItem.ToString().Split('|')[0];
                                string            property       = formItem.ToString().Split('|')[1];
                                CMenuItemLanguage cImageLanguage = null;
                                if (cmm != null && cmm.LanguageValues != null)
                                {
                                    cImageLanguage = cmm.LanguageValues.FirstOrDefault(f => f.Lang == lang);
                                }
                                string formValue = Request.Form[formItem.ToString()];
                                if (cImageLanguage != null)
                                {
                                    if (property == "Name")
                                    {
                                        cImageLanguage.Name = formValue;
                                    }
                                    db.SaveChanges();
                                }
                                else
                                {
                                    CMenuItemLanguage ln = new CMenuItemLanguage();
                                    if (property == "Name")
                                    {
                                        ln.Name = formValue;
                                    }

                                    ln.ActiveStatus   = EActiveStatus.Active;
                                    ln.CreatedDate    = DateTime.Now;
                                    ln.CreatedUserId  = GetUserId();
                                    ln.Lang           = lang;
                                    ln.OrganizationId = GetOrganizationId();
                                    ln.MenuItemId     = cmm.Id;
                                    db.MenuItemLanguage.Add(ln);
                                    db.SaveChanges();
                                }
                            }
                        }

                        cmm.Url      = item.Url;
                        cmm.MenuType = type;
                        cmm.Order    = item.Order;
                        db.SaveChanges();
                        InsertAlert(new ViewAlert {
                            Title = "Başarılı", Desc = "Alt menü başarılı bir şekilde Düzenlenmiştir.", AlertType = EAlertType.Success
                        });
                        return(Redirect("/blog/Admin/Menu/InsertSubMenu/?Id=" + intId + "&MenuId=" + intMenuId + "&SubMenuId=" + cmm.Id + ""));
                    }
                    else
                    {
                        InsertAlert(new ViewAlert {
                            AlertType = EAlertType.Warning, Title = "Uyarı", Desc = "Yetkisiz Giriş"
                        });
                        return(RedirectToAction("Dashboard", "Home"));
                    }
                }
            }
            ViewBag.BreadCrumbList = GetBreadCrumbList(intId.ToString(), intMenuId.ToString()).OrderBy(p => p.Level).ToList();
            CMenuItem mm = new CMenuItem();

            return(View(mm));
        }
示例#24
0
        public static bool ShowDialoger(IXPanel container, IKeyForm Link, CMenuItem mnu, ref UpdateData data, bool MultiSelected)
        {
            if (mnu == null)
            {
                return(false);
            }
            if (mnu.LinkValue == null || mnu.LinkValue.Trim().Length == 0)
            {
                return(false);
            }
            Type tFrm = Appasmb.GetType(string.Format(mnu.LinkValue, GlobalShare.SystemAppInfo.AssemName));

            if (mnu.linkType != LinkType.WebPage)
            {
                if (tFrm == null)
                {
                    MessageBox.Show(string.Format("未找到类{0}!", mnu.LinkValue));
                    return(false);
                }
            }

            switch (mnu.linkType)
            {
            case LinkType.WebPage:
            {
                if (container != null)        //support the tab frame
                {
                    ////WebBrowser wb = new WebBrowser();
                    ////wb.Url = new Uri(mnu.LinkValue);
                    ////container.ControlsAdd(wb);
                    ////wb.Dock = DockStyle.Fill;
                    break;
                }
                WebForm wbfrm = null;
                if (ShowWebForms.ContainsKey(mnu.MnuId))
                {
                    wbfrm = ShowWebForms[mnu.MnuId];
                }
                else
                {
                    wbfrm = new WebForm(mnu.MnuId, mnu.LinkValue);
                }
                wbfrm.ShowDialog(ParentForm);
                break;
            }

            case LinkType.Dialog:
            {
                Ifrm_Model objInst;
                if (mnu.Params == null || mnu.Params.Trim().Length == 0)
                {
                    objInst = Activator.CreateInstance(tFrm, null) as Ifrm_Model;
                }
                else
                {
                    objInst = Activator.CreateInstance(tFrm, mnu.Params) as Ifrm_Model;
                }
                if (objInst == null)
                {
                    return(false);
                }
                objInst.FromMenu = mnu;
                objInst.SetDock(XPlatformDockStyle.Fill);
                objInst.strUid        = mnu.strUid;
                objInst.FromMenu      = mnu;
                objInst.lb_Title.Text = mnu.MnuName;
                objInst.GridSource    = mnu.GridSource;
                objInst.DetailSource  = mnu.DetailSrouce;
                if (mnu.Module.Trim().Length > 0)
                {
                    objInst.strModule = mnu.Module;
                }
                if (mnu.Screen.Trim().Length > 0)
                {
                    objInst.strScreen = mnu.Screen;
                }
                if (mnu.Target.Trim().Length > 0)
                {
                    objInst.strTarget = mnu.Target;
                }
                objInst.strKey = mnu.Key;
                objInst.Link   = Link;
                IXForm frm = CreateForm(objInst.ControlType);
                frm.InitForm(mnu, SystemIcon);
                //objInst.AllowClose = false;
                if (objInst is ITranslateableInterFace && (Link is IKeyForm || Link == null))
                {
                    FillTranData(Link, objInst as ITranslateableInterFace, ref mnu, ref data);
                }
                objInst.TranData = mnu.TranDataMapping;
                objInst.FromMenu = mnu;
                if (objInst is ITranslateableInterFace)
                {
                    data.ReqType = DataRequestType.Update;
                    if (mnu.Params == null || mnu.Params.Trim().Length == 0)
                    {
                        data.ReqType = DataRequestType.Add;
                        data.Updated = true;
                    }
                    (objInst as ITranslateableInterFace).NeedUpdateData = data;
                }
                frm.Controls_Add(objInst);
                if (!frm.ShowIXDialog())
                {
                    return(false);
                }
                if (objInst is ITranslateableInterFace)
                {
                    data = (objInst as ITranslateableInterFace).NeedUpdateData;        //传出
                }
                break;
            }

            case LinkType.Select:
            {
                Dlg_CommModel objInst;
                if (mnu.Params == null || mnu.Params.Trim().Length == 0)
                {
                    objInst = Activator.CreateInstance(tFrm, null) as Dlg_CommModel;
                }
                else
                {
                    objInst = Activator.CreateInstance(tFrm, mnu.Params) as Dlg_CommModel;
                }
                if (objInst == null)
                {
                    return(false);
                }
                objInst.FromMenu = mnu;
                objInst.strUid   = mnu.strUid;
                //objInst.Dock = DockStyle.Fill;
                //objInst.lb_Title.Text = mnu.MnuName;
                objInst.MultiSelect  = MultiSelected;
                objInst.GridSource   = mnu.GridSource;
                objInst.DetailSource = mnu.DetailSrouce;
                if (mnu.Module.Trim().Length > 0)
                {
                    objInst.strModule = mnu.Module;
                }
                if (mnu.Screen.Trim().Length > 0)
                {
                    objInst.strScreen = mnu.Screen;
                }
                if (mnu.Target.Trim().Length > 0)
                {
                    objInst.strTarget = mnu.Target;
                }
                objInst.strKey = mnu.Key;
                objInst.Link   = Link;

                if (container != null)
                {
                    objInst.Icon = SystemIcon;
                }
                objInst.Text = mnu.Title;

                objInst.MaximizeBox     = false;
                objInst.MinimizeBox     = false;
                objInst.FormBorderStyle = FormBorderStyle.FixedDialog;
                objInst.StartPosition   = FormStartPosition.CenterParent;
                //objInst.AllowClose = false;
                //(objInst as Dlg_CommModel).ReturnData = data;//传入
                if (objInst is ITranslateableInterFace)
                {
                    FillTranData(Link, objInst as ITranslateableInterFace, ref mnu, ref data, false);
                }
                if (objInst.ShowDialog() != DialogResult.Yes)
                {
                    return(false);
                }
                if (objInst is ITranslateableInterFace && Link is IKeyForm)
                {
                    data = (objInst as ITranslateableInterFace).NeedUpdateData;        //传出
                }

                break;
            }

            case LinkType.Form:
            {
                Ifrm_Model objInst;
                if (mnu.Params == null || mnu.Params.Trim().Length == 0)
                {
                    objInst = Activator.CreateInstance(tFrm, null) as Ifrm_Model;
                }
                else
                {
                    objInst = Activator.CreateInstance(tFrm, mnu.Params) as Ifrm_Model;
                }
                if (objInst == null)
                {
                    return(false);
                }
                objInst.FromMenu = mnu;
                objInst.strUid   = mnu.strUid;
                objInst.SetDock(XPlatformDockStyle.Fill);
                objInst.lb_Title.Text = mnu.MnuName;
                objInst.GridSource    = mnu.GridSource;
                objInst.DetailSource  = mnu.DetailSrouce;
                if (mnu.Module.Trim().Length > 0)
                {
                    objInst.strModule = mnu.Module;
                }
                if (mnu.Screen.Trim().Length > 0)
                {
                    objInst.strScreen = mnu.Screen;
                }
                if (mnu.Target.Trim().Length > 0)
                {
                    objInst.strTarget = mnu.Target;
                }
                objInst.strKey = mnu.Key;
                objInst.Link   = Link;
                IXForm frm = CreateForm(objInst.ControlType);
                frm.InitForm(mnu, SystemIcon);

                //objInst.AllowClose = false;
                if (objInst is ITranslateableInterFace && (Link is IKeyForm || Link == null))
                {
                    FillTranData(Link, objInst as ITranslateableInterFace, ref mnu, ref data);
                    //(objInst as ITranslateableInterFace).NeedUpdateData = data;
                }
                frm.Controls_Add(objInst);
                frm.ShowIXDialog();
                if (objInst is ISaveableInterFace)
                {
                    data = (objInst as ISaveableInterFace).NeedUpdateData;        //传出
                }
                break;
            }

            case LinkType.UserControl:
            {
                container.Controls_Clear();        //清除所有控件
                Ifrm_Model objInst;
                if (mnu.Params == null || mnu.Params.Trim().Length == 0)
                {
                    objInst = Activator.CreateInstance(tFrm, null) as Ifrm_Model;
                }
                else
                {
                    objInst = Activator.CreateInstance(tFrm, mnu.Params) as Ifrm_Model;
                }
                if (objInst == null)
                {
                    return(false);
                }
                objInst.FromMenu = mnu;
                objInst.strUid   = mnu.strUid;
                objInst.SetDock(XPlatformDockStyle.Fill);
                objInst.lb_Title.Text = mnu.MnuName;
                objInst.GridSource    = mnu.GridSource;
                objInst.DetailSource  = mnu.DetailSrouce;
                objInst.strKey        = mnu.Key;
                if (mnu.Module.Trim().Length > 0)
                {
                    objInst.strModule = mnu.Module;
                }
                if (mnu.Screen.Trim().Length > 0)
                {
                    objInst.strScreen = mnu.Screen;
                }
                if (mnu.Target.Trim().Length > 0)
                {
                    objInst.strTarget = mnu.Target;
                }
                objInst.strKey = mnu.Key;
                objInst.Link   = Link;
                if (objInst is ITranslateableInterFace && (Link is IKeyForm || Link == null))
                {
                    FillTranData(Link, objInst as ITranslateableInterFace, ref mnu, ref data);
                }
                container.Controls_Add(objInst);
                objInst.ToTopLevel();
                //objInst.Focus();
                break;
            }

            default:
            {
                break;
            }
            }
            return(true);
        }
示例#25
0
 public virtual bool BaseForm_ToolBar_SaveClose(CMenuItem mnu)
 {
     throw new Exception("The method or operation is not implemented.");
 }
示例#26
0
 public abstract bool CreateWebPage(IFrameObj Container, BaseFormHandle CurrFormHandle, CMenuItem mnu, ref string msg);
示例#27
0
        public void ToolBarBtn_Click(object sender, EventArgs e)
        {
            CMenuItem mnu = (sender as ITag).Tag as CMenuItem;

            if (mnu == null)
            {
                return;
            }
            switch (mnu.MnuId)
            {
            case "PrintPDF":
            {
                ToolBar_PrintPDF();
                break;
            }

            case "EditView":
            {
                ToolBar_EditView();
                //EditView();
                break;
            }

            case "SaveClose":
            {
                if (ToolBar_SaveClose(mnu))
                {
                    ToolBar_RefreshData();
                }
                break;
            }

            case "SaveNew":
            {
                ToolBar_SaveAndCreateNew(mnu);
                break;
            }

            case "New":
            {
                DataComboBox.ClearRunningTimeDataSource();
                ToolBar_NewCreate(mnu);
                break;
            }

            case "ExportExcel":
            {
                ToolBar_Export();
                break;
            }

            case "Refresh":
            {
                DataComboBox.ClearRunningTimeDataSource();
                ToolBar_RefreshData();
                break;
            }

            case "OKNoSave":
            {
                ToolBar_OkNoSave();
                break;
            }

            case "AddRows":
            {
                ToolBar_AddExist(mnu);
                break;
            }

            case "Remove":    //sub items remove
            {
                ToolBar_Remove();
                ToolBar_RefreshData();
                break;
            }

            case "Delete":
            {
                ToolBar_Delete();
                ToolBar_RefreshData();
                break;
            }

            case "ListSelectedItems":    //
            {
                ToolBar_ListSelectedItemsClicked();
                break;
            }

            case "SaveAs":
            {
                ToolBar_SaveAs(mnu);
                break;
            }

            default:
            {
                ToolBar_OtherEvent(mnu);
                break;
            }
            }
        }
示例#28
0
 public static bool ShowDialoger(IXPanel container, IKeyForm Link, CMenuItem mnu, ref UpdateData data)
 {
     return(ShowDialoger(container, Link, mnu, ref data, false));
 }
示例#29
0
文件: BaseGrid.cs 项目: dftell/WCS
        public virtual void FillGrid(XmlNode cmbNode)
        {
            //grid列处理
            if (XmlUtil.GetSubNodeText(cmbNode, "@sum") != null)
            {
                listViewObj.AllowSum = XmlUtil.GetSubNodeText(cmbNode, "@sum") == "1";
            }
            if (XmlUtil.GetSubNodeText(cmbNode, "@allowgroup") != null)
            {
                listViewObj.AllowGroup = XmlUtil.GetSubNodeText(cmbNode, "@allowgroup") == "1";
            }
            listViewObj.GroupBy  = XmlUtil.GetSubNodeText(cmbNode, "@groupby");
            listViewObj.SumItems = XmlUtil.GetSubNodeText(cmbNode, "@sumitems");
            XmlNodeList nodes = cmbNode.SelectNodes("cols/f");

            if (nodes.Count > 0)
            {
                //listobj.Columns = new ListGrid.ListGridColumnHeaderCollection(this.listViewObj);
                ClearItems();

                foreach (XmlNode node in nodes)
                {
                    ViewItem vi = new ViewItem();
                    vi.LoadXml(node);

                    IDataFieldHeaderColumn ch = GetHeaderColumn();
                    ch.Text  = vi.Text;
                    ch.Width = vi.Width;
                    if (!vi.Perm)
                    {
                        ch.Width = 0;
                    }

                    DataGridColumn dgc = new DataGridColumn(this);
                    dgc.LoadXml(node);

                    dgc.Text      = ch.Text;
                    dgc.Width     = ch.Width;
                    dgc.DataField = vi.Name;


                    ch.DataType  = dgc.DataType;
                    ch.NeedSum   = dgc.Sum;
                    ch.DataField = dgc.dpt.Name;
                    AddColumnItem(ch);
                    this.Columns.Add(dgc);

                    if (ViewList.ContainsKey(vi.Name))
                    {
                        continue;
                    }
                    ViewList.Add(vi.Name, vi);
                    if (!listViewObj.DataGridColumns.ContainsKey(dgc.dpt.Name))
                    {
                        listViewObj.DataGridColumns.Add(dgc.dpt.Name, dgc);
                    }
                }

                //AcceptRejectRule
            }
            //事件初始化
            XmlNodeList evtnodes = cmbNode.SelectNodes("action/evt");

            if (evtnodes.Count > 0)
            {
                foreach (XmlNode node in evtnodes)
                {
                    CMenuItem mnu        = MenuProcess.GetMenu(null, node, frmhandle.strUid);
                    string    strEvtName = XmlUtil.GetSubNodeText(node, "@id");
                    //'mnu = CMenuItem.
                    switch (strEvtName)
                    {
                    case "dbclick":
                    {
                        this.ItemDbClickedMenu = mnu;
                        //this.listView1.DoubleClick += new EventHandler(listView1_DoubleClick);
                        break;
                    }
                    }
                }
            }
            listViewObj.Tag = this;
        }
示例#30
0
        private List <ViewBreadCrumb> GetBreadCrumbList(string Id, string menuId)
        {
            DbDataContext         db             = new DbDataContext("CloudAppWebSite");
            List <ViewBreadCrumb> breadCrumbList = new List <ViewBreadCrumb>();
            int orgId     = GetOrganizationId();
            int intMenuId = Convert.ToInt32(menuId);
            int intId     = Convert.ToInt32(Id);

            if (intMenuId != 0)
            {
                ViewBreadCrumb breadCrumb3 = new ViewBreadCrumb();
                breadCrumb3.Name  = "";
                breadCrumb3.Url   = "/blog/Admin/Menu/GetMenu/?id=0&page=1";
                breadCrumb3.Level = -1;
                breadCrumbList.Add(breadCrumb3);

                ViewBreadCrumb breadCrumbAll = new ViewBreadCrumb();
                breadCrumbAll.Name  = db.Menus.Where(p => p.OrganizationId == orgId && p.ActiveStatus == EActiveStatus.Active && p.Id == intMenuId).Select(s => s.Name).FirstOrDefault();
                breadCrumbAll.Url   = "";
                breadCrumbAll.Level = 999999;
                breadCrumbList.Add(breadCrumbAll);
                //menuItemList = db.MenuItems.Where(item => item.OrganizationId == orgId && item.MenuId == intMenuId && item.ActiveStatus == EActiveStatus.Active).ToList();

                //ViewBag.ListCount = db.MenuItems.Where(item => item.OrganizationId == orgId && item.MenuId == intMenuId && item.ActiveStatus == EActiveStatus.Active).Count();
            }
            if (intId != 0)
            {
                ViewBreadCrumb breadCrumb3 = new ViewBreadCrumb();
                breadCrumb3.Name  = "";
                breadCrumb3.Url   = "/blog/Admin/Menu/GetMenu/?id=0&page=1";
                breadCrumb3.Level = -1;
                breadCrumbList.Add(breadCrumb3);

                CMenuItem      cm         = db.MenuItems.Where(p => p.OrganizationId == orgId && p.ActiveStatus == EActiveStatus.Active && p.Id == intId).FirstOrDefault();
                ViewBreadCrumb breadCrumb = new ViewBreadCrumb();
                breadCrumb.Name = cm.LanguageValues.FirstOrDefault(s => s.Lang == "TR") != null?cm.LanguageValues.FirstOrDefault(s => s.Lang == "TR").Name : "";

                breadCrumb.Url   = "/blog/Admin/Menu/GetSubMenuItem/?MenuId=0&id=" + cm.Id + "&page=1";
                breadCrumb.Level = 9999;
                breadCrumbList.Add(breadCrumb);

                if (cm.MenuId.HasValue == true)
                {
                    CMenu          subMenu        = db.Menus.Where(p => p.OrganizationId == orgId && p.ActiveStatus == EActiveStatus.Active && p.Id == cm.MenuId).FirstOrDefault();
                    ViewBreadCrumb breadCrumbSubm = new ViewBreadCrumb();
                    breadCrumbSubm.Name  = subMenu.Name;
                    breadCrumbSubm.Url   = "/blog/Admin/Menu/GetSubMenuItem/?MenuId=" + subMenu.Id + "&id=0&page=1";
                    breadCrumbSubm.Level = 0;
                    breadCrumbList.Add(breadCrumbSubm);
                }

                bool listContinue = false;
                int  breadCrumbId = cm.SubMenuId.HasValue == true ? cm.SubMenuId.Value : 0;
                while (listContinue == false)
                {
                    CMenuItem subCat = db.MenuItems.Where(item => item.Id == breadCrumbId && item.ActiveStatus == EActiveStatus.Active && item.OrganizationId == orgId).FirstOrDefault();
                    if (subCat != null)
                    {
                        ViewBreadCrumb breadCrumbSub = new ViewBreadCrumb();
                        breadCrumbSub.Name = subCat.LanguageValues.FirstOrDefault(s => s.Lang == "TR") != null?subCat.LanguageValues.FirstOrDefault(s => s.Lang == "TR").Name : "";

                        breadCrumbSub.Url   = "/blog/Admin/Menu/GetSubMenuItem/?MenuId=0&id=" + subCat.Id + "&page=1";
                        breadCrumbSub.Level = (subCat.Level != 0 ? subCat.Level : 0) + 1;
                        breadCrumbList.Add(breadCrumbSub);
                        breadCrumbId = subCat.SubMenuId.HasValue == true ? subCat.SubMenuId.Value : 0;

                        if (subCat.MenuId.HasValue == true)
                        {
                            CMenu          subMenu        = db.Menus.Where(p => p.OrganizationId == orgId && p.ActiveStatus == EActiveStatus.Active && p.Id == subCat.MenuId).FirstOrDefault();
                            ViewBreadCrumb breadCrumbSubm = new ViewBreadCrumb();
                            breadCrumbSubm.Name  = subMenu.Name;
                            breadCrumbSubm.Url   = "/blog/Admin/Menu/GetSubMenuItem/?MenuId=" + subCat.Id + "&id=0&page=1";
                            breadCrumbSubm.Level = subCat.Level != 0 ? subCat.Level : 0;
                            breadCrumbList.Add(breadCrumbSubm);
                        }

                        if (breadCrumbId == 0)
                        {
                            listContinue = true;
                        }
                    }
                    else
                    {
                        listContinue = true;
                    }
                }
            }
            return(breadCrumbList);
        }