Пример #1
0
        private void GetChartPermission()
        {
            pnlSales.Visible       = cSales.Visible = lblSalesWidth.Visible = pnlReceipt.Visible = cReceipt.Visible = lblReceiptWidth.Visible =
                pnlPayment.Visible = cPayment.Visible = lblPaymentWidth.Visible = pnlPurchase.Visible = cPurchase.Visible = lblPurchaseWidth.Visible = false;
            DataTable datMaster = new DALCommon().GetReferenceTable("FormName,SEL", "FormID", "MenuPermission", "");

            if (datMaster != null && datMaster.Rows.Count > 0)
            {
                pnlSales.Visible = cSales.Visible = lblSalesWidth.Visible = datMaster.AsEnumerable().Where(t => t["FormID"].ToInt32() == (int)clsCommonItems.Forms.Sale).Select(t => Convert.ToBoolean(t["SEL"])).FirstOrDefault() == true;

                if (!pnlSales.Visible)
                {
                    pnlSales.Visible = cSales.Visible = lblSalesWidth.Visible = datMaster.AsEnumerable().Where(t => t["FormID"].ToInt32() == (int)clsCommonItems.Forms.Sale2).Select(t => Convert.ToBoolean(t["SEL"])).FirstOrDefault() == true;
                }

                pnlReceipt.Visible = cReceipt.Visible = lblReceiptWidth.Visible = pnlPayment.Visible = cPayment.Visible = lblPaymentWidth.Visible =
                    datMaster.AsEnumerable().Where(t => t["FormID"].ToInt32() == (int)clsCommonItems.Forms.CrossEntry).Select(t => Convert.ToBoolean(t["SEL"])).FirstOrDefault() == true;

                if (!pnlReceipt.Visible)
                {
                    pnlReceipt.Visible = cReceipt.Visible = lblReceiptWidth.Visible = pnlPayment.Visible = cPayment.Visible = lblPaymentWidth.Visible =
                        datMaster.AsEnumerable().Where(t => t["FormID"].ToInt32() == (int)clsCommonItems.Forms.Sale2).Select(t => Convert.ToBoolean(t["SEL"])).FirstOrDefault() == true;
                }

                pnlPurchase.Visible = cPurchase.Visible = lblPurchaseWidth.Visible = datMaster.AsEnumerable().Where(t => t["FormID"].ToInt32() == (int)clsCommonItems.Forms.Purchase).Select(t => Convert.ToBoolean(t["SEL"])).FirstOrDefault() == true;

                if (!pnlPurchase.Visible)
                {
                    pnlPurchase.Visible = cPurchase.Visible = lblPurchaseWidth.Visible = datMaster.AsEnumerable().Where(t => t["FormID"].ToInt32() == (int)clsCommonItems.Forms.Purchase2).Select(t => Convert.ToBoolean(t["SEL"])).FirstOrDefault() == true;
                }
            }

            pnlFilter.Visible = pnlTile.Visible = (pnlSales.Visible || pnlReceipt.Visible || pnlPayment.Visible || pnlPurchase.Visible);
        }