public static void SetHtml(string key, string value) { Durados.Web.Mvc.View htmlView = GetHtmlView(); DataRow htmlRow = htmlView.GetDataRow(key); if (htmlRow == null) { if (htmlView.AllowCreate) { Dictionary <string, object> values = new Dictionary <string, object>(); values.Add("Name", key); values.Add("Text", value); htmlView.Create(values); } else { htmlView.AllowCreate = true; try { Dictionary <string, object> values = new Dictionary <string, object>(); values.Add("Name", key); values.Add("Text", value); htmlView.Create(values); } catch { }; htmlView.AllowCreate = false; } } else { Dictionary <string, object> values = new Dictionary <string, object>(); values.Add("Text", value); htmlView.Edit(values, key, null, null, null, null); } }
public IHttpActionResult Put(string appName) { try { if (!Maps.IsDevUser()) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.Unauthorized, Messages.ActionIsUnauthorized))); } string json = Request.Content.ReadAsStringAsync().Result; if (string.IsNullOrEmpty(json)) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, Messages.MissingObjectToUpdate))); } json = System.Web.HttpContext.Current.Server.UrlDecode(json.Replace("%22", "%2522").Replace("%2B", "%252B").Replace("+", "%2B")); Dictionary <string, object> values = Durados.Web.Mvc.UI.Json.JsonSerializer.Deserialize(json); int?id = Maps.Instance.AppExists(appName); if (!id.HasValue) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.NotFound, string.Format(Messages.AppNotFound, appName)))); } string pk = id.Value.ToString(); Durados.Web.Mvc.View appsView = (Durados.Web.Mvc.View)Maps.Instance.DuradosMap.Database.Views["durados_App"]; int PaymentStatus = System.Convert.ToInt32(values["PaymentStatus"]); appsView.Edit(new Dictionary <string, object>() { { "PaymentStatus", PaymentStatus } }, pk, view_BeforeEdit, view_BeforeEditInDatabase, view_AfterEditBeforeCommit, view_AfterEditAfterCommit); //string sql = string.Empty; //if (values.ContainsKey("PaymentStatus")) //{ // string PaymentStatus = values["PaymentStatus"].ToString(); // sql = "update [durados_App] set [PaymentStatus] = " + PaymentStatus + " where [durados_App].[Id] = " + pk + ";"; //} //if (values.ContainsKey("PaymentLocked")) //{ // string PaymentLocked = values["PaymentLocked"].ToString(); // sql += "update [durados_App] set [PaymentLocked] = " + PaymentLocked + " where [durados_App].[Id] = " + pk + ";"; //} //SqlAccess sa = new SqlAccess(); //sa.ExecuteNonQuery(Maps.Instance.DuradosMap.Database.ConnectionString, sql); Reload(appName); return(Ok()); } catch (Exception exception) { throw new BackAndApiUnexpectedResponseException(exception, this); } }