Пример #1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                if (e.Action == TreeViewAction.ByKeyboard || e.Action == TreeViewAction.ByMouse)
                {
                    lblDescription.Text = e.Node.Tag == null ? "" : e.Node.Tag.ToString();
                }
                PermissionService service = new PermissionService();
                if (e.Node.Parent != null)
                {
                    if (!service.IsUserAccess(e.Node.Text))
                    {
                        throw new ApplicationException("没有权限,无法执行此操作");
                    }
                }
                BillsType billsType = new CacheService().GetBillsType(BILL_TYPE);
                switch (e.Node.Text)
                {
                case "销售单录入":
                    CtrlBillInput ctrlBillInput = new CtrlBillInput();
                    ctrlBillInput.BillsType = billsType;
                    this.AddCtrlIntoPanel(ctrlBillInput);
                    break;

                case "作废我的销售单":
                    CtrlBillOP ctrlBillOPBlank = new CtrlBillOP();
                    ctrlBillOPBlank.BillsType              = billsType;
                    ctrlBillOPBlank.BlankOutButtonVisible  = true;
                    ctrlBillOPBlank.CancelOutButtonVisible = false;
                    ctrlBillOPBlank.MakerConditionEnable   = true;
                    this.AddCtrlIntoPanel(ctrlBillOPBlank);
                    break;

                case "冲销我的销售单":
                    CtrlBillOP ctrlBillOPCancel = new CtrlBillOP();
                    ctrlBillOPCancel.BillsType              = billsType;
                    ctrlBillOPCancel.BlankOutButtonVisible  = false;
                    ctrlBillOPCancel.CancelOutButtonVisible = true;
                    ctrlBillOPCancel.MakerConditionEnable   = true;
                    this.AddCtrlIntoPanel(ctrlBillOPCancel);
                    break;

                case "查询我的销售单":
                    CtrlReport ctrlReportSearch = new CtrlReport();
                    ctrlReportSearch.ReportTemplateFile = System.IO.Path.Combine(Application.StartupPath, @"ReportTemplate/MySalesBills.rdlc");
                    this.AddCtrlIntoPanel(ctrlReportSearch);
                    break;

                case "作废全部销售单":
                    CtrlBillOP ctrlBillOPBlankAll = new CtrlBillOP();
                    ctrlBillOPBlankAll.BillsType              = billsType;
                    ctrlBillOPBlankAll.BlankOutButtonVisible  = true;
                    ctrlBillOPBlankAll.CancelOutButtonVisible = false;
                    ctrlBillOPBlankAll.MakerConditionEnable   = true;
                    this.AddCtrlIntoPanel(ctrlBillOPBlankAll);
                    break;

                case "冲销全部销售单":
                    CtrlBillOP ctrlBillOPCancelALL = new CtrlBillOP();
                    ctrlBillOPCancelALL.BillsType              = billsType;
                    ctrlBillOPCancelALL.BlankOutButtonVisible  = false;
                    ctrlBillOPCancelALL.CancelOutButtonVisible = true;
                    ctrlBillOPCancelALL.MakerConditionEnable   = true;
                    this.AddCtrlIntoPanel(ctrlBillOPCancelALL);
                    break;

                case "查询全部销售单":
                    CtrlBillOP ctrlBillOPSearchAll = new CtrlBillOP();
                    ctrlBillOPSearchAll.BillsType              = billsType;
                    ctrlBillOPSearchAll.BlankOutButtonVisible  = false;
                    ctrlBillOPSearchAll.CancelOutButtonVisible = true;
                    ctrlBillOPSearchAll.MakerConditionEnable   = true;
                    this.AddCtrlIntoPanel(ctrlBillOPSearchAll);
                    break;

                case "客户退货单录入":
                    CtrlBillInput ctrlBillInputReturn = new CtrlBillInput();
                    ctrlBillInputReturn.BillsType = new CacheService().GetBillsType("客方退货");
                    this.AddCtrlIntoPanel(ctrlBillInputReturn);
                    break;

                case "客户退货单作废":
                    CtrlBillOP ctrlBillOPBlankReturn = new CtrlBillOP();
                    ctrlBillOPBlankReturn.BillsType              = new CacheService().GetBillsType("己方退货");
                    ctrlBillOPBlankReturn.BlankOutButtonVisible  = true;
                    ctrlBillOPBlankReturn.CancelOutButtonVisible = false;
                    ctrlBillOPBlankReturn.MakerConditionEnable   = true;
                    this.AddCtrlIntoPanel(ctrlBillOPBlankReturn);
                    break;

                case "客户退货单查询":

                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.OnError(ex);
            }
        }
