public override void EditOnlyAdditionalSpecificProcess(Durados.Web.Mvc.View view, string pk) { if (view.Name == "durados_v_MessageBoard") { Dictionary <string, object> values = new Dictionary <string, object>(); values.Add("Reviewed", true); view.Edit(values, pk, view_BeforeEdit, view_BeforeEditInDatabase, view_AfterEditBeforeCommit, view_AfterEditAfterCommit); } }
/* * public override ActionResult Edit(string viewName, FormCollection collection, string pk, string guid) * { * try * { * Database.Logger.Log(viewName, "Start", "Edit", "Controller", "", 11, Map.Logger.NowWithMilliseconds(), DateTime.Now); * Durados.Web.Mvc.View view = GetView(viewName, "Edit"); * * * Durados.Web.Mvc.UI.Json.View jsonView = Durados.Web.Mvc.UI.Json.JsonSerializer.Deserialize<Durados.Web.Mvc.UI.Json.View>(collection["jsonView"]); * * SqlAccess sqlAccess = new SqlAccess(); * Dictionary<string, object> parameters = new Dictionary<string, object>(); * parameters.Add("@UserId", Convert.ToInt32(GetUserID())); * parameters.Add("@MessageId", Convert.ToInt32(pk)); * * foreach (Durados.Web.Mvc.UI.Json.Field jsonField in jsonView.Fields.Values) * { * * if (jsonField.Name == "Reviewed") * { * if (parameters.ContainsKey("@ActionId")) * { * parameters["@ActionId"] = MessageBoardAction.Review.GetHashCode(); * } * else * { * parameters.Add("@ActionId", MessageBoardAction.Review.GetHashCode()); * } * if (parameters.ContainsKey("@ActionValue")) * { * parameters["@ActionValue"] = ((ColumnField)view.Fields["Reviewed"]).ConvertFromString(jsonField.Value.ToString()); * } * else * { * parameters.Add("@ActionValue", ((ColumnField)view.Fields["Reviewed"]).ConvertFromString(jsonField.Value.ToString())); * } * * * * sqlAccess.ExecuteProcedure(Map.Database.ConnectionString, "Durados_MessageBoard_Action", parameters, null); * * } * else if (jsonField.Name == "Important") * { * if (parameters.ContainsKey("@ActionId")) * { * parameters["@ActionId"] = MessageBoardAction.Important.GetHashCode(); * } * else * { * parameters.Add("@ActionId", MessageBoardAction.Important.GetHashCode()); * } * if (parameters.ContainsKey("@ActionValue")) * { * parameters["@ActionValue"] = ((ColumnField)view.Fields["Reviewed"]).ConvertFromString(jsonField.Value.ToString()); * } * else * { * parameters.Add("@ActionValue", ((ColumnField)view.Fields["Reviewed"]).ConvertFromString(jsonField.Value.ToString())); * } * sqlAccess.ExecuteProcedure(Map.Database.ConnectionString, "Durados_MessageBoard_Action", parameters, null); * * } * else if (jsonField.Name == "ActionRequired") * { * if (parameters.ContainsKey("@ActionId")) * { * parameters["@ActionId"] = MessageBoardAction.ActionRequired.GetHashCode(); * } * else * { * parameters.Add("@ActionId", MessageBoardAction.ActionRequired.GetHashCode()); * } * if (parameters.ContainsKey("@ActionValue")) * { * parameters["@ActionValue"] = ((ColumnField)view.Fields["Reviewed"]).ConvertFromString(jsonField.Value.ToString()); * } * else * { * parameters.Add("@ActionValue", ((ColumnField)view.Fields["Reviewed"]).ConvertFromString(jsonField.Value.ToString())); * } * sqlAccess.ExecuteProcedure(Map.Database.ConnectionString, "Durados_MessageBoard_Action", parameters, null); * * } * } * Database.Logger.Log(view.Name, "End", "Edit", "Controller", "", 11, Map.Logger.NowWithMilliseconds(), DateTime.Now); * * return RedirectToAction(view.IndexAction, view.Controller, new { viewName = viewName, ajax = true, guid = guid }); * } * catch (MessageException exception) * { * Map.Logger.Log(GetControllerNameForLog(this.ControllerContext), this.ControllerContext.RouteData.Values["action"].ToString(), exception.Source, exception, 3, null); * return PartialView("~/Views/Shared/Controls/Message.ascx", FormatExceptionMessage(viewName, "Edit", exception)); * * } * catch (Exception exception) * { * Map.Logger.Log(GetControllerNameForLog(this.ControllerContext), this.ControllerContext.RouteData.Values["action"].ToString(), exception.Source, exception, 1, null); * return PartialView("~/Views/Shared/Controls/ErrorMessage.ascx", FormatExceptionMessage(viewName, "Edit", exception)); * * } * } */ /* * public override JsonResult EditOnly(string viewName, FormCollection collection, string pk, string guid) * { * try * { * Durados.Web.Mvc.View view = GetView(viewName, "EditOnly"); * * if (!view.IsEditable(guid)) * throw new AccessViolationException(); * * * * Durados.Web.Mvc.UI.Json.View jsonView = Durados.Web.Mvc.UI.Json.JsonSerializer.Deserialize<Durados.Web.Mvc.UI.Json.View>(collection["jsonView"]); * * * foreach (Durados.Web.Mvc.UI.Json.Field jsonField in jsonView.Fields.Values) * { * * if (jsonField.Name == "Important") * { * SaveMessageAction(view, pk, jsonField, MessageBoardAction.Important); * } * else if (jsonField.Name == "ActionRequired") * { * SaveMessageAction(view, pk, jsonField, MessageBoardAction.ActionRequired); * * * } * } * return Json("success"); * } * catch (Exception exception) * { * Map.Logger.Log(GetControllerNameForLog(this.ControllerContext), this.ControllerContext.RouteData.Values["action"].ToString(), exception.Source, exception, 1, null); * return Json("$$error$$" + FormatExceptionMessage(viewName, "EditOnly", exception)); * } * } */ public override JsonResult GetJsonView(string viewName, DataAction dataAction, string pk, string guid) { Durados.Web.Mvc.View view = GetView(viewName); if (viewName == "durados_v_MessageBoard") { try { //SqlAccess sqlAccess = new SqlAccess(); //Dictionary<string, object> parameters = new Dictionary<string, object>(); //parameters.Add("@UserId", Convert.ToInt32(GetUserID())); //parameters.Add("@MessageId", Convert.ToInt32(pk)); //parameters.Add("@ActionId", MessageBoardAction.Review.GetHashCode()); //parameters.Add("@ActionValue", true); //sqlAccess.ExecuteProcedure(Map.Database.ConnectionString, "Durados_MessageBoard_Action", parameters, null); Dictionary <string, object> values = new Dictionary <string, object>(); values.Add("Reviewed", true); view.Edit(values, pk, view_BeforeEdit, view_BeforeEditInDatabase, view_AfterEditBeforeCommit, view_AfterEditAfterCommit); } catch (Exception exception) { //return Json(new Json.JsonResult(exception.Message, false, "Unexpected")); Map.Logger.Log(GetControllerNameForLog(this.ControllerContext), this.ControllerContext.RouteData.Values["action"].ToString(), exception.Source, exception, 1, null); } } UI.Json.View jsonView; if (string.IsNullOrEmpty(pk)) { jsonView = view.GetJsonViewNotSerialized(dataAction, guid); } else { jsonView = view.GetJsonViewNotSerialized(dataAction, pk, GetDataRow(view, pk), guid, view_BeforeSelect, null); } return(Json(GetJsonViewSerialized(view, dataAction, jsonView))); }