//public ActionResult DataGridPartial(string DataGridID) //{ // DataGridField2 d = new DataGridField2(); // d.ID = Int32.Parse(DataGridID); // d.SetHeaderLabels("Jmeno", "Prijmeni", "Aktivni"); // TableRow2 tr = new TableRow2(); // tr.AddColumnCell(new LabelField("Jmeno")); // tr.AddColumnCell(new LabelField("Prijmeni")); // tr.AddColumnCell(new CheckBoxField("", "", true, new WebTagAttributes(true, ""))); // d.AddDataRow(tr, 1); // d.AddDataRow(tr.MakeCopy()); // d.AddDataRow(tr.MakeCopy()); // return PartialView("DataGridPartial", d); //} public ActionResult GetDataGridContent(string DataGridID, string ContentID, string[] FilterValues) { /*DataGridField2 d = new DataGridField2(); * d.ID = Int32.Parse(DataGridID); * d.SetHeaderLabels("Jmeno", "Prijmeni", "Aktivni"); * * TableRow2 tr = new TableRow2(); * tr.AddColumnCell(new LabelField("Jmeno-" + DateTime.Now.Second)); * tr.AddColumnCell(new LabelField("Prijmeni")); * tr.AddColumnCell(new CheckBoxField("", "", true, new WebTagAttributes(true, ""))); * * d.AddDataRow(tr, 1); * d.AddDataRow(tr.MakeCopy()); * d.AddDataRow(tr.MakeCopy());*/ int id = Int32.Parse(DataGridID); DataGridField d = DataGridField.GetTestData(id); d.ApplyFilters(FilterValues, FilteringType.StartWith); //System.Threading.Thread.Sleep(2000); return(Content(WebStuffHelper.GetString(d.HtmlTextTableBody()))); }
public string OnControllerAction(string ID, string What, string Data) { string ret = ""; if (What == "TryToAdd") { string StrignData = (string)Data; Dictionary <string, string> decoded = WebStuffHelper.DecodeJsonFormData(StrignData); Dictionary <string, string> dd = WebStuffHelper.GetRidOfParentID(decoded); ////////////////////////////////////////////////////////////////////////////////////////// string SQL; int off; string NewLabelID = dd["fNewLabelID"]; List <string> LanguageIDs = new List <string>(); StringBuilder sb = new StringBuilder(); foreach (KeyValuePair <string, string> entry in dd) { if (entry.Key == "fNewLabelID") { NewLabelID = dd["fNewLabelID"]; } else { off = entry.Key.IndexOf("-o"); LanguageIDs.Add(entry.Key.Substring(off + 2)); } } for (int i = 0; i < LanguageIDs.Count; i++) { sb.AppendLine("INSERT INTO Labels (LabelID, LanguageID) SELECT " + NewLabelID + ", '" + LanguageIDs[i] + "';"); } ////////////////////////////////////////////////////////////////////////////////////////// SQL = sb.ToString(); if (SQL.Length != 0) { using (SqlConnection con = new SqlConnection(DBUtil.GetSqlConnectionString())) { con.Open(); int r = -1; r = DBUtil.RunSQLQuery(con, SQL); if (r == -1) { ret = "Could not insert requested labels."; } else { ret = "ok"; } } } } else if (What == "AddMenu") { return(WebStuffHelper.GetString(GetNewLabelSuggestions())); } else if (What == "RefreshData") { string[] FilterValues = Data.Split('&'); DataGrid.ApplyFilters(FilterValues, FilteringType.StartWith); return(WebStuffHelper.GetString(DataGrid.HtmlTextTableBody())); } else if (What == "AjaxSave") { Dictionary <string, string> decoded = DecodeJsonFormData(Data); Save(decoded); ret = "ok"; } return(ret); }