Пример #2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                if (e.Action == TreeViewAction.ByKeyboard || e.Action == TreeViewAction.ByMouse)
                {
                    lblDescription.Text = e.Node.Tag == null ? "" : e.Node.Tag.ToString();
                }

                PermissionService service = new PermissionService();
                if (e.Node.Parent != null)
                {
                    if (!service.IsUserAccess(e.Node.Text))
                    {
                        throw new ApplicationException("权限不足,无法执行此操作!");
                    }
                }

                switch (e.Node.Text)
                {
                case "销货单录入":
                    CtrlBillInput ctrl = new CtrlBillInput();
                    this.AddCtrlIntoPanel(ctrl);
                    ctrl.BillType    = new CacheService().GetBillType(BILL_TYPE);
                    ctrl.CompanyType = Tg029.Storage.Model.CompanyType.Customer;
                    break;

                case "作废我的销货单":
                    CtrlBillOp ctrlOp = new CtrlBillOp();
                    this.AddCtrlIntoPanel(ctrlOp);
                    ctrlOp.BillType = new CacheService().GetBillType(BILL_TYPE);
                    ctrlOp.CancelOutButtonVisible = false;
                    ctrlOp.BlankOutButtonVisible  = true;
                    ctrlOp.MakerConditionVisible  = false;
                    break;

                case "冲销我的销货单":
                    CtrlBillOp ctrlC = new CtrlBillOp();
                    this.AddCtrlIntoPanel(ctrlC);
                    ctrlC.BillType = new CacheService().GetBillType(BILL_TYPE);
                    ctrlC.BlankOutButtonVisible  = false;
                    ctrlC.CancelOutButtonVisible = true;
                    ctrlC.MakerConditionVisible  = false;
                    break;

                case "作废全部销货单":
                    CtrlBillOp ctrlOpAll = new CtrlBillOp();
                    this.AddCtrlIntoPanel(ctrlOpAll);
                    ctrlOpAll.BillType = new CacheService().GetBillType(BILL_TYPE);
                    ctrlOpAll.CancelOutButtonVisible = false;
                    ctrlOpAll.BlankOutButtonVisible  = true;
                    ctrlOpAll.MakerConditionVisible  = true;
                    break;

                case "冲销全部销货单":
                    CtrlBillOp ctrlCAll = new CtrlBillOp();
                    ctrlCAll.BillType = new CacheService().GetBillType(BILL_TYPE);
                    ctrlCAll.CancelOutButtonVisible = true;
                    ctrlCAll.BlankOutButtonVisible  = false;
                    ctrlCAll.MakerConditionVisible  = true;
                    break;

                case "客户退货单录入":
                    CtrlBillInput cbi = new CtrlBillInput();
                    this.AddCtrlIntoPanel(cbi);
                    cbi.BillType    = new CacheService().GetBillType("客户退货单");
                    cbi.CompanyType = Tg029.Storage.Model.CompanyType.Customer;
                    break;

                case "客户退还单作废":
                    CtrlBillOp cbo = new CtrlBillOp();
                    this.AddCtrlIntoPanel(cbo);
                    cbo.BillType = new CacheService().GetBillType("客户退货单");
                    cbo.BlankOutButtonVisible  = true;
                    cbo.CancelOutButtonVisible = false;
                    cbo.MakerConditionVisible  = true;
                    break;

                case "查询我的销货单":
                    CtrlReport rpt = new CtrlReport();
                    rpt.ReportTemplateFile   = System.IO.Path.Combine(Application.StartupPath, "MySalesBill.grf");
                    rpt.IsSupportChildReport = true;
                    this.AddCtrlIntoPanel(rpt);

                    break;

                case "按商品汇总销量":
                    CtrlReport rpt1 = new CtrlReport();
                    rpt1.ReportTemplateFile   = System.IO.Path.Combine(Application.StartupPath, "RptSalesByGoods.grf");
                    rpt1.IsSupportChildReport = false;
                    this.AddCtrlIntoPanel(rpt1);
                    break;

                default:

                    break;
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.OnError(ex);
            }
        }