public List <SelectListItem> CategoryDropDown()
        {
            AuctionInventoryEntities db = new AuctionInventoryEntities();

            var listItems = new List <SelectListItem>();

            listItems.Add(new SelectListItem {
                Text = "Upto", Value = "Upto"
            });
            listItems.Add(new SelectListItem {
                Text = "Greater Than", Value = "Greater Than"
            });
            listItems.Add(new SelectListItem {
                Text = "Less Than", Value = "Less Than"
            });
            listItems.Add(new SelectListItem {
                Text = "Between", Value = "Between"
            });
            return(listItems);


            //var list = (from c in db.MCategories
            //            select new SelectListItem
            //            {
            //                Text = c.strCategoryName,
            //                Value = c.iCategoryID.ToString()
            //            }).ToList();
            //return list;
        }
        public JsonResult SavePageAccessByRole(int roleId, int[] pageValue)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //dc.tbl_AuthorizedPages.RemoveRange(dc.tbl_AuthorizedPages.Where(x => x.RoleId == roleId));
                    //dc.SaveChanges();
                    AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
                    for (int i = 0; i < pageValue.Length; i++)
                    {
                        tbl_AuthorizedPages authorizedPages = new tbl_AuthorizedPages();
                        authorizedPages.RoleId   = roleId;
                        authorizedPages.PageId   = pageValue[i];
                        authorizedPages.PageName = "salman";
                        auctionContext.tbl_AuthorizedPages.Add(authorizedPages);
                        auctionContext.SaveChanges();
                    }


                    return(Json(new { result = true }, JsonRequestBehavior.AllowGet));
                }
            }

            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                throw e;
            }
            return(Json(new { result = false }, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public static UserLogin GetUserSession(UserLogin logins)
        {
            AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
            UserLogin userLogin = auctionContext.UserLogins.Where(x => x.UserName == logins.UserName && x.Password == logins.Password).FirstOrDefault();

            return(userLogin);
        }
        public JsonResult SavePageAccessByRole(int roleId, int[] pageValue)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
                    var getRoles = auctionContext.ControllerAccessRights.Where(x => x.iRoleID == roleId).ToList();

                    for (int i = 0; i < pageValue.Length; i++)
                    {
                        foreach (var item in getRoles)
                        {
                            if (item.iControllerID == pageValue[i])
                            {
                                item.ysnAccessStatus = true;
                                break;
                            }
                        }
                    }
                    auctionContext.SaveChanges();

                    return(Json(new { result = true }, JsonRequestBehavior.AllowGet));
                }
            }

            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                throw e;
            }
            return(Json(new { result = false }, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        public ActionResult ShowPartyName()
        {
            AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
            var partyList = auctionContext.AccountParties.ToList();

            //var partyName = partyList.Select(a => a.strFirstName).ToList();
            return(Json(partyList, JsonRequestBehavior.AllowGet));
        }
        public dynamic GetSalesData()
        {
            using (AuctionInventoryEntities dc = new AuctionInventoryEntities())
            {
                var jsonData = new
                {
                    total   = 1,
                    page    = 1,
                    records = dc.Sales.ToList().Count,
                    rows    = (
                        from sales in
                        (from AM in dc.Sales
                         join t2 in dc.PaperTypes on AM.iImpExpTransfer equals t2.iPaperModeID
                         join t3 in dc.PaymentTypes on AM.iPaymentType equals t3.iCashID

                         select new
                    {
                        iSaleID = AM.iSaleID,
                        iSaleFrontEndID = AM.iSaleFrontEndID,
                        iSalesInvoiceID = AM.iSalesInvoiceID,

                        strSalesInvoiceNo = AM.strSalesInvoiceNo,

                        iImpExpTransfer = AM.iImpExpTransfer,
                        iPaymentType = AM.iPaymentType,

                        iCustomerID = AM.iCustomerID,

                        strBuyerName = AM.strBuyerName,
                        strSalesDate = AM.strSalesDate,
                        dmlSellingPrice = AM.dmlSellingPrice,
                        dmlDeposit = AM.dmlDeposit,
                        dmlAdvance = AM.dmlAdvance,
                        dmlBalance = AM.dmlBalance,
                        iInstallment = AM.iInstallment,
                        strCashName = t3.strCashName,
                        strPaperModeName = t2.strPaperModeName
                    }).OrderBy(a => a.strSalesInvoiceNo).ToList()
                        select new
                    {
                        id = sales.iSaleID,
                        cell = new string[] {
                            Convert.ToString(sales.iSaleID), Convert.ToString(sales.iSaleFrontEndID), Convert.ToString(sales.iSalesInvoiceID),
                            Convert.ToString(sales.strSalesInvoiceNo),
                            Convert.ToString(sales.iImpExpTransfer), Convert.ToString(sales.iPaymentType), Convert.ToString(sales.iCustomerID)
                            , Convert.ToString(sales.strBuyerName), Convert.ToString(sales.strSalesDate)
                            , Convert.ToString(sales.dmlSellingPrice), Convert.ToString(sales.dmlDeposit), Convert.ToString(sales.dmlAdvance), Convert.ToString(sales.dmlBalance)
                            , Convert.ToString(sales.iInstallment), Convert.ToString(sales.strCashName), Convert.ToString(sales.strPaperModeName)
                        }
                    }).ToArray()
                };
                return(jsonData);
            }
            //return View();
        }
Beispiel #7
0
        public dynamic GetAuctionListData()
        {
            using (AuctionInventoryEntities dc = new AuctionInventoryEntities())
            {
                var preResult = (from AM in dc.AuctionLists

                                 select new
                {
                    //iAuctionListID = AM.iAuctionListID,
                    iAuctionFrontEndID = AM.iAuctionFrontEndID,
                    strAuctionDate = AM.strAuctionDate,
                    dtAuctionDate = AM.dtAuctionDate,
                    iVehicleID = AM.iVehicleID,
                }).ToList();

                if (preResult.Count > 0)
                {
                    var result = preResult.GroupBy(a => a.strAuctionDate).Select(y =>
                                                                                 new
                    {
                        strAuctionDate     = y.Key,
                        iAuctionFrontEndID = y.First().iAuctionFrontEndID,
                        dtAuctionDate      = y.First().dtAuctionDate,
                        iVehicleID         = y.Count(),
                    }).ToList();

                    var rows = (from AM in result
                                select new
                    {
                        id = AM.iAuctionFrontEndID,
                        cell = new string[] {
                            Convert.ToString(AM.iAuctionFrontEndID), Convert.ToString(AM.dtAuctionDate), Convert.ToString(AM.strAuctionDate), Convert.ToString(AM.iVehicleID)
                        }
                    }).ToArray();



                    var jsonData = new
                    {
                        total = 1,
                        page  = 1,
                        // records = dc.Vehicles.ToList().Count,
                        rows = rows
                    };

                    return(jsonData);
                }
                else
                {
                    return(null);
                }
            }
        }
        public bool SaveDataVehicleExpense(List <VehicleExpenseModel> expenses, int id)
        {
            AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
            bool status = true;
            //Expenses expense = new Expenses();
            ExpensesRepository repo = new ExpensesRepository();

            string refenceNumber = CommonMethods.GetRefenceNumber(ShortCode.ExpenseKey, "1");

            status = repo.SaveRepoVehicleExpense(ParserAddVehicleExpenses(expenses), refenceNumber, id);
            return(status);
        }
        public string saveGeneralExpense(GeneralExpenses genexpense)
        {
            AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
            //bool status = true;
            string savedBillNum = string.Empty;
            //Expenses expense = new Expenses();
            ExpensesRepository repo = new ExpensesRepository();


            savedBillNum = repo.GeneralExpenseSaveEdit(ParserAddGeneralExpenses(genexpense));
            return(savedBillNum);
        }
        public override string[] GetRolesForUser(string username)
        {
            string url = HttpContext.Current.Request.Url.AbsoluteUri;
            // http://localhost:1302/TESTERS/Default6.aspx

            string path = HttpContext.Current.Request.Url.AbsolutePath;
            // /TESTERS/Default6.aspx

            string host = HttpContext.Current.Request.Url.Host;
            // localhost


            AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
            string data = auctionContext.UserLogins.Where(x => x.UserName == username).FirstOrDefault().RoleId.ToString();

            string[] results = { data };
            return(results);
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            string actionName      = filterContext.ActionDescriptor.ActionName;
            string controllerName  = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
            var    user            = (UserLogin)HttpContext.Current.Session["UserProfile"];// filterContext.HttpContext.Session.GetUser();
            bool   IsPageAuthorize = true;

            if (user == null)
            {
                //send them off to the login page
                var url      = new UrlHelper(filterContext.RequestContext);
                var loginUrl = url.Content("~/Login/Index");
                filterContext.HttpContext.Response.Redirect(loginUrl, true);
            }

            if (user != null)
            {
                int roleId = 0;
                int.TryParse(user.RoleId.ToString(), out roleId);


                // Do not uncomment -- need to done by Salman
                AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
                // bool IsPageAuthorize = auctionContext.tbl_AuthorizedPages.Where(x => x.RoleId == roleId && x.PageName == controllerName).Any();


                if (!IsPageAuthorize)
                {
                    //send them off to the login page
                    var url      = new UrlHelper(filterContext.RequestContext);
                    var loginUrl = url.Content("~/Home/Unauthorized");
                    filterContext.HttpContext.Response.Redirect(loginUrl, true);
                    // throw new AuthenticationException("You do not have the necessary permission to perform this action");
                }
                //Do Not Delete -- Will use in future for addtional permissions
                //else
                //{
                //    if (!user.HasPermissions(required))
                //    {
                //        throw new AuthenticationException("You do not have the necessary permission to perform this action");
                //    }
                //}
            }
        }
Beispiel #12
0
        public ActionResult GetSaleVehicleBySalesFrntID(int id)
        {
            AuctionInventoryEntities dc = new AuctionInventoryEntities();
            //List<Vehicle> listVehicle = (from t1 in auctionContext.Vehicles
            var listVehicle = (
                from t1 in dc.SalesVehicles
                join t2 in dc.Vehicles on t1.iVehicleID equals t2.iVehicleID
                join t3 in dc.TPurchases on t2.PurchaseID equals t3.PurchaseID
                where t1.iSaleFrontEndID == id


                select new
            {
                iSalesVehicleID = t1.iSalesVehicleID,
                iVehicleID = t2.iVehicleID,
                iLotNum = t2.iLotNum,
                strChassisNum = t2.strChassisNum,
                strMake = t2.strMake,
                iModel = t2.iModel,
                //strCategory = t2.strCategory,
                iYear = t2.iYear,
                strColor = t2.strColor,
                // strOrigin = t2.strOrigin,
                //strLocation = t2.strLocation,
                //iCustomAssesVal = t2.iCustomAssesVal,
                //iDuty = t2.iDuty,
                iCustomValInJPY = t2.iCustomValInJPY + t2.dcmlExpenseAmount,
                //,strGrade =t1.strGrade,

                DHM = ((t2.iCustomValInJPY != null ? t2.iCustomValInJPY : 0) + (t2.dcmlExpenseAmount != null ? t2.dcmlExpenseAmount : 0)) * (t3.dmlConversionRate != null ? t3.dmlConversionRate : 0),

                //dmlKM = t1.dmlKM,

                //iDoor = t1.iDoor,

                //weight = t1.weight,
                //strHSCode = t1.strHSCode,
                //ATMT = t1.ATMT,
            }).ToList();


            return(Json(new { listVehicle }, JsonRequestBehavior.AllowGet));
        }
Beispiel #13
0
        public ActionResult GetGetAuctionListDataBYAuctionFrntID(int id)
        {
            AuctionInventoryEntities dc = new AuctionInventoryEntities();
            //List<Vehicle> listVehicle = (from t1 in auctionContext.Vehicles
            var listVehicle = (
                from t1 in dc.AuctionLists
                join t2 in dc.Vehicles on t1.iVehicleID equals t2.iVehicleID

                where t1.iAuctionFrontEndID == id


                select new
            {
                iAuctionFrontEndID = t1.iAuctionFrontEndID,
                iVehicleID = t2.iVehicleID,
                iLotNum = t2.iLotNum,
                strChassisNum = t2.strChassisNum,
                //strMake = t2.strMake,
                iModel = t2.iModel,
                //strCategory = t2.strCategory,
                iYear = t2.iYear,
                strColor = t2.strColor,
                // strOrigin = t2.strOrigin,
                //strLocation = t2.strLocation,
                //iCustomAssesVal = t2.iCustomAssesVal,
                //iDuty = t2.iDuty,
                iCustomValInJPY = t2.iCustomValInJPY
                                  //,strGrade =t1.strGrade,


                                  //dmlKM = t1.dmlKM,

                                  //iDoor = t1.iDoor,

                                  //weight = t1.weight,
                                  //strHSCode = t1.strHSCode,
                                  //ATMT = t1.ATMT,
            }).ToList();


            return(Json(new { listVehicle }, JsonRequestBehavior.AllowGet));
        }
        public dynamic GetExportData()
        {
            using (AuctionInventoryEntities dc = new AuctionInventoryEntities())
            {
                var jsonData = new
                {
                    total   = 1,
                    page    = 1,
                    records = dc.PaperDetailsForExports.ToList().Count,
                    rows    = (
                        from export in
                        (from t1 in dc.PaperDetailsForExports
                         join t2 in dc.Vehicles on t1.iVehicleID equals t2.iVehicleID

                         select new
                    {
                        iPaperDetailsForExportID = t1.iPaperDetailsForExportID,
                        iVehicleID = t1.iVehicleID,
                        iCustApproval = t1.iCustApproval,
                        strChassisNum = t2.strChassisNum,
                        iModel = t2.iModel,
                        strReceivingDate = t1.strReceivingDate,
                        strSubmitDate = t1.strSubmitDate,
                        //iImpDeposit = t1.iImpDeposit,
                        dcmlDeduction = t1.dcmlDeduction,
                        dcmlFine = t1.dcmlFine,
                        dcmlMisc = t1.dcmlMisc,
                        dcmlExportDeposit = t1.dcmlExportDeposit,
                        dcmlExportBalance = t1.dcmlExportBalance
                    }).ToList()
                        select new
                    {
                        id = export.iPaperDetailsForExportID,
                        cell = new string[] {
                            Convert.ToString(export.iPaperDetailsForExportID), Convert.ToString(export.iVehicleID), Convert.ToString(export.iCustApproval),
                            Convert.ToString(export.strChassisNum), Convert.ToString(export.iModel), Convert.ToString(export.strReceivingDate), Convert.ToString(export.strSubmitDate), Convert.ToString(export.dcmlDeduction), Convert.ToString(export.dcmlFine), Convert.ToString(export.dcmlMisc), Convert.ToString(export.dcmlExportDeposit), Convert.ToString(export.dcmlExportBalance)
                        }
                    }).ToArray()
                };
                return(jsonData);
            }
        }
        public dynamic GetImportData()
        {
            using (AuctionInventoryEntities dc = new AuctionInventoryEntities())
            {
                var jsonData = new
                {
                    total   = 1,
                    page    = 1,
                    records = dc.PaperDetailsForImports.ToList().Count,
                    rows    = (
                        from import in
                        (from t1 in dc.PaperDetailsForImports
                         join t2 in dc.Vehicles on t1.iVehicleID equals t2.iVehicleID

                         select new
                    {
                        iPaperDetailsForImportID = t1.iPaperDetailsForImportID,
                        iVehicleID = t1.iVehicleID,
                        strChassisNum = t2.strChassisNum,
                        iModel = t2.iModel,
                        iDecNo = t1.iDecNo,
                        strDecDate = t1.strDecDate,
                        dcmlImpDeposit = t1.dcmlImpDeposit,
                        dcmlDuty = t1.dcmlDuty,
                        dcmlPaper = t1.dcmlPaper,
                        dcmlTotal = t1.dcmlTotal,
                        dcmlImpBalance = t1.dcmlImpBalance
                    }).ToList()
                        select new
                    {
                        id = import.iPaperDetailsForImportID,
                        cell = new string[] {
                            Convert.ToString(import.iPaperDetailsForImportID), Convert.ToString(import.iVehicleID),
                            Convert.ToString(import.strChassisNum), Convert.ToString(import.iModel),
                            Convert.ToString(import.iDecNo), Convert.ToString(import.strDecDate), Convert.ToString(import.dcmlImpDeposit), Convert.ToString(import.dcmlDuty), Convert.ToString(import.dcmlPaper), Convert.ToString(import.dcmlTotal), Convert.ToString(import.dcmlImpBalance)
                        }
                    }).ToArray()
                };
                return(jsonData);
            }
        }
Beispiel #16
0
        public JsonResult GetCustomerDetailsBYCustomerID(int id)
        {
            AuctionInventoryEntities dc = new AuctionInventoryEntities();

            var customer = (
                from t1 in dc.MCustomers
                where t1.iCustomerID == id


                select new
            {
                //iCustomerID = t1.iCustomerID,
                //strFirstName = t1.strFirstName,
                //strMiddleName = t1.strMiddleName,
                //strLastName = t1.strLastName,
                iPhoneNumber = t1.iPhoneNumber,
                strCreditLimit = t1.strCreditLimit,
                //Address = t1.Address
            }).ToList();


            return(Json(customer, JsonRequestBehavior.AllowGet));
        }
        public dynamic GetAllVehicleExpensesByInvoiceID(int id)
        {
            using (AuctionInventoryEntities dc = new AuctionInventoryEntities())
            {
                var jsonData = new
                {
                    total   = 1,
                    page    = 1,
                    records = dc.VehicleExpenses.ToList().Count,
                    rows    = (
                        from vehi in
                        (from AM in dc.VehicleExpenses
                         where AM.iPurchaseInvoiceID == id

                         select new
                    {
                        iVehicleExpenseID = AM.iVehicleExpenseID,
                        iPurchaseInvoiceID = AM.iPurchaseInvoiceID,
                        strPurchaseInvoiceNo = AM.strPurchaseInvoiceNo,
                        iExpenseID = AM.iExpenseID,
                        dcmlExpenseAmount = AM.dcmlExpenseAmount,
                        dcmlTotalExpenseAmount = AM.dcmlTotalExpenseAmount,
                        //iSpreadAmountPerVehicle = AM.dcmlTotalExpenseAmount
                    }).ToList()
                        select new
                    {
                        id = vehi.iVehicleExpenseID,
                        cell = new string[] {
                            Convert.ToString(vehi.iVehicleExpenseID), Convert.ToString(vehi.iPurchaseInvoiceID), Convert.ToString(vehi.strPurchaseInvoiceNo), Convert.ToString(vehi.iExpenseID), Convert.ToString(vehi.dcmlExpenseAmount), Convert.ToString(vehi.dcmlTotalExpenseAmount)
                        }
                    }).ToArray()
                };
                return(jsonData);
            }
            //return View();
        }
Beispiel #18
0
        public bool SaveEdit(Supplier supplier, HttpPostedFileBase file)
        {
            AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
            SupplierRepository       repoSupplier   = new SupplierRepository();
            string password = CommonMethods.GetPassword();

            if (repoSupplier.SaveEdit(GetMSupplier(supplier), file, password)) //Checking Supplier insert status

            {
                UserLogin userLogin = new UserLogin();
                userLogin.Email     = supplier.strEmailID;
                userLogin.Password  = password;
                userLogin.UserName  = supplier.strEmailID;
                userLogin.RoleId    = 2;
                userLogin.IsActive  = true;
                userLogin.IsDeleted = false;
                userLogin.IsValid   = true;

                LoginRepository repoLogin = new LoginRepository();

                return(repoLogin.SaveLoginDetails(userLogin));
            }
            return(false);
        }
        public dynamic GetAllVehicleExpensesListData()
        {
            using (AuctionInventoryEntities dc = new AuctionInventoryEntities())
            {
                var preResult = (from a in dc.VehicleExpenses
                                 //join b in dc.MExpenses on a.iExpenseID equals b.iExpenseID
                                 where (a.iPurchaseInvoiceID != null && a.iPurchaseInvoiceID != 0)
                                 select new
                {
                    iExpenseKey = a.strExpenseKey,
                    iVehicleExpenseID = a.iVehicleExpenseID,
                    iExpenseID = a.iExpenseID,

                    //NoOfExpenses = a.Expenses.Count,

                    strPurchaseInvoiceNo = a.strPurchaseInvoiceNo,

                    iPurchaseInvoiceID = a.iPurchaseInvoiceID,
                    strExpenseDate = a.strExpenseDate,
                    //strExpenseName = b.strExpenseName,
                    dcmlExpenseAmount = a.dcmlExpenseAmount,
                    dcmlTotalExpenseAmount = a.dcmlTotalExpenseAmount,
                    iSpreadAmountPerVehicle = a.dcmlTotalExpenseAmount,

                    dcmlDOExpenseAmount = a.dcmlDOExpenseAmount,
                    dcmlDPAExpenseAmount = a.dcmlDPAExpenseAmount,
                    dcmlRAMPExpenseAmount = a.dcmlRAMPExpenseAmount,
                    dcmlTRANSPORTExpenseAmount = a.dcmlTRANSPORTExpenseAmount,
                    dcmlRECOVERYExpenseAmount = a.dcmlRECOVERYExpenseAmount,
                }).ToList();
                if (preResult.Count > 0)
                {
                    var results = preResult.GroupBy(x => x.strPurchaseInvoiceNo).Select(y =>
                                                                                        new
                    {
                        strPurchaseInvoiceNo = y.Key,
                        dcmlExpenseAmount    = y.Sum(x => x.dcmlExpenseAmount),
                        iPurchaseInvoiceID   = y.First().iPurchaseInvoiceID,
                        iExpenseKey          = y.First().iExpenseKey,
                        iVehicleExpenseID    = y.First().iVehicleExpenseID,
                        iExpenseID           = y.Count(),

                        //NoOfExpenses = y.NoOfExpenses,

                        strExpenseDate = y.First().strExpenseDate,
                        //strExpenseName = y.First().strExpenseName,
                        dcmlTotalExpenseAmount  = y.First().dcmlTotalExpenseAmount,
                        iSpreadAmountPerVehicle = y.First().dcmlTotalExpenseAmount,



                        dcmlDOExpenseAmount        = y.First().dcmlDOExpenseAmount,
                        dcmlDPAExpenseAmount       = y.First().dcmlDPAExpenseAmount,
                        dcmlRAMPExpenseAmount      = y.First().dcmlRAMPExpenseAmount,
                        dcmlTRANSPORTExpenseAmount = y.First().dcmlTRANSPORTExpenseAmount,
                        dcmlRECOVERYExpenseAmount  = y.First().dcmlRECOVERYExpenseAmount,
                    }).OrderBy(x => x.strPurchaseInvoiceNo).ToList();


                    var rows = (from allExpense in results
                                select new
                    {
                        id = allExpense.iVehicleExpenseID,
                        cell = new string[] {
                            Convert.ToString(allExpense.iVehicleExpenseID),
                            //Convert.ToString( allExpense.strExpenseName),
                            Convert.ToString(allExpense.iPurchaseInvoiceID),
                            Convert.ToString(allExpense.strPurchaseInvoiceNo),
                            Convert.ToString(allExpense.strExpenseDate),
                            //Convert.ToString(allExpense.iExpenseID),

                            //Convert.ToString( allExpense.dcmlExpenseAmount),


                            Convert.ToString(allExpense.dcmlDOExpenseAmount),
                            Convert.ToString(allExpense.dcmlDPAExpenseAmount),
                            Convert.ToString(allExpense.dcmlRAMPExpenseAmount),
                            Convert.ToString(allExpense.dcmlTRANSPORTExpenseAmount),
                            Convert.ToString(allExpense.dcmlRECOVERYExpenseAmount),
                            Convert.ToString(allExpense.dcmlTotalExpenseAmount),
                        }
                    }).ToArray();


                    var jsonData = new
                    {
                        total   = 1,
                        page    = 1,
                        records = dc.VehicleExpenses.ToList().Count,
                        rows    = rows
                    };

                    return(jsonData);
                }
                else
                {
                    return(null);
                }
            }
        }
Beispiel #20
0
        //public static Menus GetMenuAuthorization()
        public static List <ControllerAccessRight> GetMenuAuthorization()
        {
            AuctionInventoryEntities auctionContext = new AuctionInventoryEntities();
            Menus menus = new Menus();
            List <ControllerAccessRight> menuLists = new List <ControllerAccessRight>();

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                string superAdmin    = ((int)Enums.Roles.SuperAdmin).ToString();
                string adminSupplier = ((int)Enums.Roles.AdminSupplier).ToString();
                string Accountant    = ((int)Enums.Roles.Accountant).ToString();
                string DataEntry     = ((int)Enums.Roles.DataEntry).ToString();
                string XYZRole       = ((int)Enums.Roles.XYZRole).ToString();

                if (HttpContext.Current.User.IsInRole(superAdmin))
                {
                    //List<ControllerAccessRight> menuLists = new List<ControllerAccessRight>();

                    menuLists = auctionContext.ControllerAccessRights.Where(x => x.iRoleID == (int)Enums.Roles.SuperAdmin).ToList();

                    //return menuLists;

                    //menus.ShowDashBoard = true;
                    //menus.ShowSupplier = true;
                    //menus.ShowEmployee = true;
                    //menus.ShowExpenses = true;
                    //menus.ShowPurchase = true;
                    //menus.ShowCategory = true;
                    //menus.ShowCurrency = true;
                    //menus.ShowSale = true;
                    //menus.ShowParty = true;
                    //menus.ShowYard = true;
                    //menus.ShowVehicleStatus = true;
                    //menus.ShowPapers = true;
                    //menus.ShowAuction = true;
                    //menus.ShowLedger = true;
                    //menus.ShowProducts = true;
                    //menus.ShowQueue = true;
                    //menus.ShowReports = true;
                    //menus.ShowCustomer = true;
                }
                // For Admin Supplier
                else if (HttpContext.Current.User.IsInRole(adminSupplier))
                {
                    menuLists = auctionContext.ControllerAccessRights.Where(x => x.iRoleID == (int)Enums.Roles.AdminSupplier).ToList();

                    //menus.ShowDashBoard = true;
                    //menus.ShowSupplier = false;
                    //menus.ShowEmployee = false;
                    //menus.ShowExpenses = true;

                    //menus.ShowSale = true;
                    //menus.ShowLedger = true;
                    //menus.ShowProducts = true;
                    //menus.ShowQueue = true;
                    //menus.ShowReports = true;
                    //menus.ShowCustomer = true;
                }
                // For Accountant
                else if (HttpContext.Current.User.IsInRole(Accountant))
                {
                    menuLists = auctionContext.ControllerAccessRights.Where(x => x.iRoleID == (int)Enums.Roles.Accountant).ToList();

                    //menus.ShowDashBoard = true;
                    //menus.ShowSupplier = true;
                    //menus.ShowEmployee = true;
                    //menus.ShowExpenses = true;
                    //menus.ShowSale = true;
                    //menus.ShowLedger = true;
                    //menus.ShowProducts = true;
                    //menus.ShowQueue = true;
                    //menus.ShowReports = true;
                    //menus.ShowCustomer = true;
                }
                // For Data Entry Operator
                else if (HttpContext.Current.User.IsInRole(DataEntry))
                {
                    menuLists = auctionContext.ControllerAccessRights.Where(x => x.iRoleID == (int)Enums.Roles.DataEntry).ToList();

                    //menus.ShowDashBoard = true;
                    //menus.ShowSupplier = true;
                    //menus.ShowEmployee = true;
                    //menus.ShowExpenses = true;
                    //menus.ShowSale = true;
                    //menus.ShowLedger = true;
                    //menus.ShowProducts = true;
                    //menus.ShowQueue = true;
                    //menus.ShowReports = true;
                    //menus.ShowCustomer = true;
                }

                // Need to ask Danish Bhai
                // For XYZ Role
                else if (HttpContext.Current.User.IsInRole(XYZRole))
                {
                    menus.ShowDashBoard = true;
                    menus.ShowSupplier  = true;
                    menus.ShowEmployee  = true;
                    menus.ShowExpenses  = true;
                    menus.ShowSale      = true;
                    menus.ShowLedger    = true;
                    menus.ShowProducts  = true;
                    menus.ShowQueue     = true;
                    menus.ShowReports   = true;
                    menus.ShowCustomer  = true;
                }
                //else
                //{
                //    menus.ShowDashBoard = true;
                //    menus.ShowSupplier = false;
                //    menus.ShowEmployee = false;
                //    menus.ShowExpenses = false;
                //    menus.ShowSale = false;
                //    menus.ShowLedger = false;
                //    menus.ShowProducts = false;
                //    menus.ShowQueue = false;
                //    menus.ShowReports = false;
                //    menus.ShowCustomer = false;
                //}
            }
            //return menus;
            return(menuLists);
        }
Beispiel #21
0
        public dynamic GetRepoAuctionListVehicles()
        {
            //List<Vehicle> vehicleList = new List<Vehicle>();

            //Give an Exception


            using (AuctionInventoryEntities dc = new AuctionInventoryEntities())
            {
                var test = (
                    from vehi in
                    (from AM in dc.Vehicles


                     select new
                {
                    iVehicleID = AM.iVehicleID,
                    iLotNum = AM.iLotNum,
                    strChassisNum = AM.strChassisNum,
                    iModel = AM.iModel,
                    iYear = AM.iYear,
                    color = AM.strColor,
                    iCustomValInJPY = AM.iCustomValInJPY,
                    iCustomAssesVal = AM.iCustomAssesVal
                }).ToList()
                    select new
                {
                    id = vehi.iVehicleID,
                    cell = new string[] {
                        Convert.ToString(vehi.iVehicleID), Convert.ToString(vehi.iLotNum), Convert.ToString(vehi.strChassisNum)
                        , Convert.ToString(vehi.iModel), Convert.ToString(vehi.iYear), Convert.ToString(vehi.color)
                        , Convert.ToString(vehi.iCustomValInJPY), Convert.ToString(vehi.iCustomAssesVal)
                    }
                }).ToArray();


                var jsonData = new
                {
                    total = 1,
                    page  = 1,
                    // records = dc.Vehicles.ToList().Count,
                    rows = test
                };

                return(jsonData);
            }



            ///// Select from Bellow two lines

            //vehicleList = (from r in auctionContext.Vehicles select r).ToList();

            //return vehicleList;

            //var vehicleListTest = (from AM in auctionContext.Vehicles
            //                       select new
            //                       {
            //                           AM.iVehicleID,
            //                           AM.iLotNum,
            //                           AM.strChassisNum,
            //                           AM.iModel,
            //                           AM.iYear,
            //                           AM.strColor,
            //                           AM.iCustomValInJPY,
            //                           AM.iCustomAssesVal

            //                       }).ToList();


            //return vehicleListTest;


            //////////Give not selected data .whole data of vehicle//////////////



            //vehicleList = auctionContext.Vehicles.AsEnumerable()

            //            .Select(AM => new Vehicle()
            //            {

            //                iVehicleID = AM.iVehicleID,
            //                iLotNum = AM.iLotNum,
            //                strChassisNum = AM.strChassisNum,
            //                iModel = AM.iModel,
            //                iYear = AM.iYear,
            //                strColor = AM.strColor,
            //                iCustomValInJPY = AM.iCustomValInJPY,
            //                iCustomAssesVal = AM.iCustomAssesVal
            //            }).ToList();


            //return vehicleList;
        }
        public dynamic GetSingleVehicleExpensesListData()
        {
            using (AuctionInventoryEntities dc = new AuctionInventoryEntities())
            {
                var preResult = (from AM in dc.VehicleExpenses
                                 join t2 in dc.MExpenses on AM.iExpenseID equals t2.iExpenseID
                                 join t3 in dc.Vehicles on AM.iVehicleID equals t3.iVehicleID
                                 join t4 in dc.MParties on AM.iPartyID equals t4.iPartyID
                                 where (AM.iVehicleID != null && AM.iVehicleID != 0)

                                 select new
                {
                    iVehicleExpenseID = AM.iVehicleExpenseID,

                    strRemarks = AM.strRemarks,

                    iVehicleID = AM.iVehicleID,

                    //partyID and Party Name
                    iPartyID = AM.iPartyID,
                    strFirstName = t4.strFirstName,


                    iExpenseID = AM.iExpenseID,
                    strChassisNum = t3.strChassisNum,
                    strExpenseName = t2.strExpenseName,
                    strExpenseDate = AM.strExpenseDate,

                    dcmlExpenseAmount = AM.dcmlExpenseAmount,
                    dcmlTotalExpenseAmount = AM.dcmlTotalExpenseAmount
                }).ToList();

                if (preResult.Count > 0)
                {
                    var results = preResult.GroupBy(x => x.iVehicleID).Select(y =>
                                                                              new
                    {
                        iVehicleID        = y.Key,
                        dcmlExpenseAmount = y.Sum(x => x.dcmlExpenseAmount),
                        strChassisNum     = y.First().strChassisNum,
                        iVehicleExpenseID = y.First().iVehicleExpenseID,

                        iPartyID     = y.First().iPartyID,
                        strFirstName = y.First().strFirstName,


                        iExpenseID              = y.Count(),
                        strRemarks              = y.First().strRemarks,
                        strExpenseName          = y.First().strExpenseName,
                        strExpenseDate          = y.First().strExpenseDate,
                        dcmlTotalExpenseAmount  = y.First().dcmlTotalExpenseAmount,
                        iSpreadAmountPerVehicle = y.First().dcmlTotalExpenseAmount
                    }).ToList();


                    var rows = (from singleExp in results
                                select new
                    {
                        id = singleExp.iVehicleExpenseID,
                        cell = new string[] {
                            Convert.ToString(singleExp.iVehicleExpenseID),
                            Convert.ToString(singleExp.strRemarks),
                            Convert.ToString(singleExp.strExpenseName),
                            Convert.ToString(singleExp.iVehicleID),
                            Convert.ToString(singleExp.iPartyID),


                            Convert.ToString(singleExp.strFirstName),

                            Convert.ToString(singleExp.strChassisNum),
                            Convert.ToString(singleExp.strExpenseDate),
                            Convert.ToString(singleExp.iExpenseID),
                            Convert.ToString(singleExp.dcmlExpenseAmount),
                            Convert.ToString(singleExp.dcmlTotalExpenseAmount)
                        }
                    }).ToArray();


                    var jsonData = new
                    {
                        total   = 1,
                        page    = 1,
                        records = dc.VehicleExpenses.ToList().Count,
                        rows    = rows
                    };

                    return(jsonData);
                }
                else
                {
                    return(null);
                }
            }
        }
        public dynamic GetAllSalesPaymentList()
        {
            using (AuctionInventoryEntities dc = new AuctionInventoryEntities())
            {
                var jsonData = new
                {
                    total   = 1,
                    page    = 1,
                    records = dc.SalesPayments.ToList().Count,
                    rows    = (
                        from salesPayment in
                        (from t2 in dc.Sales
                         join t1 in dc.MCustomers on t2.iCustomerID equals t1.iCustomerID
                         // join t3 in dc.SalesPayments on t2.iCustomerID equals t3.iCustomerID



                         where t2.ysnPaymentStatus == false

                         select new
                    {
                        IsBlocked = t1.IsBlocked,
                        iSaleID = t2.iSaleID,

                        iSalesInvoiceID = t2.iSalesInvoiceID,
                        strSalesInvoiceNo = t2.strSalesInvoiceNo,

                        iCustomerID = t2.iCustomerID,
                        ////strFirstName = t1.strFirstName,
                        ////strLastName = t1.strLastName,


                        //iPaymentReceiptNo = t3.iPaymentReceiptNo,
                        //strPaymentReceiptNo = t3.strPaymentReceiptNo,

                        strSalesDate = t2.strSalesDate,

                        //ysnPaymentStatus = t2.ysnPaymentStatus,
                        dmlSellingPrice = t2.dmlSellingPrice,
                        dmlBalance = t2.dmlBalance,
                        dmlAdvance = t2.dmlAdvance,
                    }).OrderBy(a => a.iSaleID).ToList()
                        select new
                    {
                        id = salesPayment.iSaleID,
                        cell = new string[] {
                            Convert.ToString(salesPayment.iSaleID),
                            //Convert.ToString(salesPayment.iSaleID),
                            Convert.ToString(salesPayment.iCustomerID), Convert.ToString(salesPayment.iSalesInvoiceID),
                            Convert.ToString(salesPayment.IsBlocked),

                            //Convert.ToString( salesPayment.iPaymentReceiptNo),
                            //    Convert.ToString(salesPayment.strPaymentReceiptNo),

                            Convert.ToString(salesPayment.strSalesInvoiceNo),
                            Convert.ToString(salesPayment.strSalesDate),
                            Convert.ToString(salesPayment.dmlSellingPrice),

                            Convert.ToString(salesPayment.dmlAdvance),
                            Convert.ToString(salesPayment.dmlBalance),


                            //Convert.ToString(salesPayment.strFirstName+" "+salesPayment.strLastName),


                            // Convert.ToString(salesPayment.ysnPaymentStatus),
                        }
                    }).ToArray()
                };
                return(jsonData);
            }
            //return View();
        }