コード例 #1
0
ファイル: AssetController.cs プロジェクト: Anand8399/digiSMS
        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
                }));
            }
        }
コード例 #2
0
ファイル: AssetController.cs プロジェクト: Anand8399/digiSMS
        //
        // GET: /SysAdmin/State/Create
        public ActionResult Create()
        {
            AssetVM viewModel = new AssetVM();

            viewModel.Status = true;
            return(View(viewModel));
        }
コード例 #3
0
ファイル: AssetController.cs プロジェクト: Anand8399/digiSMS
        //
        // 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
            }));
        }
コード例 #4
0
ファイル: AssetController.cs プロジェクト: Anand8399/digiSMS
        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));
        }
コード例 #5
0
        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));
            }
        }
コード例 #6
0
 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;
 }
コード例 #7
0
        public ActionResult Index()
        {
            var userId = User.Identity.GetUserId();
            var asset  = new AssetVM {
                OwnerUserId = userId
            };

            return(View(asset));
        }
コード例 #8
0
        // 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));
        }
コード例 #9
0
        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));
        }
コード例 #10
0
        // 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());
        }
コード例 #11
0
        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);
        }
コード例 #12
0
ファイル: AssetController.cs プロジェクト: Anand8399/digiSMS
        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));
        }
コード例 #13
0
 public IActionResult SaveNewAsset([FromBody] AssetVM value)
 {
     return(Ok(value));
 }
コード例 #14
0
        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);
        }
コード例 #15
0
        public JsonResult GetAutoCompleteData()
        {
            var res = new JsonResult();

            res.Data = new { success = true, users = UserVM.RetrieveAllUser(), projects = ProjectVM.RetrieveAllProjectKey(), assets = AssetVM.GetValidAssets() };

            return(res);
        }
コード例 #16
0
        public ActionResult AssetReport()
        {
            AssetVM viewModel = new AssetVM();

            return(View(viewModel));
        }