Ejemplo n.º 1
0
        public ActionResult Dashboard()
        {
            //GET LOGIN SHOP DETAILS
            var username = HttpContext.Session["UserName"].ToString();

            // IF EXCEPT SUPERADMIN LOGIN THEN SHOW SHOP OR GODOWN
            if (username != "SuperAdmin")
            {
                int modulelastcount = _iIModuleService.GetLastRow().Id;
                var AssignRights    = _IUserCredentialService.GetUserCredentialsByEmail(UserEmail);
                if (AssignRights.Count() == 0)
                {
                    TempData["NotEnoughRights"] = "Yes";
                    return(RedirectToAction("Login", "User"));
                }
                else
                {
                    int rightscount = 0;
                    for (int i = 96; i <= modulelastcount; i++)
                    {
                        var assigndetails = _IUserCredentialService.GetDetailsByEmailStatusAndModuleId(UserEmail, i);
                        if (assigndetails != null)
                        {
                            Session["LOGINSHOPGODOWNCODE"] = assigndetails.AssignRightsCode;
                            Session["SHOPGODOWNNAME"]      = assigndetails.Modules;
                            break;
                        }
                        else
                        {
                            rightscount++;
                        }
                    }
                    if (modulelastcount - 96 == rightscount)
                    {
                        Session["LOGINSHOPGODOWNCODE"] = null;
                        Session["SHOPGODOWNNAME"]      = null;
                    }
                }
            }

            MainApplication model = new MainApplication();

            model.userCredentialList = _IUserCredentialService.GetUserCredentialsByEmail(UserEmail);
            model.modulelist         = _iIModuleService.getAllModules();
            model.CompanyCode        = CompanyCode;
            model.CompanyName        = CompanyName;
            model.FinancialYear      = FinancialYear;

            string loggedinshopname = Session["SHOPGODOWNNAME"] as string;

            TempData["PendingPoes"]             = _IPurchaseOrderDetailService.GetPendingPo("Pending");
            TempData["Inward"]                  = _IPurchaseOrderDetailService.GetInwardDetailsByDate();
            TempData["OutwardToShop"]           = _OutwardToShopService.GetDailyOutwardsToShop();
            TempData["OutwardShopToGodown"]     = _OutwardShopToGodownService.GetDailyOutwardsToGodown();
            TempData["OutwardInterGodown"]      = _OutwardInterGodownService.GetDailyOutwardInterGodown();
            TempData["OutwardInterShop"]        = _OutwardInterShopService.GetDailyOutwardInterShop();
            TempData["OutwardToClient"]         = _IOutwardToClientService.GetOutWardToClientByDate();
            TempData["InwardWithoutPO"]         = _InwardFromSupplierService.GetDailyInwardWithoutPo();
            TempData["InwardFromGodown"]        = _InwardFromGodownService.GetDailyInwardsFromGodown();
            TempData["InwardShopToGodown"]      = _InwardFromShopToGodownService.GetDailyInwardsShopToGodown();
            TempData["InwardInterGodown"]       = _InwardInterGodownService.GetDailyInwardInterGodown();
            TempData["InwardInterShop"]         = _InwardInterShopService.GetDailyInwardInterShop();
            TempData["EntryStock"]              = _EntryStockItemService.GetAllItems();
            TempData["ShopStock"]               = _IShopStockService.GetShopStockTillDate();
            TempData["GodownStock"]             = _GodownStockService.GetGodownStockTillDate();
            TempData["RetailBill"]              = _IRetailInvoiceMasterService.GetRetailBillByDate();
            TempData["SalesBill"]               = _ISalesBillService.GetSalesBillByDate();
            TempData["Quotations"]              = _QuotationService.GetDailyQuotations();
            TempData["SalesOrders"]             = _SalesOrderService.GetDailySalesOrders();
            TempData["DeliveryChallans"]        = _DeliveryChallanService.GetDailyChallans();
            TempData["SalesReturns"]            = _SalesReturnService.GetDailySalesReturns();
            TempData["PurchaseReturns"]         = _PurchaseReturnService.GetDailyPurchaseReturns();
            TempData["CashierSalesOrder"]       = _CashierSalesOrderService.GetDailyCashierSalesOrder();
            TempData["CashierRetailBill"]       = _CashierRetailBillService.GetDailyCashierRetailBill();
            TempData["CashierTempCashMemo"]     = _CashierTemporaryCashMemoService.GetDailyCashierTempCashMemo();
            TempData["CashierSalesBill"]        = _CashierSalesBillService.GetDailyCashierSalesBill();
            TempData["CashierRefundOrder"]      = _CashierRefundOrderService.GetDailyCashierRefundOrder();
            TempData["CashHandover"]            = _CashHandoverService.GetDailyCashHandover();
            TempData["CardChequeHandover"]      = _CardChequeHandoverService.GetDailyCardChequeHandover();
            TempData["IncomeExchangeVoucher"]   = _IncomeExchangeVoucherService.GetDailyIncomeExchangeVoucher();
            TempData["Requisitionsshops"]       = _RequisitionForShopService.GetDailyRequisitionsForShops(loggedinshopname);
            TempData["Requisitionsgodowns"]     = _RequisitionForShopService.GetDailyRequisitionsForGodowns(loggedinshopname);
            TempData["Requisitionssuperadmin"]  = _RequisitionForShopService.GetDailyRequisitionsForSuperAdmin(loggedinshopname);
            TempData["Requisitionsgodowns1"]    = _RequisitionForGodownService.GetDailyRequisitionsForGodowns(loggedinshopname);
            TempData["Requisitionssuperadmin1"] = _RequisitionForGodownService.GetDailyRequisitionsForSuperAdmin(loggedinshopname);

            //DASHBOARD FOR LOGIN PERSON FOR EXCEPT SUPERADMIN
            var loginuserdetails = _EmployeeMasterService.getEmpByEmail(UserEmail);

            TempData["EmployeeDesignation"] = loginuserdetails.Designation;
            TempData["EmployeeDepartment"]  = loginuserdetails.department;
            if (loginuserdetails.Designation == "PurchaseManager")
            {
                Session["LOGINSHOPGODOWNCODE"] = "PurchaseManager";
                Session["SHOPGODOWNNAME"]      = "PurchaseManager";
            }
            return(View(model));
        }