Exemplo n.º 1
0
        public virtual ActionResult EditGrid()
        {
            DocInformationView model = dal.GetCreateFormDefaultValue();

            ViewData["InsertDefaultValueJson"] = JsonConvert.SerializeObject(model);
            return(Index("EditGrid", ""));
        }
Exemplo n.º 2
0
        public virtual ActionResult Create(DocInformationView model, bool returnData = false)
        {
            object newId = "";

            try
            {
                model = dal.GetInsertModelValue(model);
                dal.CreateFormValidator(model);
                int result = dal.InsertByModel(model);
                hash["success"] = result > 0;
                if (result > 0)
                {
                    newId = dal.GetMaxID() - 1;

                    hash["id"] = newId;
                    if (returnData)
                    {
                        DocInformationView newrow = dal.GetModelByID(newId);
                        hash["data"] = newrow;
                    }
                }
            }
            catch (Exception ex)
            {
                hash["message"] = ex.Message;
            }
            return(Content(JsonConvert.SerializeObject(hash)));
        }
Exemplo n.º 3
0
        public virtual ActionResult Create(string id = "")
        {
            ViewBag.ID  = id;
            ViewBag.DAL = dal;
            DocInformationView model = dal.GetCreateFormDefaultValue();

            model = dal.GetModelShowValue(model);
            string formPath = SiteCommon.GetCustomPage("~/Areas/Doc/Views/DocInformationView/_/Create.cshtml");

            return(View(formPath, model));
        }
Exemplo n.º 4
0
        public ActionResult GetEntityByID(string id)
        {
            DocInformationView model = dal.GetModelByID(id);

            if (model != null)
            {
                hash["data"]    = model;
                hash["success"] = true;
            }
            return(Content(JsonConvert.SerializeObject(hash)));
        }
Exemplo n.º 5
0
        public ActionResult GetModelByID(string id)
        {
            DocInformationView model = dal.GetModelByID(id);

            if (model != null)
            {
                model           = dal.GetModelShowValue(model, true);
                hash["data"]    = model;
                hash["success"] = true;
                string json = JsonConvert.SerializeObject(hash);
                json = json.Replace("_ShowValue\":", "\":");
                return(Content(json));
            }
            return(Content(JsonConvert.SerializeObject(hash)));
        }
Exemplo n.º 6
0
 public virtual ActionResult Edit(DocInformationView model, bool returnData = false)
 {
     try
     {
         model = dal.GetUpdateModelValue(model);
         dal.EditFormValidator(model);
         int result = dal.UpdateByModel(model);
         hash["success"] = result > 0;
         if (result > 0)
         {
             hash["id"] = model.InfoID;
             if (returnData)
             {
                 DocInformationView newrow = dal.GetModelByID(model.InfoID);
                 hash["data"] = newrow;
             }
         }
     }
     catch (Exception ex)
     {
         hash["message"] = ex.Message;
     }
     return(Content(JsonConvert.SerializeObject(hash)));
 }