Beispiel #1
0
        /// <summary>
        /// Lấy danh sách đơn vị nạp vào combobox
        /// </summary>
        /// <returns></returns>
        public JsonResult ListAll()
        {
            var param = new MeasureParamDao().ListAll();

            if (param == null)
            {
                return(NotifyError("Liệt kê"));
            }
            return(Json(param, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public JsonResult ListAllPaging(int?page = 1, int?rows = 10)
        {
            int pageIndex = page.HasValue ? (int)page : 1;
            int pageSize  = rows.HasValue ? (int)rows : 10;
            int total     = 0;
            var param     = new MeasureParamDao().ListAllPaging(out total, pageIndex, pageSize);

            if (param == null)
            {
                return(NotifyError("Liệt kê"));
            }
            return(Json(new { total = total, rows = param }));
        }
Beispiel #3
0
        public JsonResult Destroy(int id)
        {
            bool result = new MeasureParamDao().Delete(id);

            if (result)
            {
                return(Json(new { success = true }));
            }
            else
            {
                return(NotifyError("Xóa"));
            }
        }
Beispiel #4
0
        public JsonResult Create(MeasureParamDetail param)
        {
            TM_MeasureParam entity = new TM_MeasureParam();

            entity.CreatedDate = DateTime.Now;
            entity.CodeName    = param.CodeName;
            entity.Description = param.Description;
            entity.Status      = param.Status;
            entity.Unit        = param.Unit;
            entity.Type        = param.Type;
            int result = new MeasureParamDao().Create(entity);

            param.Id       = entity.Id;
            param.TypeName = new ParamTypeDao().FindName(param.Type);
            if (result > 0)
            {
                return(Json(param));
            }
            else
            {
                return(NotifyError("Thêm"));
            }
        }
Beispiel #5
0
        public JsonResult Update([Bind(Include = "Id,CodeName,Description,Type,Unit,Status")] TM_MeasureParam param)
        {
            bool   result   = new MeasureParamDao().Update(param);
            string TypeName = new ParamTypeDao().FindName(param.Type);

            if (result)
            {
                return(Json(new
                {
                    isNewRecord = false,
                    Id = param.Id,
                    CodeName = param.CodeName,
                    Description = param.Description,
                    Unit = param.Unit,
                    Status = param.Status,
                    Type = param.Type,
                    TypeName = TypeName
                }));
            }
            else
            {
                return(NotifyError("Sửa"));
            }
        }