public IActionResult Update(int?id) { if (HttpContext.Session.GetString("AdminId") != null) { if (id == null) { return(NotFound()); } Branch aBranchDetails = _iBranchManager.GetById(id); if (aBranchDetails == null) { return(NotFound()); } ViewBag.CountryList = CountryList(); ViewBag.CityList = CityList(); return(View(aBranchDetails)); } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult Edit(int id) { ViewBag.OrganizationList = GetOrganizations(); var branch = _branchManager.GetById(id); return(View(branch)); }
public ActionResult PendingTransferIssueList() { ViewTransferIssueModel model = new ViewTransferIssueModel(); var issuedProducts = _iProductManager.GetTransferIssueList(); model.TransferIssues = issuedProducts.ToList(); foreach (var issue in issuedProducts) { model.FromBranch = _iBranchManager.GetById(issue.FromBranchId); model.ToBranch = _iBranchManager.GetById(issue.ToBranchId); } return(View(model)); }
// GET: Branch/Details/5 public ActionResult Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Branch branch = _branchManager.GetById((long)id); if (branch == null) { return(HttpNotFound()); } return(View(branch)); }
public ActionResult DeliverableTransferIssueList() { IEnumerable <TransferIssue> issueList = _iProductManager.GetDeliverableTransferIssueList(); var model = new ViewTransferIssueModel(); var transferIssues = issueList as TransferIssue[] ?? issueList.ToArray(); foreach (var issue in transferIssues) { model.FromBranch = _iBranchManager.GetById(issue.FromBranchId); model.ToBranch = _iBranchManager.GetById(issue.ToBranchId); model.TransferIssues = transferIssues.ToList(); } return(View(model)); }
private IEnumerable <ViewTripModel> GetProductFromXmalFile(string filePath) { List <ViewTripModel> tripModels = new List <ViewTripModel>(); var xmlData = XDocument.Load(filePath).Element("Requisitions")?.Elements(); foreach (XElement element in xmlData) { var elementFirstAttribute = element.FirstAttribute.Value; var elementValue = element.Elements(); var xElements = elementValue as XElement[] ?? elementValue.ToArray(); ViewTripModel model = new ViewTripModel { Id = elementFirstAttribute, RequisitionId = Convert.ToInt64(xElements[0].Value), RequisitionRef = xElements[1].Value, ProuctId = Convert.ToInt32(xElements[2].Value), RequisitionQty = Convert.ToInt32(xElements[3].Value), DeliveryQuantity = Convert.ToInt32(xElements[4].Value), ToBranchId = Convert.ToInt32(xElements[5].Value), ProuctName = xElements[6].Value, ToBranch = _iBranchManager.GetById(Convert.ToInt32(xElements[5].Value)) }; tripModels.Add(model); } return(tripModels); }
public ActionResult Branchlist() { if (Session["username"] == null) { return(RedirectToAction("HomePage", "Home")); } int id = Convert.ToInt32(Request.QueryString["delete"]); if (id != 0) { Branch branch = branchManager.GetById(id); branchManager.Delete(branch); return(RedirectToAction("Branchlist")); } return(View()); }
public JsonResult GetBranchById(int?id) { Branch branch = null; if (id != null) { branch = _branchManager.GetById((int)id); } return(Json(branch, JsonRequestBehavior.AllowGet)); }
public ActionResult DeliverableTransferIssueList() { try { IEnumerable <TransferIssue> issueList = _iProductManager.GetDeliverableTransferIssueList(); var model = new ViewTransferIssueModel(); var transferIssues = issueList as TransferIssue[] ?? issueList.ToArray(); foreach (var issue in transferIssues) { model.FromBranch = _iBranchManager.GetById(issue.FromBranchId); model.ToBranch = _iBranchManager.GetById(issue.ToBranchId); model.TransferIssues = transferIssues.ToList(); } return(View(model)); } catch (Exception exception) { Log.WriteErrorLog(exception); return(PartialView("_ErrorPartial", exception)); } }
public ActionResult AllDeliveredOrder() { try { var branchId = Convert.ToInt32(Session["BranchId"]); ViewBag.BranchName = _iBranchManager.GetById(branchId).BranchName; var results = _iReportManager.GetTotalDeliveredOrderListByDistributionPointId(branchId); return(View(results)); } catch (Exception exception) { Log.WriteErrorLog(exception); return(PartialView("_ErrorPartial", exception)); } }
public ActionResult GoTo(FormCollection collection) { int branchId = Convert.ToInt32(collection["BranchId"]); var branch = _iBranchManager.GetById(branchId); Session["BranchId"] = branchId; Session["Branch"] = branch; var user = (ViewUser)Session["user"]; switch (user.Roles) { case "Admin": return(RedirectToAction("Home", "Home", new { area = "Admin" })); case "User": return(RedirectToAction("Home", "Home", new { area = "Sales" })); case "Super": return(RedirectToAction("Home", "Home", new { area = "SuperAdmin" })); case "Nsm": return(RedirectToAction("Home", "Home", new { area = "Nsm" })); case "Distributor": return(RedirectToAction("Home", "Home", new { area = "Manager" })); case "Accounts": return(RedirectToAction("Home", "Home", new { area = "AccountsAndFinance" })); case "AccountExecutive": return(RedirectToAction("Home", "Home", new { area = "AccountExecutive" })); case "Management": return(RedirectToAction("Home", "Home", new { area = "Management" })); default: return(RedirectToAction("LogIn", "LogIn", new { area = "" })); } }
private IEnumerable <RequisitionModel> GetProductFromXmalFile(string filePath) { List <RequisitionModel> products = new List <RequisitionModel>(); var xmlData = XDocument.Load(filePath).Element("Products")?.Elements(); foreach (XElement element in xmlData) { RequisitionModel aProduct = new RequisitionModel(); var elementFirstAttribute = element.FirstAttribute.Value; aProduct.Serial = elementFirstAttribute; var elementValue = element.Elements(); var xElements = elementValue as XElement[] ?? elementValue.ToArray(); aProduct.ProductId = Convert.ToInt32(xElements[0].Value); aProduct.ProductName = xElements[1].Value; aProduct.Quantity = Convert.ToInt32(xElements[2].Value); aProduct.ToBranchId = Convert.ToInt32(xElements[3].Value); aProduct.ToBranch = _iBranchManager.GetById(aProduct.ToBranchId); products.Add(aProduct); } return(products); }
public JsonResult GetBranchDetailsById(int branchId) { var branch = _iBranchManager.GetById(branchId); return(Json(branch, JsonRequestBehavior.AllowGet)); }
public ActionResult Entry(MovementEntryVM movementM) { var username = Session["username"].ToString(); int orgid = 0; var list = userManager.GetAll().Where(c => c.UserName == username); foreach (var t in list) { orgid = t.OrganizationId; } ViewBag.orglist = organizationManager.GetAll(); MovementEntryVM model = new MovementEntryVM() { OrganizationLookUp = loader.GetOrganizationByUserOrgIdSelectitems(orgid), //AssetLookUp = loader.GetAssetSelectListItems() AssetLookUp = loader.GetAssetSelectListItemsJoinwithAssetDetails(orgid) }; string format = "d"; model.RegistrationDate = DateTime.Today.ToString(format); List <MovementEntryVM> aList = (List <MovementEntryVM>)Session["CartList"]; if (aList != null && aList.Any()) { List <PdfView> pdfList = new List <PdfView>(); foreach (var mo in aList) { MovementEntryVM movementVM = new MovementEntryVM(); movementVM = mo; movementVM.MoveBy = Session["username"].ToString(); AssetRegistrationDetails details = assetdetailsmanager.GetIdAssetId(movementVM.AssetId); int detailsId = details.Id; details = assetdetailsmanager.GetById(detailsId); details.OrganizationId = movementVM.OrganizationId; details.BranchId = movementVM.OrganizationId; var movement = Mapper.Map <Movement>(movementVM); MovementPermision mvp = new MovementPermision(); mvp.Permision = false; var movementPermision = Mapper.Map <MovementPermision>(movementVM); bool isSaved; if (Session["Designation"].ToString() == "Manager") { isSaved = movementPermisionManager.Add(movementPermision); } else { isSaved = movementManager.Add(movement); } if (isSaved) { details.BranchId = movementVM.BranchId; if (assetdetailsmanager.Update(details)) { ModelState.Clear(); ViewBag.message = "Save Successfully"; PdfView aPdfView = new PdfView(); aPdfView.OrganizationId = movement.OrganizationId; aPdfView.OrganizationName = movement.OrganizationName; aPdfView.AssetId = movement.AssetId; aPdfView.AssecCode = movementVM.Code; aPdfView.AssetSerialNo = movementVM.SerialNo; aPdfView.GeneralCategory = movementVM.GeneralCategoryName; aPdfView.Category = movementVM.CategoryNme; aPdfView.Brand = movementVM.BrandName; aPdfView.FromBranch = movement.BranchName; aPdfView.ToBranch = branchManager.GetById(movement.BranchId).Name; aPdfView.MovedBy = movement.MoveBy; aPdfView.Date = movement.RegistrationDate; pdfList.Add(aPdfView); } } } GeneratePdf(pdfList, DateTime.Now.Date.ToString(), Session["username"].ToString()); Session["Printed"] = "YES"; } return(RedirectToAction("Entry")); }
public ActionResult Edit(int id) { var branch = _iBranchManager.GetById(id); return(View(branch)); }
public string GetAssetLocationCode(AssetLocation assetLocation) { Branch branch = _branchManager.GetById((long)assetLocation.BranchId); return(branch.BranchCode + "_" + assetLocation.ShortName); }
public ActionResult GoTo(FormCollection collection) { int branchId = Convert.ToInt32(collection["BranchId"]); int roleId = Convert.ToInt32(collection["RoleId"]); var roles = (List <ViewAssignedUserRole>)Session["Roles"]; var user = (ViewUser)Session["user"]; user.Roles = roles.Find(n => n.RoleId == roleId).RoleName; bool r = _iCommonManager.UpdateCurrentUserRole(user, roleId); var branch = _iBranchManager.GetById(branchId); Session["BranchId"] = branchId; Session["Branch"] = branch; if (user.IsPasswordChangeRequired) { return(RedirectToAction("ChangePassword", "Home", new { area = "CommonArea", id = user.UserId })); } switch (user.Roles) { case "Admin": return(RedirectToAction("Home", "Home", new { area = "Admin" })); case "SuperUser": return(RedirectToAction("Home", "Home", new { area = "SuperAdmin" })); case "SalesExecutive": case "SalesManager": case "CorporateSalesManager": case "DistributionManager": case "SalesAdmin": return(RedirectToAction("Home", "Home", new { area = "Sales" })); case "SystemAdmin": return(RedirectToAction("Home", "Home", new { area = "Editor" })); case "AccountExecutive": case "AccountManager": return(RedirectToAction("Home", "Home", new { area = "AccountsAndFinance" })); case "Management": return(RedirectToAction("Home", "Home", new { area = "Management" })); case "ServiceExecutive": return(RedirectToAction("Home", "Home", new { area = "Services" })); case "ServiceManager": return(RedirectToAction("Home", "Home", new { area = "Services" })); case "ServiceManagement": case "GeneralServiceManagement": return(RedirectToAction("PendingList", "ServiceManagement", new { area = "Services" })); case "StoreManagerFactory": return(RedirectToAction("Home", "Home", new { area = "Production" })); case "ProductionManager": return(RedirectToAction("Home", "ProductionManager", new { area = "Production" })); case "DispatchManager": return(RedirectToAction("Home", "DispatchManager", new { area = "Production" })); case "FqcExecutive": return(RedirectToAction("Home", "Qc", new { area = "Production" })); case "PH": return(RedirectToAction("Home", "ProductionHead", new { area = "Production" })); case "R&D": return(RedirectToAction("Home", "Home", new { area = "ResearchAndDevelopment" })); case "R&DManager": return(RedirectToAction("Home", "Home", new { area = "ResearchAndDevelopment" })); case "SCMExecutive": return(RedirectToAction("Home", "Home", new { area = "SCM" })); case "SCMManager": return(RedirectToAction("Home", "Home", new { area = "SCM" })); case "HRExecutive": return(RedirectToAction("Home", "Home", new { area = "HR" })); case "Corporate": case "CorporateSalesAdmin": return(RedirectToAction("Home", "Home", new { area = "Corporate" })); default: return(RedirectToAction("LogIn", "LogIn", new { area = "" })); } }