public ActionResult Select() { string mode = Request.QueryString["Grid-mode"]; if (!string.IsNullOrEmpty(mode)) { return(this.RedirectToAction("Create")); } else { List <AssetVM> viewModels = new List <AssetVM>(); AssetBAL balObject = new AssetBAL(); IQueryable <Entities.Asset> entites = balObject.GetAll(SessionHelper.SchoolId); foreach (Entities.Asset entity in entites) { AssetVM viewModel = new AssetVM(); viewModel.SrNo = entity.SrNo; viewModel.AssetName = entity.AssetName; viewModel.TypeofAsset = entity.TypeofAsset; viewModel.Quantity = entity.Quantity; viewModel.PricePerItem = entity.PricePerItem; viewModel.Total = entity.Total; viewModel.PurchaseDate = entity.PurchaseDate; viewModel.Condition = entity.Condition; viewModel.AssesmentYear = entity.AssesmentYear; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(View(new GridModel <AssetVM> { Data = viewModels })); } }
// // GET: /SysAdmin/State/Create public ActionResult Create() { AssetVM viewModel = new AssetVM(); viewModel.Status = true; return(View(viewModel)); }
// // GET: /SysAdmin/Asset/ public ActionResult Index() { List <AssetVM> viewModels = new List <AssetVM>(); AssetBAL balObject = new AssetBAL(); IQueryable <Entities.Asset> entites = balObject.GetAll(SessionHelper.SchoolId); foreach (Entities.Asset entity in entites) { AssetVM viewModel = new AssetVM(); viewModel.SrNo = entity.SrNo; viewModel.AssetName = entity.AssetName; viewModel.TypeofAsset = entity.TypeofAsset; viewModel.Quantity = entity.Quantity; viewModel.PricePerItem = entity.PricePerItem; viewModel.Total = entity.Total; viewModel.PurchaseDate = entity.PurchaseDate; viewModel.Condition = entity.Condition; viewModel.AssesmentYear = entity.AssesmentYear; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; viewModels.Add(viewModel); } return(View(new GridModel <AssetVM> { Data = viewModels })); }
public ActionResult Edit(AssetVM viewModel) { try { // TODO: Add update logic here if (ModelState.IsValid) { Entities.Asset entity = new Entities.Asset(); entity.SrNo = viewModel.SrNo; entity.AssetName = viewModel.AssetName; entity.TypeofAsset = viewModel.TypeofAsset; entity.Quantity = viewModel.Quantity; entity.PricePerItem = viewModel.PricePerItem; entity.Total = viewModel.Total; entity.PurchaseDate = viewModel.PurchaseDate; entity.Condition = viewModel.Condition; entity.AssesmentYear = viewModel.AssesmentYear; entity.Status = viewModel.Status; entity.Remark = viewModel.Remark; AssetBAL balObject = new AssetBAL(); balObject.Edit(entity); TempData["Message"] = "Asset entry updated successfully !!!"; } else { TempData["Error"] = "Some problem while updating asset entry !!!"; } } catch { TempData["Error"] = "Some problem while updating asset entry !!!"; } return(View(viewModel)); }
public ActionResult AssetReport(FormCollection frm) { AssetVM viewModel = new AssetVM(); if (frm["FromDate"] != null && !string.IsNullOrEmpty(frm["FromDate"])) { viewModel.FromDate = Convert.ToDateTime(frm["FromDate"]); } if (frm["ToDate"] != null && !string.IsNullOrEmpty(frm["ToDate"])) { viewModel.ToDate = Convert.ToDateTime(frm["ToDate"]); } if (ModelState.IsValid) { PresentationLayer.Helpers.SessionHelper.ReportIndex = 6; PresentationLayer.Helpers.SessionHelper.fromDate = viewModel.FromDate; PresentationLayer.Helpers.SessionHelper.toDate = viewModel.ToDate; return(Redirect(@"~\Report.aspx")); } else { return(View(viewModel)); } }
public void Update(AssetVM assetVM) { this.Name = assetVM.Name; this.Stock = assetVM.Stock; this.SerialKey = assetVM.SerialKey; this.Spesification = assetVM.Spesification; this.UpdateDate = DateTimeOffset.Now.LocalDateTime; }
public ActionResult Index() { var userId = User.Identity.GetUserId(); var asset = new AssetVM { OwnerUserId = userId }; return(View(asset)); }
// GET: Category/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AssetVM item = db.GetAssetDetail((int)id); if (item == null) { return(HttpNotFound()); } //ViewBag.DepreciationMethodId = new SelectList(ddl.GetDepreciationList(),"Id","Name", category.OrganizationId); return(View(item)); }
public ActionResult AddContract(AssetVM assetVM) { if (ModelState.IsValid) { var model = assetVM.ConvertToAsset(); var owners = db.Owners.Find(assetVM.OwnerUserId); db.Assets.Add(model); db.SaveChanges(); CreateContract(assetVM.PrivateKey, owners.EthAdd); return(RedirectToAction("Index", "Asset")); } return(View(assetVM)); }
// GET: Asset public ActionResult Index(int p = 1, string cn = "", string name = "", string status = "") { UserAuth(); var psize = 10; var asset_list = AssetVM.GetAssetList(cn, name, status); ViewBag.total = asset_list.Count; ViewBag.data = asset_list.Skip((p - 1) * psize).Take(psize); ViewBag.showColumn = AssetVM.AssetShowProperty(); ViewBag.PageNo = p; ViewBag.TotalPage = Math.Ceiling(asset_list.Count / psize + 0.0); ViewBag.cn = cn; ViewBag.name = name; ViewBag.status = status; return(View()); }
public JsonResult UploadAsset() { var file_path = Request.Form["path"]; List <List <string> > data = ExcelReader.RetrieveDataFromExcel(Server.MapPath(file_path), null); data.RemoveAt(0); if (data.Count > 0) { foreach (var item in data) { AssetVM.SaveAssets(item); } } var res = new JsonResult(); res.Data = new { success = true }; return(res); }
public ActionResult Edit(int id) { AssetVM viewModel = new AssetVM(); AssetBAL balObject = new AssetBAL(); IQueryable <Entities.Asset> entites = balObject.FindBy(a => a.SrNo == id); if (entites != null && entites.Count() > 0) { Entities.Asset entity = entites.FirstOrDefault(); viewModel.SrNo = entity.SrNo; viewModel.AssetName = entity.AssetName; viewModel.TypeofAsset = entity.TypeofAsset; viewModel.Quantity = entity.Quantity; viewModel.PricePerItem = entity.PricePerItem; viewModel.Total = entity.Total; viewModel.PurchaseDate = entity.PurchaseDate; viewModel.Condition = entity.Condition; viewModel.AssesmentYear = entity.AssesmentYear; viewModel.Status = entity.Status; viewModel.Remark = entity.Remark; } return(View(viewModel)); }
public IActionResult SaveNewAsset([FromBody] AssetVM value) { return(Ok(value)); }
public JsonResult AddBorrowRequest() { var borrow_user = Request.Form["borrow_user"]; var pro_no = Request.Form["pro_no"]; var islong = Request.Form["islong"]; var sdate = Request.Form["sdate"]; var edate = Request.Form["edate"]; var comment = Request.Form["comment"]; var assets = (List <string>)Newtonsoft.Json.JsonConvert.DeserializeObject(Request.Form["assets"], (new List <string>()).GetType()); var borrowlist = new List <AssetBorrowHistoryVM>(); var rid = DateTime.Now.ToString("yyyyMMddHHmmss"); var table = new List <List <string> >(); var e_tmp = new List <string>(); e_tmp.Add("RequestID"); e_tmp.Add("CN"); e_tmp.Add("English Name"); e_tmp.Add("Chinese Name"); e_tmp.Add("Model"); table.Add(e_tmp); foreach (var item in assets) { var tmp = new AssetBorrowHistoryVM(); tmp.RequestID = rid; tmp.AssetID = item; tmp.BorrowUser = borrow_user; tmp.ProjectNo = pro_no; tmp.IsLong = islong; tmp.StartDate = sdate; tmp.EndDate = edate; tmp.BorrowComment = comment; borrowlist.Add(tmp); } AssetBorrowHistoryVM.NewBorrow(borrowlist); //send confirm email var asset_info = AssetVM.GetAssetList("", "", "", "('" + string.Join("','", assets) + "')"); foreach (var item in asset_info) { e_tmp = new List <string>(); e_tmp.Add(rid); e_tmp.Add(item.Value.CN); e_tmp.Add(item.Value.EnglishName); e_tmp.Add(item.Value.ChineseName); e_tmp.Add(item.Value.Supplier); table.Add(e_tmp); } var towho = borrow_user.Split(new char[] { '@' })[0]; var greeting = "Hi, " + towho; var description = "The following device(s) have been borrowed by you on " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); var content = EmailUtility.CreateTableHtml(greeting, description, null, table); var glbcfg = CfgUtility.GetSysConfig(this); var towholist = new List <string>(); towholist.Add(borrow_user); if (!string.IsNullOrEmpty(glbcfg["ASSETADMINUSER"])) { var user_list = glbcfg["ASSETADMINUSER"].Split(new char[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries); towholist.AddRange(user_list); } EmailUtility.SendEmail(this, "Borrow Device(s) -- " + DateTime.Now.ToString("MM/dd/yyyy"), towholist, content, true); var res = new JsonResult(); res.Data = new { success = true }; return(res); }
public JsonResult GetAutoCompleteData() { var res = new JsonResult(); res.Data = new { success = true, users = UserVM.RetrieveAllUser(), projects = ProjectVM.RetrieveAllProjectKey(), assets = AssetVM.GetValidAssets() }; return(res); }
public ActionResult AssetReport() { AssetVM viewModel = new AssetVM(); return(View(viewModel)); }