public static GlobalMenuItem LoadFromDB(GeneralSessionInfo gsi) { using (SqlConnection con = new SqlConnection(DBUtil.GetSqlConnectionString())) { con.Open(); SqlDataAdapter sqlDataAdapter; DataSet dataSet = new DataSet(); SqlCommand sql = new SqlCommand("GetGlobalMenu", con); sql.CommandType = CommandType.StoredProcedure; sql.Parameters.Add(new SqlParameter("RetailerID", gsi.retailerID)); sql.Parameters.Add(new SqlParameter("UserID", gsi.userID)); sql.Parameters.Add(new SqlParameter("LanguageID", gsi.languageID)); try { sqlDataAdapter = new SqlDataAdapter(sql); sqlDataAdapter.Fill(dataSet); if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0) { return(ProcessMenu(dataSet.Tables[0])); } else { Console.WriteLine("No matching records found."); } } catch { } } return(null); }
static void Main(string[] args) { Dictionary <string, StringValues> d = new Dictionary <string, Microsoft.Extensions.Primitives.StringValues>(); FormCollection a = new FormCollection(d); GeneralSessionInfo gsi = new GeneralSessionInfo(1, 1, "en"); Labels l = new Labels(""); l.LoadLabelsFromDB(); Menu navigation = new Menu(); navigation.LoadNavigation(new GeneralSessionInfo(1, 1, "en")); navigation.HtmlText(); Project pr = new Project(1); pr.SavePage(gsi, 1, a); // asi bych ProjectID a PageID mel dodat ze stranky jako hidden fields. //pr.LoadProjectFromDB(new GeneralSessionInfo(1,1,"en"),1,1); Panel p = new Panel(1, "ahoj", 2); //p.Load(); }
public ActionResult Index() { GeneralSessionInfo gsi = new GeneralSessionInfo(1, 1, "en"); ViewData["gsi"] = JsonConvert.SerializeObject(gsi); //TempData.Add("a", "b"); //p = new Project(); return(View()); //return this.RedirectToAction("ShowProject", "Project"); }
public static TagBuilder RenderMenu(Object gsis) { if (gsis == null) { TagBuilder tb = new TagBuilder("span"); tb.InnerHtml.AppendHtml("Global menu not defined."); return(tb); } else { GeneralSessionInfo gsi = JsonConvert.DeserializeObject <GeneralSessionInfo>((string)gsis); return(RenderMenu(gsi)); } }
public static TagBuilder RenderMenu(GeneralSessionInfo gsi) { GlobalMenuItem root = LoadFromDB(gsi); if (root == null) { TagBuilder tb = new TagBuilder("span"); tb.InnerHtml.AppendHtml("Global menu not defined."); return(tb); } else { return(root.HtmlText()); } }
public ActionResult ShowProject(IFormCollection fc) { // User, RetailerID, languageID GeneralSessionInfo gsi = new GeneralSessionInfo(HttpContext); gsi = new GeneralSessionInfo(1, 1, "en"); Project pr = new Project(1); pr.SavePage(gsi, 1, fc); // asi bych ProjectID a PageID mel dodat ze stranky jako hidden fields. //p.Page.SideMenu.Select(HttpContext.Session.GetString("OpenMenu")); //return View(p); return(this.RedirectToAction("ShowProject", "Project")); }
public IActionResult Index() { return this.RedirectToAction("NewProject", "Project", new { NavID = 21 }); //return this.RedirectToAction("Labels", "Configuration"); //return this.RedirectToAction("CreateNewProject", "Project"); ////return this.RedirectToAction("ShowProject", "Project"); //Project pr = new Project(null); GeneralSessionInfo gsi = new GeneralSessionInfo(1, 1, "en"); ViewData["gsi"] = JsonConvert.SerializeObject(gsi); Menu navigation = new Menu(); navigation.LoadNavigation(gsi); return View(navigation); }
public bool LoadNavigation(GeneralSessionInfo gsi) { int RootNavigationItemID = 6; NavID = RootNavigationItemID; using (SqlConnection con = new SqlConnection(DBUtil.GetSqlConnectionString())) { con.Open(); SqlDataAdapter sqlDataAdapter; DataSet dataSet = new DataSet(); List <Field> ret = new List <Field>(); SqlCommand sql = new SqlCommand("GetNavigation", con); sql.CommandType = CommandType.StoredProcedure; sql.Parameters.Add(new SqlParameter("NavID", RootNavigationItemID)); sql.Parameters.Add(new SqlParameter("LanguageID", gsi.languageID)); sql.Parameters.Add(new SqlParameter("UserID", gsi.userID)); try { sqlDataAdapter = new SqlDataAdapter(sql); sqlDataAdapter.Fill(dataSet); if (dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0) { ProcessNavigation(dataSet.Tables[0]); } else { //Page.GenerateUnknownPageInfo(); Console.WriteLine("No matching records found."); } } catch (Exception eee) { ret.Add(new LabelTextAreaField("1", "Exception in LoadNavigation(..)", eee.ToString())); } return(false); } }