Esempio n. 1
0
        public JsonResult AssetName(Int64 Id)
        {
            MTSHRDataLayer.AssetMaintenanceDetails data_asset_name = new MTSHRDataLayer.AssetMaintenanceDetails();
            List <SelectListItem> Assetnamelist = new List <SelectListItem>();

            try
            {
                var Assetname = data_asset_name.GetSpecificAsset(Id);
                Assetnamelist.Add(new SelectListItem()
                {
                    Value = "", Text = "---- Select Category----"
                });
                for (int i = 0; i < Assetname.Rows.Count; i++)
                {
                    Assetnamelist.Add(new SelectListItem()
                    {
                        Value = Assetname.Rows[i]["Id"].ToString(), Text = Assetname.Rows[i]["AssetName"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            ViewBag.Assetname = Assetnamelist;

            return(Json(new { success = true, AssetList = JsonConvert.SerializeObject(Assetnamelist) }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Add(AssetMaintenanceDetails maintenance)
        {
            MTSHRDataLayer.AssetMaintenanceDetails data_main = new MTSHRDataLayer.AssetMaintenanceDetails();

            int result = data_main.Create(maintenance.AssetTypeId, maintenance.AssetName, maintenance.Dateofpurchase, maintenance.Vendor, maintenance.Maintenance_Carried_out, maintenance.Cost, maintenance.Notes,maintenance.Item);
            return Json(new { success = result }, JsonRequestBehavior.AllowGet);
        }
Esempio n. 3
0
        //public JsonResult GetItemCode(Int64 id)
        //{
        //    MTSHRDataLayer.AssignAsset data_item_code = new MTSHRDataLayer.AssignAsset();
        //    List<SelectListItem> itemCodeList = new List<SelectListItem>();
        //    try
        //    {
        //        var ItemCode = data_item_code.GetItemCode(id);
        //        itemCodeList.Add(new SelectListItem() { Value = "", Text = "---- Select Item Code----" });
        //        for (int i = 0; i < ItemCode.Rows.Count; i++)
        //        {
        //            itemCodeList.Add(new SelectListItem() { Value = ItemCode.Rows[i]["IDENTIFICATION_CODE"].ToString(), Text = ItemCode.Rows[i]["IDENTIFICATION_CODE"].ToString() });
        //        }
        //    }
        //    catch (Exception exec)
        //    {
        //        BaseExceptionHandler.HandleException(ref exec);
        //    }
        //    ViewBag.ItemCode = itemCodeList;

        //    return Json(new { success = true, ItemCodeList = JsonConvert.SerializeObject(itemCodeList) }, JsonRequestBehavior.AllowGet);
        //}
        public JsonResult GetItemCode(Int64 Assettypeid, Int64 Assetnameid)
        {
            MTSHRDataLayer.AssetMaintenanceDetails data_item = new MTSHRDataLayer.AssetMaintenanceDetails();
            List <SelectListItem> itemCodeList = new List <SelectListItem>();

            try
            {
                var item = data_item.GetItem(Assettypeid, Assetnameid);
                itemCodeList.Add(new SelectListItem()
                {
                    Value = "", Text = "--Select Item--"
                });
                for (int i = 0; i < item.Rows.Count; i++)
                {
                    itemCodeList.Add(new SelectListItem()
                    {
                        Value = item.Rows[i]["ID"].ToString(), Text = item.Rows[i]["Item"].ToString()
                    });
                }
            }
            catch (Exception exec)
            {
                BaseExceptionHandler.HandleException(ref exec);
            }
            ViewBag.ItemCode = itemCodeList;

            return(Json(new { success = true, ItemCodeList = JsonConvert.SerializeObject(itemCodeList) }, JsonRequestBehavior.AllowGet));
        }
 public JsonResult Read()
 {
     MTSHRDataLayer.AssetMaintenanceDetails Maintenance = new MTSHRDataLayer.AssetMaintenanceDetails();
     return Json(JsonConvert.SerializeObject(Maintenance.Read()), JsonRequestBehavior.AllowGet);
 }