Пример #1
0
        public ActionResult SubmitTestTableForm(string KeyValue, TestTable testtable, string BuildFormJson)
        {
            string        ModuleId    = DESEncrypt.Decrypt(CookieHelper.GetCookie("ModuleId"));
            IDatabase     database    = DataFactory.Database();
            DbTransaction isOpenTrans = database.BeginTrans();

            try
            {
                string Message = KeyValue == "" ? "新增成功。" : "编辑成功。";
                if (!string.IsNullOrEmpty(KeyValue))
                {
                    if (KeyValue == ManageProvider.Provider.Current().UserId)
                    {
                        throw new Exception("无权限编辑信息");
                    }
                    //base_user.Modify(KeyValue);
                    testtable.Modify(KeyValue);
                    database.Update(testtable, isOpenTrans);
                }
                else
                {
                    testtable.Create();

                    database.Insert(testtable, isOpenTrans);
                    //database.Insert(base_employee, isOpenTrans);
                    Base_DataScopePermissionBll.Instance.AddScopeDefault(ModuleId, ManageProvider.Provider.Current().UserId, testtable.TestId, isOpenTrans);
                }
                Base_FormAttributeBll.Instance.SaveBuildForm(BuildFormJson, testtable.TestId, ModuleId, isOpenTrans);
                database.Commit();
                return(Content(new JsonMessage {
                    Success = true, Code = "1", Message = Message
                }.ToString()));
            }
            catch (Exception ex)
            {
                database.Rollback();
                database.Close();
                return(Content(new JsonMessage {
                    Success = false, Code = "-1", Message = "操作失败:" + ex.Message
                }.ToString()));
            }
        }