public virtual ActionResult Index() { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); var stores = _storService.GetAllByHUbs(user.UserAllowedHubs); return(View(stores)); }
public virtual ActionResult Update() { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); var stores = _storService.GetAllByHUbs(user.UserAllowedHubs); return(PartialView(stores.OrderBy(o => o.Hub.HubOwner.Name).ThenBy(o => o.Hub.Name).ThenBy(o => o.Name).ToList())); }
public ActionResult GetProjecCodetForCommodity(int?CommodityId) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); var projectCodes = _projectCodeService.GetProjectCodesForCommodity(user.DefaultHub.HubID, CommodityId.Value); return(Json(new SelectList(projectCodes, "ProjectCodeId", "ProjectName"), JsonRequestBehavior.AllowGet)); }
public ActionResult SINumberBalance(int?parentCommodityId, int?projectcode, int?SINumber, int?StoreId, int?StackId) { StoreBalanceViewModel viewModel = new StoreBalanceViewModel(); BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); if (!StoreId.HasValue && !StackId.HasValue && parentCommodityId.HasValue && projectcode.HasValue && SINumber.HasValue) { viewModel.ParentCommodityNameB = _commodityService.FindById(parentCommodityId.Value).Name; viewModel.ProjectCodeNameB = _projectCodeService.FindById(projectcode.Value).Value; viewModel.ShppingInstructionNumberB = _shippingInstructionService.FindById(SINumber.Value).Value; viewModel.QtBalance = _TransactionService.GetCommodityBalanceForHub(user.DefaultHub.HubID, parentCommodityId.Value, SINumber.Value, projectcode.Value); } else if (StoreId.HasValue && !StackId.HasValue && parentCommodityId.HasValue && projectcode.HasValue && SINumber.HasValue) { viewModel.ParentCommodityNameB = _commodityService.FindById(parentCommodityId.Value).Name; viewModel.ProjectCodeNameB = _projectCodeService.FindById(projectcode.Value).Value; viewModel.ShppingInstructionNumberB = _shippingInstructionService.FindById(SINumber.Value).Value; viewModel.QtBalance = _TransactionService.GetCommodityBalanceForStore(StoreId.Value, parentCommodityId.Value, SINumber.Value, projectcode.Value); var store = _storeService.FindById(StoreId.Value); viewModel.StoreNameB = string.Format("{0} - {1}", store.Name, store.StoreManName); } else if (StoreId.HasValue && StackId.HasValue && parentCommodityId.HasValue && projectcode.HasValue && SINumber.HasValue) { viewModel.ParentCommodityNameB = _commodityService.FindById(parentCommodityId.Value).Name; viewModel.ProjectCodeNameB = _projectCodeService.FindById(projectcode.Value).Value; viewModel.ShppingInstructionNumberB = _shippingInstructionService.FindById(SINumber.Value).Value; viewModel.QtBalance = _TransactionService.GetCommodityBalanceForStack(StoreId.Value, StackId.Value, parentCommodityId.Value, SINumber.Value, projectcode.Value); var store = _storeService.FindById(StoreId.Value); viewModel.StoreNameB = string.Format("{0} - {1}", store.Name, store.StoreManName); viewModel.StackNumberB = StackId.Value.ToString(); } return(PartialView(viewModel)); }
public CurrentUserModel(BLL.UserProfile user) { this.Owner = user.DefaultHub.HubOwner.Name; this.Name = user.DefaultHub.Name; this.DefaultHubId = user.DefaultHub.HubID; PossibleHubs = user.UserAllowedHubs; }
public MasterReportBound GetReceiveReportByBudgetYear(ReceiptsViewModel receiptsViewModel) { List <DRMFSS.BLL.ViewModels.Report.Data.ReceiveReportMain> reports = new List <ReceiveReportMain>(); DRMFSS.BLL.ViewModels.Report.Data.ReceiveReportMain receivereport = new BLL.ViewModels.Report.Data.ReceiveReportMain(); BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); receivereport.receiveReports = _transactionService.GetReceiveReport(user.DefaultHub.HubID, receiptsViewModel);//new List<BLL.ViewModels.Report.Data.ReceiveReport>(); receivereport.PreparedBy = user.GetFullName(); receivereport.HubName = user.DefaultHub.HubNameWithOwner; receivereport.ReportDate = System.DateTime.Now; receivereport.ReportCode = DateTime.Now.ToString(); receivereport.ReportName = "ReceiveReport"; receivereport.ReportTitle = "Receive Report"; reports.Add(receivereport); DRMFSS.Web.Reports.ReceiveReportByBudgetYear rpt = new Web.Reports.ReceiveReportByBudgetYear() { DataSource = receivereport.receiveReports }; MasterReportBound report = new MasterReportBound() { Name = "Receive Report - " + DateTime.Now.ToShortDateString(), DataSource = reports }; report.rptSubReport.ReportSource = rpt; return(report); }
public MasterReportBound GetOffloading(DispatchesViewModel dispatchesViewModel) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); OffloadingReportMain main = new OffloadingReportMain(); List <OffloadingReport> reports = _transactionService.GetOffloadingReport(user.DefaultHub.HubID, dispatchesViewModel); main.reports = reports; main.PreparedBy = user.GetFullName(); main.HubName = user.DefaultHub.HubNameWithOwner; main.ReportDate = DateTime.Now; main.ReportName = "OffloadingReport"; main.ReportTitle = "Offloading"; List <OffloadingReportMain> coll = new List <OffloadingReportMain>(); coll.Add(main); OffLoadingReport rpt = new OffLoadingReport() { DataSource = reports }; // XtraReport1 rpt = new XtraReport1() { DataSource = freestockreport.Programs[2].Details }; MasterReportBound report = new MasterReportBound() { Name = "Offloading Report " + DateTime.Now.ToShortDateString(), DataSource = coll }; report.rptSubReport.ReportSource = rpt; return(report); }
//TODO remove this function later private void InsertDispatch(Models.DispatchModel dispatchModel, BLL.UserProfile user) { List <Models.DispatchDetailModel> commodities = GetSelectedCommodities(dispatchModel.JSONInsertedCommodities); dispatchModel.DispatchDetails = commodities; _transactionService.SaveDispatchTransaction(dispatchModel, user); }
public ActionResult GetAllocations(string RquisitionNo, int?CommodityID, bool Uncommited) { ViewBag.req = RquisitionNo; ViewBag.Com = CommodityID; ViewBag.Uncommited = Uncommited; var list = new List <BLL.DispatchAllocation>(); BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); if (!string.IsNullOrEmpty(RquisitionNo) && CommodityID.HasValue) { list = _dispatchAllocationService.GetAllocations(RquisitionNo, CommodityID.Value, user.DefaultHub.HubID, Uncommited, user.PreferedWeightMeasurment); } else if (!string.IsNullOrEmpty(RquisitionNo)) { list = _dispatchAllocationService.GetAllocations(RquisitionNo, user.DefaultHub.HubID, Uncommited); } List <DispatchAllocationViewModelDto> FDPAllocations = new List <DispatchAllocationViewModelDto>(); foreach (var dispatchAllocation in list) { var DAVMD = new DispatchAllocationViewModelDto(); string preferedWeightMeasurment = user.PreferedWeightMeasurment.ToUpperInvariant(); //if (preferedWeightMeasurment == "MT" && dispatchAllocation.Commodity.CommodityTypeID == 1) //only for food //{ // DAVMD.Amount = dispatchAllocation.Amount / 10; // DAVMD.DispatchedAmount = dispatchAllocation.DispatchedAmount / 10; // DAVMD.RemainingQuantityInQuintals = dispatchAllocation.RemainingQuantityInQuintals / 10; //} //else { DAVMD.Amount = dispatchAllocation.Amount; DAVMD.DispatchedAmount = dispatchAllocation.DispatchedAmount; DAVMD.RemainingQuantityInQuintals = dispatchAllocation.RemainingQuantityInQuintals; } DAVMD.DispatchAllocationID = dispatchAllocation.DispatchAllocationID; DAVMD.CommodityName = dispatchAllocation.Commodity.Name; DAVMD.CommodityID = dispatchAllocation.CommodityID; DAVMD.RequisitionNo = dispatchAllocation.RequisitionNo; DAVMD.BidRefNo = dispatchAllocation.BidRefNo; DAVMD.ProjectCodeID = dispatchAllocation.ProjectCodeID; DAVMD.ShippingInstructionID = dispatchAllocation.ShippingInstructionID; DAVMD.Region = dispatchAllocation.FDP.AdminUnit.AdminUnit2.AdminUnit2.Name; DAVMD.Zone = dispatchAllocation.FDP.AdminUnit.AdminUnit2.Name; DAVMD.Woreda = dispatchAllocation.FDP.AdminUnit.Name; DAVMD.FDPName = dispatchAllocation.FDP.Name; DAVMD.TransporterName = dispatchAllocation.Transporter.Name; DAVMD.IsClosed = dispatchAllocation.IsClosed; DAVMD.AmountInUnit = DAVMD.Amount; DAVMD.DispatchedAmountInUnit = dispatchAllocation.DispatchedAmountInUnit; DAVMD.RemainingQuantityInUnit = dispatchAllocation.RemainingQuantityInUnit; FDPAllocations.Add(DAVMD); } return(PartialView("AllocationList", FDPAllocations)); }
/// <summary> /// Initializes a new instance of the <see cref="FieldChange"/> class. /// </summary> /// <param name="a">A.</param> /// <param name="property">The property.</param> /// <param name="foreignTable">The foreign table.</param> /// <param name="foreignFeildName">Name of the foreign feild.</param> /// <param name="foreignFeildKey">The foreign feild key.</param> public FieldChange(Audit a, string property, string foreignTable, string foreignFeildName, string foreignFeildKey) { //FieldChange x = new FieldChange(a, property); CTSContext db = new CTSContext(); // this.ChangeDate = a.DateTime; BLL.UserProfile user = BLL.UserProfile.GetUserById(a.LoginID); this.ChangedBy = (user != null) ? user.UserName : "******"; this.FieldName = property; this.PreviousValue = a.OldValue; this.ChangedValue = a.NewValue; this.FieldName = property; var prevKey = Convert.ToInt32(this.PreviousValue); var CurrentKey = Convert.ToInt32(this.ChangedValue); //modified Banty:24/5/2013 from db.ExecuteStoreQuery to (db as IObjectContextAdapter).ObjectContext.ExecuteStoreQuery var Prev = (db as IObjectContextAdapter).ObjectContext.ExecuteStoreQuery <string>(" SELECT " + foreignFeildName + " as field FROM " + foreignTable + " WHERE " + foreignFeildKey + " = " + prevKey).FirstOrDefault(); var now = (db as IObjectContextAdapter).ObjectContext.ExecuteStoreQuery <string>(" SELECT " + foreignFeildName + " as field FROM " + foreignTable + " WHERE " + foreignFeildKey + " = " + CurrentKey).FirstOrDefault();; // var Prev = db.AuditForeignFeild(foreignTable,foreignFeildName,prevKey,foreignFeildKey).SingleOrDefault(); // var now = db.AuditForeignFeild(foreignTable, foreignFeildName, CurrentKey, foreignFeildKey).SingleOrDefault(); if (Prev != null) { this.PreviousValue = Prev.ToString(); //this.PreviousValue = Prev.field; } if (now != null) { this.ChangedValue = now.ToString(); } }
public MasterReportBound GetFreeStock(FreeStockFilterViewModel freeStockFilterViewModel) { List <DRMFSS.BLL.ViewModels.Report.Data.FreeStockReport> reports = new List <BLL.ViewModels.Report.Data.FreeStockReport>(); DRMFSS.BLL.ViewModels.Report.Data.FreeStockReport freestockreport = new BLL.ViewModels.Report.Data.FreeStockReport(); BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); freestockreport.Programs = _hubService.GetFreeStockGroupedByProgram(user.DefaultHub.HubID, freeStockFilterViewModel); freestockreport.PreparedBy = user.GetFullName(); freestockreport.HubName = user.DefaultHub.HubNameWithOwner; freestockreport.ReportDate = System.DateTime.Now; freestockreport.ReportName = "FreeStockStatusReport"; freestockreport.ReportTitle = "Free Stock Status"; reports.Add(freestockreport); DRMFSS.Web.Reports.FreeStockReport rpt = new Web.Reports.FreeStockReport() { DataSource = freestockreport.Programs }; // XtraReport1 rpt = new XtraReport1() { DataSource = freestockreport.Programs[2].Details }; MasterReportBound report = new MasterReportBound() { DataSource = reports }; report.rptSubReport.ReportSource = rpt; return(report); }
public ActionResult GetStore() { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); return(new JsonResult { Data = new SelectList(_hubService.GetAllStoreByUser(user), "StoreId", "StoreName") }); }
public ActionResult GetSIBalances() { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); var list = _dispatchAllocationService.GetSIBalances(user.DefaultHub.HubID); return(PartialView("SIBalance", list)); }
public ActionResult GetBalance(string siNumber, int?commodityId) //, int? hubID) { if (siNumber != null) // && commodityId.HasValue) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); decimal GCbalance = 0; decimal allocateBalance = 0; string commodity = ""; var GC = _giftCertificateService.FindBySINumber(siNumber); if (GC != null) { foreach (var GCD in GC.GiftCertificateDetails) { GCbalance = GCbalance + GCD.WeightInMT; commodity = GCD.Commodity.Name; } allocateBalance = _receiptAllocationService.GetBalanceForSI(GC.SINumber); //, commodityId.Value); } //else //{ // GCbalance = 1; // allocateBalance = 0; // //balance = 1; //} decimal balance = GCbalance - allocateBalance; //TODO: make sure this function works for multi row gift certificate details. return(Json(new { commodity, total = GCbalance, balance = balance }, JsonRequestBehavior.AllowGet)); } return(new EmptyResult()); }
public ActionResult GetBalance(int?siNumber, int?commodityId, string siNumberText) { if (siNumber.HasValue && commodityId.HasValue) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); List <SIBalance> si = (from v in _dispatchAllocationService.GetUncommitedSIBalance( UserProfile.DefaultHub.HubID, commodityId.Value, user.PreferedWeightMeasurment) select v).ToList(); SIBalance sis = new SIBalance(); if (siNumber.Value == 0) { sis = si.FirstOrDefault(v1 => v1.SINumber == siNumberText); } else { sis = si.FirstOrDefault(v1 => v1.SINumberID == siNumber.Value); } decimal balance = sis.Dispatchable;// +ReaminingExpectedReceipts; return(Json(balance, JsonRequestBehavior.AllowGet)); } return(Json(new EmptyResult())); }
public ActionResult EventLog() { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); List <StackEventLogViewModel> viewModel = new List <StackEventLogViewModel>(); //repository.StackEvent.GetAllStackEvents(user); return(PartialView(viewModel)); }
public ActionResult DispatchOtherListGrid(string otherDispatchAllocationID) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); //TODO cascade using allocation id List <DispatchModelModelDto> otherDispatchs = _dispatchService.ByHubIdAndOtherAllocationIDetached(user.DefaultHub.HubID, Guid.Parse(otherDispatchAllocationID)); return(View(new GridModel(otherDispatchs))); }
public ActionResult EventLogGrid(int?StackId, int?StoreId) { if (StackId.HasValue && StoreId.HasValue) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); return(View(new GridModel(_stackEventService.GetAllStackEventsByStoreIdStackId(user, StackId.Value, StoreId.Value).OrderByDescending(o => o.EventDate)))); } return(View(new GridModel(new List <StackEventViewModel>()))); }
public ActionResult AllocationList() { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); BLL.Hub hub = user.DefaultHub; var list = _dispatchAllocationService.GetUncommitedAllocationsByHub(hub.HubID); var listViewModel = (from item in list select BindDispatchAllocationViewModelDto(item)); return(PartialView("AllocationList", listViewModel)); }
public MasterReportBound GetDonationReport() { var reports = new List <BLL.ViewModels.Report.Data.DeliveryReport>(); var donation = new BLL.ViewModels.Report.Data.DeliveryReport(); BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); donation.PreparedBy = user.GetFullName(); donation.ReportCode = DateTime.Now.ToString(); donation.ReportDate = DateTime.Now; donation.ReportName = "DistributionReport"; donation.ReportTitle = "Distribution Report"; Random ran = new Random(1); donation.Rows = new List <DeliveryRows>(); for (int i = 1; i < 200; i++) { DeliveryRows r = new DeliveryRows(); r.SINumber = "00001283"; r.Hub = donation.HubName; r.DeliveryOrderNumber = i.ToString().PadLeft(8, '0'); r.HubOwner = "DRMFSS"; r.PortName = "Djibuti"; r.ShippedBy = "WFP"; r.Vessel = "Liberty Sun"; r.Project = "DRMFSS 4765"; r.Commodity = "Cereal"; r.SubCommodity = "Wheat"; r.WareHouseNumber = i / 50 + 1; r.Unit = "mt"; r.DeliveryBag = 99 * i * decimal.Parse("12"); r.DeliveryQuantity = 67 * i * decimal.Parse("34.89"); r.DeliveryNet = 23 * i * decimal.Parse("81"); r.Donor = "US Aid"; r.DeliveryType = "Donation"; r.DeliveryReferenceNumber = i.ToString().PadLeft(8, '0'); r.Date = DateTime.Now.ToShortDateString(); r.TransportedBy = ((i % 3 == 0) ? " DRMFSS " : "Another Trasporter"); r.VehiclePlateNumber = "03-A0012" + (i / 24).ToString(); donation.Rows.Add(r); } reports.Add(donation); DRMFSS.Web.Reports.DonationReportByProgram rpt = new Web.Reports.DonationReportByProgram() { DataSource = reports[0].Rows }; MasterReportBound report = new MasterReportBound() { Name = "Donation Report - " + DateTime.Now.ToShortDateString(), DataSource = reports }; report.rptSubReport.ReportSource = rpt; return(report); }
/// <summary> /// Initializes a new instance of the <see cref="FieldChange"/> class. /// </summary> /// <param name="audit">The audit.</param> /// <param name="proprtyName">Name of the proprty.</param> public FieldChange(BLL.Audit audit, string proprtyName) { // this.ChangeDate = audit.DateTime; BLL.UserProfile user = BLL.UserProfile.GetUserById(audit.LoginID); this.ChangedBy = (user != null) ? user.UserName : "******"; this.FieldName = proprtyName; this.PreviousValue = audit.OldValue; this.ChangedValue = audit.NewValue; }
public ActionResult CreateAdjustment(LossesAndAdjustmentsViewModel viewModel) { LossesAndAdjustmentsViewModel newViewModel = new LossesAndAdjustmentsViewModel(); BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); viewModel.IsLoss = false; _adjustmentService.AddNewLossAndAdjustment(viewModel, user); return(RedirectToAction("Index")); }
public ActionResult Index() { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); // ViewBag.Stock = db.GetStockStatusReport(user.DefaultHub.HubID,).ToList(); ViewBag.Commodity = _commodityService.GetAllParents(); ViewBag.Stock = _hubService.GetStockStatusReport(user.DefaultHub.HubID, 1).ToList(); ViewBag.CommodityID = 1; return(View()); }
public ActionResult CommitAllocation(string[] checkedRecords, int?SINumber) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); if (checkedRecords != null) { _receiptAllocationService.CommitReceiveAllocation(checkedRecords, user); } //return AllocationList(SINumber.Value); return(RedirectToAction("Index", new { si = SINumber })); //return View("Index"); }
/// <summary> /// Changes the password. /// </summary> /// <param name="profileId">The profile id.</param> /// <param name="password">The password.</param> /// <returns></returns> public bool ChangePassword(int profileId, string password) { BLL.UserProfile user = db.UserProfiles. Where(p => p.UserProfileID == profileId).SingleOrDefault(); if (user != null) { user.Password = password; db.SaveChanges(); return(true); } return(false); }
public ActionResult GetStoreForParentCommodity(int?commodityParentId, int?SINumber) { if (commodityParentId.HasValue && SINumber.HasValue) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); return(Json(new SelectList(ConvertStoreToStoreViewModel(_storeService.GetStoresWithBalanceOfCommodityAndSINumber(commodityParentId.Value, SINumber.Value, user.DefaultHub.HubID)), "StoreId", "StoreName"))); } else { return(Json(new SelectList(new List <StoreViewModel>()))); } }
public ActionResult GetSINumberForProjectCode(int?ProjectCodeId) { if (ProjectCodeId.HasValue) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); return(Json(new SelectList(_shippingInstructionService.GetShippingInstructionsForProjectCode(user.DefaultHub.HubID, ProjectCodeId.Value), "ShippingInstructionId", "ShippingInstructionName"), JsonRequestBehavior.AllowGet)); } else { return(Json(new SelectList(new List <ShippingInstructionViewModel>()))); } }
public ActionResult DispatchPartial() { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); ViewBag.Stock = _hubService.GetDispatchFulfillmentStatus(user.DefaultHub.HubID).ToList(); var report = new DispatchReport(); ViewBag.Report = report; report.DataSource = ViewBag.Stock; report.HubName.Text = UserProfile.DefaultHub.HubNameWithOwner; report.ReportDate.Text = string.Format("Generated On: {0}", DateTime.Now.ToString("dd-MMM-yyyy")); return(PartialView()); }
public ActionResult GetAvailableSINumbers(int?CommodityID) { BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); if (CommodityID.HasValue) { var nums = from si in _dispatchAllocationService.GetAvailableSINumbersWithUncommitedBalance(CommodityID.Value, user.DefaultHub.HubID) select new { Name = si.Value, Id = si.ShippingInstructionID }; return(Json(new SelectList(nums, "Id", "Name"), JsonRequestBehavior.AllowGet)); } return(Json(new SelectList(Enumerable.Empty <SelectListItem>()), JsonRequestBehavior.AllowGet)); }
public virtual ActionResult Create(Store store) { if (ModelState.IsValid) { _storService.AddStore(store); return(Json(new { success = true })); } BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name); ViewBag.HubID = new SelectList(user.UserAllowedHubs.OrderBy(p => p.Name), "HubID", "HubNameWithOwner"); return(PartialView(store)); }