public ActionResult Details(int Id) { var context = new RRRoadwaysDBContext(); var std = context.ExpanseHead.Where(s => s.Id == Id).FirstOrDefault(); return(View(std)); }
public IActionResult Edit(FixedExpanse data) { try { var context = new RRRoadwaysDBContext(); var dbEntry = context.Entry(data); dbEntry.Property("StaffSalary").IsModified = true; dbEntry.Property("StaffBhatta").IsModified = true; dbEntry.Property("BhattaDetails").IsModified = true; dbEntry.Property("Donation").IsModified = true; dbEntry.Property("DriverRoomRent").IsModified = true; dbEntry.Property("FormanSalary").IsModified = true; dbEntry.Property("ExtraDriversSalary").IsModified = true; dbEntry.Property("ExtraExpense").IsModified = true; dbEntry.Property("ExtraExpenseDetails").IsModified = true; context.SaveChanges(); ViewBag.vehicleId = new SelectList(context.Vehicle.Where(x => x.IsDeleted == false).ToList(), "Id", "VehicleNumber"); ViewBag.result = "Record Updated Successfully!"; } catch (Exception e) { var error = e; ViewBag.error = e.Message; } return(RedirectToAction("Index")); }
public ActionResult getExpanseHeads() { var context = new RRRoadwaysDBContext(); var dataExpanseHead = context.ExpanseHead.ToList().OrderByDescending(x => x.Id); return(Json(new { data = dataExpanseHead }, new Newtonsoft.Json.JsonSerializerSettings())); }
public IActionResult Add(Station data) { try { var context = new RRRoadwaysDBContext(); data.CreatedDate = DateTime.Now.Date; data.IsDeleted = false; context.Add(data); context.SaveChanges(); ViewBag.stationtypes = new SelectList(new List <SelectListItem> { new SelectListItem { Selected = true, Text = "Pump", Value = "Pump" }, new SelectListItem { Selected = false, Text = "Oil Shop", Value = "OilShop" }, new SelectListItem { Selected = false, Text = "Maintenance Shop", Value = "MaintenanceShop" }, new SelectListItem { Selected = false, Text = "Pickup Point", Value = "PickupPoint" }, }, "Value", "Text"); ViewBag.cities = new SelectList(context.City.ToList(), "Id", "Name"); ViewBag.result = "Record Saved Successfully!"; } catch (Exception e) { var error = e; ViewBag.error = e.Message; } ModelState.Clear(); return(RedirectToAction("Index")); }
public ActionResult getAdvance() { var context = new RRRoadwaysDBContext(); List <Advance> Advances = context.Advance.ToList(); List <AdvanceDetails> AdvanceDetails = context.AdvanceDetails.ToList(); List <Vehicle> vehicles = context.Vehicle.Where(x => x.IsDeleted == false).ToList(); List <Station> stations = context.Station.ToList(); var dataAdvances = (from a in Advances join ad in AdvanceDetails on a.Id equals ad.AdvanceId join v in vehicles on a.VehicleId equals v.Id join s in stations on ad.StationId equals s.Id select new { a.Id, v.VehicleNumber, s.Name, ad.AdvanceDate, ad.Description, ad.Amount } ).ToList(); //System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); //var dataAdvances = (from a in Advances // join v in vehicles on a.VehicleId equals v.Id join s in stations on a.StationId equals s.Id // select new { a.Id, v.VehicleNumber, s.Name, a.AdvanceDate, a.Description, a.Amount } // ).ToList(); return(Json(new { data = dataAdvances }, new Newtonsoft.Json.JsonSerializerSettings())); }
public ActionResult SaveVoucher([FromBody] Voucher data) { try { var context = new RRRoadwaysDBContext(); int val = context.Voucher.OrderByDescending(v => v.Id).Select(v => v.Id).ToList()[0]; string count = (val + 1).ToString(); string voucherNumber = "VCHR" + count.PadLeft(4, '0'); data.VoucherNumber = voucherNumber; //data.CreatedDate = DateTime.Now.Date; context.Add(data); context.SaveChanges(); var id = data.VoucherNumber; //ViewBag.vehicleId = new SelectList(context.Vehicle.ToList(), "Id", "VehicleNumber"); ViewBag.result = id + "**Record Saved Successfully!"; } catch (Exception e) { var error = e; ViewBag.error = "0**" + e.Message; } ModelState.Clear(); return(Json(ViewBag.result, new Newtonsoft.Json.JsonSerializerSettings())); //return RedirectToAction("Index", ViewBag.result); }
public IActionResult Delete(int id) { try { var context = new RRRoadwaysDBContext(); var parent = context.VehicleLoading.Include(p => p.VehicleLoadingDetail).SingleOrDefault(p => p.Id == id); foreach (var child in parent.VehicleLoadingDetail.ToList()) { context.VehicleLoadingDetail.Remove(child); } context.SaveChanges(); //var dataVehicleLoadingDetail = context.VehicleLoadingDetail.Where(c => c.VloadingId == id).FirstOrDefault(); //context.Remove(dataVehicleLoadingDetail); //context.SaveChanges(); //var dataVehicleLoading = context.VehicleLoading.Where(c => c.Id == id).FirstOrDefault(); //context.Remove(dataVehicleLoading); context.SaveChanges(); } catch (Exception e) { var error = e; ViewBag.error = e.Message; } return(RedirectToAction("Index")); }
public ActionResult getDepartments() { var context = new RRRoadwaysDBContext(); var dataDepartments = context.Department.ToList().OrderByDescending(x => x.Id); return(Json(new { data = dataDepartments }, new Newtonsoft.Json.JsonSerializerSettings())); }
public ActionResult getVehicles() { var context = new RRRoadwaysDBContext(); var dataVehicles = context.Vehicle.Where(c => c.IsDeleted == false).ToList().OrderByDescending(x => x.Id); return(Json(new { data = dataVehicles }, new Newtonsoft.Json.JsonSerializerSettings())); }
public ActionResult Edit(int Id) { var context = new RRRoadwaysDBContext(); var std = context.Department.Where(s => s.Id == Id).FirstOrDefault(); return(View(std)); }
public IActionResult Maintenance() { var context = new RRRoadwaysDBContext(); List <Vehicle> vehiclelist = context.Vehicle.Where(x => x.IsDeleted == false).ToList(); vehiclelist.Insert(0, new Vehicle() { Id = -1, VehicleNumber = "All" }); List <Department> departmentlist = context.Department.ToList(); departmentlist.Insert(0, new Department() { Id = -1, DepartmentName = "All" }); List <Station> OilShoplist = context.Station.Where(x => x.StationType.ToLower().Contains("maintenanceshop")).ToList(); OilShoplist.Insert(0, new Station() { Id = -1, Name = "All" }); ViewBag.OilShop = new SelectList(OilShoplist, "Id", "Name"); ViewBag.vehicleId = new SelectList(vehiclelist, "Id", "VehicleNumber"); ViewBag.departmentId = new SelectList(departmentlist, "Id", "DepartmentName"); return(View()); }
public async Task <IActionResult> Index() { var context = new RRRoadwaysDBContext(); var rRRoadwaysDBContext = context.FixedExpanse.Include(v => v.Vehicle); return(View(await rRRoadwaysDBContext.ToListAsync())); }
public ActionResult Details(int Id) { var context = new RRRoadwaysDBContext(); var std = context.Advance.Where(a => a.Id == Id).Include(ad => ad.AdvanceDetails).FirstOrDefault(); ViewBag.vehicleId = new SelectList(context.Vehicle.Where(x => x.IsDeleted == false).ToList(), "Id", "VehicleNumber"); ViewBag.StationId = new SelectList(context.Station.Where(x => x.StationType.ToLower().Contains("PickupPoint")).ToList(), "Id", "Name"); ViewBag.StationType = new SelectList(new List <SelectListItem> { new SelectListItem { Selected = true, Text = "Pump", Value = "Pump" }, new SelectListItem { Selected = false, Text = "Oil Shop", Value = "OilShop" }, new SelectListItem { Selected = false, Text = "Maintenance Shop", Value = "MaintenanceShop" }, new SelectListItem { Selected = false, Text = "Pickup Point", Value = "PickupPoint" }, }, "Value", "Text"); ViewBag.cities = new SelectList(context.City.ToList(), "Id", "Name"); return(View(std)); }
public IActionResult Add() { var context = new RRRoadwaysDBContext(); ViewBag.result = ""; ViewBag.error = ""; ViewBag.vehicleId = new SelectList(context.Vehicle.Where(x => x.IsDeleted == false).ToList(), "Id", "VehicleNumber"); ViewBag.StationId = new SelectList(context.Station.Where(x => x.StationType.ToLower().Contains("PickupPoint")).ToList(), "Id", "Name"); ViewBag.StationType = new SelectList(new List <SelectListItem> { new SelectListItem { Selected = true, Text = "Pump", Value = "Pump" }, new SelectListItem { Selected = false, Text = "Oil Shop", Value = "OilShop" }, new SelectListItem { Selected = false, Text = "Maintenance Shop", Value = "MaintenanceShop" }, new SelectListItem { Selected = false, Text = "Pickup Point", Value = "PickupPoint" }, }, "Value", "Text"); ViewBag.cities = new SelectList(context.City.ToList(), "Id", "Name"); return(View(new Advance())); }
public IActionResult Edit(DataValidation data) { try { var context = new RRRoadwaysDBContext(); var dbEntry = context.Entry(data); dbEntry.Property("Srp").IsModified = true; dbEntry.Property("Prp").IsModified = true; dbEntry.Property("KpkRp").IsModified = true; dbEntry.Property("TaxPaper").IsModified = true; dbEntry.Property("Fitness").IsModified = true; dbEntry.Property("Insurance").IsModified = true; context.SaveChanges(); ViewBag.result = "Record Updated Successfully!"; ViewBag.vehicleId = new SelectList(context.Vehicle.Where(x => x.IsDeleted == false).ToList(), "Id", "VehicleNumber"); } catch (Exception e) { var error = e; ViewBag.error = e.Message; } return(RedirectToAction("Index")); }
public ActionResult getVoucherDetails() { var context = new RRRoadwaysDBContext(); //var dataVehicleLoadingDetail = context.VehicleLoadingDetail.ToList().OrderByDescending(x => x.Id); List <Voucher> Vouchers = context.Voucher.ToList(); List <Vehicle> vehicles = context.Vehicle.Where(x => x.IsDeleted == false).ToList(); var dataVehicleLoadingDetail = (from vchr in Vouchers join v in vehicles on vchr.VehicleNumber equals v.Id select new { vchr.Id, vchr.VoucherNumber, v.VehicleNumber, CreatedDate = vchr.CreatedDate.GetValueOrDefault().ToString("MMMM dd, yyyy"), vchr.Month, UpDate = vchr.UpDate.GetValueOrDefault().ToString("MMMM dd, yyyy"), DownReturnDate = vchr.DownReturnDate.GetValueOrDefault().ToString("MMMM dd, yyyy"), vchr.UpAmount, vchr.DownAmount } ).ToList(); return(Json(new { data = dataVehicleLoadingDetail }, new Newtonsoft.Json.JsonSerializerSettings())); }
public ActionResult Details(int Id) { var context = new RRRoadwaysDBContext(); var std = context.Maintenance.Where(s => s.Id == Id).FirstOrDefault(); ViewBag.stationId = new SelectList(context.Station.Where(x => x.StationType == "MaintenanceShop").ToList(), "Id", "Name"); ViewBag.vehicleId = new SelectList(context.Vehicle.Where(x => x.IsDeleted == false).ToList(), "Id", "VehicleNumber"); ViewBag.departId = new SelectList(context.Department.ToList(), "Id", "DepartmentName"); ViewBag.StationType = new SelectList(new List <SelectListItem> { new SelectListItem { Selected = true, Text = "Pump", Value = "Pump" }, new SelectListItem { Selected = false, Text = "Oil Shop", Value = "OilShop" }, new SelectListItem { Selected = false, Text = "Maintenance Shop", Value = "MaintenanceShop" }, new SelectListItem { Selected = false, Text = "Pickup Point", Value = "PickupPoint" }, }, "Value", "Text"); ViewBag.cities = new SelectList(context.City.ToList(), "Id", "Name"); return(View(std)); }
// GET: Maintenances public async Task <IActionResult> Index() { var context = new RRRoadwaysDBContext(); var rRRoadwaysDBContext = context.Maintenance.Include(m => m.Department).Include(m => m.Station).Include(m => m.Vehicle); return(View(await rRRoadwaysDBContext.ToListAsync())); }
public IActionResult Edit(Installment data) { try { var context = new RRRoadwaysDBContext(); var dbEntry = context.Entry(data); dbEntry.Property("VehicleId").IsModified = true; dbEntry.Property("InstallmentsMonth").IsModified = true; dbEntry.Property("InstallmentDate").IsModified = true; dbEntry.Property("InstallmentDetail").IsModified = true; dbEntry.Property("Amount").IsModified = true; context.SaveChanges(); ViewBag.vehicleId = new SelectList(context.Vehicle.Where(x => x.IsDeleted == false).ToList(), "Id", "VehicleNumber"); ViewBag.result = "Record Updated Successfully!"; } catch (Exception e) { var error = e; ViewBag.error = e.Message; } return(RedirectToAction("Index")); }
public ActionResult Edit(int Id) { var context = new RRRoadwaysDBContext(); var std = context.FixedExpanse.Where(s => s.Id == Id).FirstOrDefault(); ViewBag.vehicleId = new SelectList(context.Vehicle.Where(x => x.IsDeleted == false).ToList(), "Id", "VehicleNumber"); return(View(std)); }
public IActionResult Add() { var context = new RRRoadwaysDBContext(); ViewBag.result = ""; ViewBag.error = ""; ViewBag.vehicleId = new SelectList(context.Vehicle.Where(x => x.IsDeleted == false).ToList(), "Id", "VehicleNumber"); return(View(new DataValidation())); }
public ActionResult getPumpData(PumpModel data) { var context = new RRRoadwaysDBContext(); int pumpid = Convert.ToInt32(data.PumpId); int vehicleNumber = Convert.ToInt32(data.VehicleNumber); List <PumpReport> griddata = new List <PumpReport>(); var pumpdata = context.Vehicle .Join(context.Voucher, v => v.Id, vo => vo.VehicleNumber, (v, vo) => new { v, vo }) .Join(context.VoucherDieselDetails, c => c.vo.Id, vdd => vdd.VoucherId, (c, vdd) => new { VoucherNumber = c.vo.VoucherNumber, PumpId = vdd.StationId, Date = vdd.Date, VehicleNumber = c.v.Id, Vehicle = c.v.VehicleNumber, Litre = vdd.Litre, Rate = vdd.Rate, Amount = vdd.Amount, OilAndOthers = vdd.OilAndOthers, }).Where(c => data.PumpId != "-1" ? c.PumpId == pumpid : 1 == 1) .Where(c => data.VehicleNumber != "-1" ? c.VehicleNumber == vehicleNumber : 1 == 1) .Where(c => c.Date.Value.Date >= data.StartDate.Date) .Where(c => c.Date.Value.Date <= data.EndDate.Date).ToList(); if (pumpdata.Count > 0) { foreach (var item in pumpdata) { PumpReport obj = new PumpReport() { SerialNo = griddata.Count + 1, VoucherNumber = item.VoucherNumber, Date = item.Date.Value.Date, Vehicle = item.Vehicle, Litre = item.Litre, Rate = item.Rate, Amount = (item.Litre * item.Rate), OilAndOther = item.OilAndOthers, OilAmount = item.Amount, Total = (item.Litre * item.Rate) + item.Amount, }; griddata.Add(obj); } } return(Json(new { data = griddata }, new Newtonsoft.Json.JsonSerializerSettings())); }
public IActionResult FixedExpense() { var context = new RRRoadwaysDBContext(); List <Vehicle> vehiclelist = context.Vehicle.Where(x => x.IsDeleted == false).ToList(); vehiclelist.Insert(0, new Vehicle() { Id = -1, VehicleNumber = "All" }); ViewBag.vehicleId = new SelectList(vehiclelist, "Id", "VehicleNumber"); return(View()); }
public ActionResult getMaintenanceData(MaintenanceModel data) { var context = new RRRoadwaysDBContext(); int vehicleNumber = Convert.ToInt32(data.VehicleNumber); int departmentId = Convert.ToInt32(data.DepartmentId); int shopId = Convert.ToInt32(data.ShopId); List <MaintenanceReport> griddata = new List <MaintenanceReport>(); var maintenances = context.Maintenance .Join(context.Station, m => m.StationId, s => s.Id, (m, s) => new { m, s }) .Join(context.Vehicle, v => v.m.VehicleId, s => s.Id, (v, s) => new { v, s }) .Join(context.Department, b => b.v.m.DepartmentId, d => d.Id, (b, d) => new { VehicleId = b.v.m.VehicleId, VehicleNumber = b.s.VehicleNumber, DepartmentId = b.v.m.DepartmentId, Date = b.v.m.MaintenanceDate, MaintenanceShop = b.v.s.Name, MaintenanceShopId = b.v.s.Id, Department = d.DepartmentName, Description = b.v.m.Description, Maintenance = b.v.m.MaintenanceDesc, Amount = b.v.m.Amount }).Where(c => c.Date.Value.Date >= data.StartDate.Date) .Where(c => c.Date.Value.Date <= data.EndDate.Date) .Where(c => data.DepartmentId != "-1" ? c.DepartmentId == departmentId : 1 == 1) .Where(c => data.ShopId != "-1" ? c.MaintenanceShopId == shopId : 1 == 1) .Where(c => data.VehicleNumber != "-1" ? c.VehicleId == vehicleNumber : 1 == 1).ToList(); if (maintenances.Count > 0) { foreach (var item in maintenances) { MaintenanceReport obj = new MaintenanceReport() { SerialNo = griddata.Count + 1, VehicleNumber = item.VehicleNumber, Date = item.Date.Value.Date, MaintenanceShop = item.MaintenanceShop, Department = item.Department, Description = item.Description, Maintenance = item.Maintenance, Amount = item.Amount, }; griddata.Add(obj); } } return(Json(new { data = griddata }, new Newtonsoft.Json.JsonSerializerSettings())); }
public ActionResult getClaims() { var context = new RRRoadwaysDBContext(); //var dataClaims= context.VehicleClaim.ToList().OrderByDescending(x => x.Id); List <VehicleClaim> claims = context.VehicleClaim.ToList(); List <Vehicle> vehicles = context.Vehicle.Where(x => x.IsDeleted == false).ToList(); var dataClaims = (from c in claims join v in vehicles on c.VehicleId equals v.Id select new { c.Id, v.VehicleNumber, ClaimDate = c.ClaimDate.GetValueOrDefault().ToString("dddd, dd MMMM yyyy"), c.Claim, c.Description, c.Amount } ).ToList(); return(Json(new { data = dataClaims }, new Newtonsoft.Json.JsonSerializerSettings())); }
public IActionResult Delete(int id) { try { var context = new RRRoadwaysDBContext(); var dataFixedExpanse = context.FixedExpanse.Where(c => c.Id == id).FirstOrDefault(); context.Remove(dataFixedExpanse); context.SaveChanges(); } catch (Exception e) { var error = e; ViewBag.error = e.Message; } return(RedirectToAction("Index")); }
public ActionResult getFixedExpanses() { var context = new RRRoadwaysDBContext(); //var dataFixedExpanses = context.FixedExpanse.ToList().OrderByDescending(x => x.Id); List <FixedExpanse> fixedExpanses = context.FixedExpanse.ToList(); List <Vehicle> vehicles = context.Vehicle.Where(x => x.IsDeleted == false).ToList(); System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); var dataFixedExpanses = (from f in fixedExpanses join v in vehicles on f.VehicleId equals v.Id select new { f.Id, v.VehicleNumber, ExpanseMonth = mfi.GetMonthName(Convert.ToInt32(f.ExpanseMonth)), f.StaffSalary, f.StaffBhatta, f.Donation, f.DriverRoomRent, f.FormanSalary, f.ExtraDriversSalary, f.ExtraExpense } ).ToList(); return(Json(new { data = dataFixedExpanses }, new Newtonsoft.Json.JsonSerializerSettings())); }
public ActionResult SaveLoadings([FromBody] VehicleLoading data) { try { var context = new RRRoadwaysDBContext(); context.Add(data); context.SaveChanges(); ViewBag.result = "Record Saved Successfully!"; } catch (Exception e) { var error = e; ViewBag.error = e.Message; } ModelState.Clear(); return(RedirectToAction("Index")); }
public IActionResult SaveCity(City data) { try { var context = new RRRoadwaysDBContext(); context.Add(data); context.SaveChanges(); ViewBag.result = "Record Saved Successfully!"; } catch (Exception e) { var error = e; ViewBag.error = e.Message; } ModelState.Clear(); return(Json(data, new Newtonsoft.Json.JsonSerializerSettings())); }
public ActionResult getLoadingDetails() { var context = new RRRoadwaysDBContext(); //var dataVehicleLoadingDetail = context.VehicleLoadingDetail.ToList().OrderByDescending(x => x.Id); List <VehicleLoading> vehicleLoadings = context.VehicleLoading.ToList(); List <VehicleLoadingDetail> vehicleLoadingDetails = context.VehicleLoadingDetail.ToList(); List <Vehicle> vehicles = context.Vehicle.Where(x => x.IsDeleted == false).ToList(); var dataVehicleLoadingDetail = (from vl in vehicleLoadings join v in vehicles on vl.VehicleId equals v.Id join vds in vehicleLoadingDetails on vl.Id equals vds.VloadingId select new { vl.Id, v.VehicleNumber, LoadingDate = vl.LoadingDate.GetValueOrDefault().ToString("dddd, dd MMMM yyyy"), vds.VehicleName, vds.Description } ).ToList(); return(Json(new { data = dataVehicleLoadingDetail }, new Newtonsoft.Json.JsonSerializerSettings())); }