Пример #1
0
        public ActionResult DeleteItem(string data)
        {
            var dbConn = Helpers.OrmliteConnection.openConn();

            if (asset.Delete)
            {
                try
                {
                    string[] separators = { "@@" };
                    var      listdata   = data.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    var      detail     = new CRM_ExtsInfo();
                    foreach (var item in listdata)
                    {
                        if (dbConn.Select <CRM_ExtsInfo>(s => s.RowID == int.Parse(item)).Count() > 0)
                        {
                            var ext_row = dbConn.SingleOrDefault <CRM_ExtsInfo>("RowID= {0}", item);
                            dbConn.Delete <CRM_ExtsInfo_Meta>(where : "FactorID = '" + ext_row.IDName + "'");
                            var success = dbConn.Delete <CRM_ExtsInfo>(where : "RowID = '" + item + "'") >= 1;
                            if (!success)
                            {
                                return(Json(new { success = false, message = "Không thể lưu" }));
                            }
                        }
                    }
                    return(Json(new { success = true }));
                }
                catch (Exception e)
                {
                    return(Json(new { success = false, message = e.Message }));
                }
            }
            else
            {
                return(Json(new { success = false, message = "Không có quyền xóa." }));
            }
        }
Пример #2
0
        public ActionResult CreateExts([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]  IEnumerable <CRM_ExtsInfo> listItem)
        {
            var rs = CRM_ExtsInfo.Save(listItem, currentUser.UserName);

            return(Json(rs));
        }