예제 #1
0
        public static List<Object> InitInPhieu(ContextMenuStrip mnuIn, PLCPhieu Phieu, IDDOPhieu DOData)
        {
            List<object> items = new List<object>();

            System.Windows.Forms.ToolStripMenuItem item;
            item = new System.Windows.Forms.ToolStripMenuItem();
            item.Name = "itemXemTruocKhiIn";
            item.Text = "Xem trước khi in";
            item.Click += delegate(object sender, EventArgs e)
            {
                Phieu.GetPrintObj((XtraForm)mnuIn.FindForm(), new long[] { DOData.GetID() }).execPreviewWith();
            };
            mnuIn.Items.Add(item);
            ApplyPermissionAction.ApplyPermissionObject(items, item, Phieu.GetPhieuType().AllowIn);
            //Perm.Add(Phieu.GetPhieuType().AllowIn);

            item = new System.Windows.Forms.ToolStripMenuItem();
            item.Name = "itemIn";
            item.Text = "In";
            item.Click += delegate(object sender, EventArgs e)
            {
                Phieu.GetPrintObj((XtraForm)mnuIn.FindForm(), new long[] { DOData.GetID() }).execDirectlyPrint();
            };

            mnuIn.Items.Add(item);
            ApplyPermissionAction.ApplyPermissionObject(items, item, Phieu.GetPhieuType().AllowIn);
            //Perm.Add(Phieu.GetPhieuType().AllowIn);

            return items;
        }
예제 #2
0
        //Còn vấn đề phân quyền
        public static List<Object> InitNghiepVu(ContextMenuStrip mnuNghiepVu, PhieuType PhieuFrom, object DOData)
        {
            List<Object> list = new List<Object>();

            List<PhieuType> Phieus = PhieuFrom.CanCreateList;
            ToolStripMenuItem[] Items = new ToolStripMenuItem[Phieus.Count];
            for (int i = 0; i < Phieus.Count; i++)
            {
                PhieuType PhieuTo = Phieus[i];
                ToolStripMenuItem item = new ToolStripMenuItem();
                item.Name = PhieuTo.GetDOName();
                //this.item.Size = new System.Drawing.Size(286, 22);
                item.Text = "Tạo " + PhieuTo.GetTitle();
                item.Click += delegate(object sender, EventArgs e)
                {
                    ProtocolForm.ShowModalForm((XtraForm)mnuNghiepVu.FindForm(), PhieuTo.GetFormClassName(), DOData);
                };
                Items[i] = item;
                ApplyPermissionAction.ApplyPermissionObject(list, Items[i], PhieuTo.AllowAdd);
                //list.Add(PhieuTo.AllowAdd);
            }

            if (Items.Length == 0)
                mnuNghiepVu.Visible = false;
            else
                mnuNghiepVu.Items.AddRange(Items);

            return list;
        }
예제 #3
0
		static internal void ShowAddWsContextMenu(ContextMenuStrip cmnuAddWs,
			IEnumerable<IWritingSystem> wssToAdd, ListBox listToAddTo, Button button,
			EventHandler clickHandlerExistingWs, EventHandler clickHandlerNewWs,
			EventHandler clickHandlerNewWsFromSelected, IWritingSystem selectedWs)
		{
			try
			{
				PopulateWsContextMenu(cmnuAddWs, wssToAdd, listToAddTo, clickHandlerExistingWs, clickHandlerNewWs,
					clickHandlerNewWsFromSelected, selectedWs);
				cmnuAddWs.Show(button, new Point(0, button.Height));
			}
			catch (Exception e)
			{
				Form form = cmnuAddWs.FindForm();
				Control owner = null;
				if (form != null)
					owner = form.Owner;
				MessageBoxUtils.Show(owner,
					string.Format(ResourceHelper.GetResourceString("kstidMiscErrorWithMessage"), e.Message),
					ResourceHelper.GetResourceString("kstidMiscError"));
			}
		}