void LoadHmlt() { DataSourceMaster.SelectParameters[0].DefaultValue = ASPxComboBox1.Value.ToString(); DataView dv = (DataView)DataSourceMaster.Select(DataSourceSelectArguments.Empty);; if (dv.Table.Rows.Count > 0) { HtmlEditor1.Html = dv.Table.Rows[0][1].ToString(); } }
void SaveHtml() { bool recordsaved = false; try { DataSourceMaster.InsertParameters["PageType"].DefaultValue = ContentTypeASPxComboBox.Text; DataSourceMaster.Insert(); recordsaved = true; } catch (Exception e) { // throw; recordsaved = false; divMessage.Visible = true; divMessage.InnerHtml = "ERROR: " + Environment.NewLine + e.Message; Page.ClientScript.RegisterStartupScript(this.GetType(), "toastMsg", "$(\"#pageToastMsg\").modal('show');", true); } finally { if (recordsaved) { string contentType = ContentTypeASPxComboBox.Text.ToString().ToLower(); string category = (CategoryComboBox.Value.ToString()); string subCategory = (SubCategoryComboBox.Value.ToString()); string title = (TitleTextBox.Value.ToString()); if (!string.IsNullOrEmpty(contentType) && !string.IsNullOrEmpty(category) && !string.IsNullOrEmpty(subCategory) && !string.IsNullOrEmpty(title) ) { string imgDir = Server.MapPath("~/Content/Img/" + contentType + "/" + category + "/" + subCategory + "/" + title); string fileDir = Server.MapPath("~/Content/Files/" + contentType + "/" + category + "/" + subCategory + "/" + title); if (!Directory.Exists(imgDir)) { _ = Directory.CreateDirectory(imgDir); } if (!Directory.Exists(fileDir)) { _ = Directory.CreateDirectory(fileDir); } } divMessage.Visible = true; divMessage.InnerHtml = "Página Guardada."; Page.ClientScript.RegisterStartupScript(this.GetType(), "toastMsg", "$(\"#pageToastMsg\").modal('show');", true); } } }
void SaveHtml() { bool recordsaved = false; try { DataSourceMaster.UpdateParameters["Description"].DefaultValue = HtmlEditor1.Html; DataSourceMaster.UpdateParameters["PageID"].DefaultValue = ASPxComboBox1.Value.ToString(); DataSourceMaster.Update(); recordsaved = true; } catch (Exception e) { // throw; recordsaved = false; divMessage.Visible = true; divMessage.InnerHtml = "ERROR: " + Environment.NewLine + e.Message; Page.ClientScript.RegisterStartupScript(this.GetType(), "toastMsg", "$(\"#pageToastMsg\").modal('show');", true); } finally { if (recordsaved) { /* * if (recordsaved) * { * * string contentType = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ContentTypeASPxComboBox.Text.ToString()); * string category = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(CategoryComboBox.Value.ToString()); * string subCategory = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(SubCategoryComboBox.Value.ToString()); * string title = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(TitleTextBox.Value.ToString()); * * if (!string.IsNullOrEmpty(contentType) * && !string.IsNullOrEmpty(category) * && !string.IsNullOrEmpty(subCategory) * && !string.IsNullOrEmpty(title) * ) * { * * string imgDir = Server.MapPath("~/Content/Img/" + contentType + "/" + category + "/" + subCategory + "/" + title); * string fileDir = Server.MapPath("~/Content/Files/" + contentType + "/" + category + "/" + subCategory + "/" + title); * * if (!Directory.Exists(imgDir)) { _ = Directory.CreateDirectory(imgDir); } * if (!Directory.Exists(fileDir)) { _ = Directory.CreateDirectory(fileDir); } * * } * * } */ } } }
public DataSourceMasterModel GetDataSourceMasterByPrimaryKey(Int64 MasterReport_Id) { DataSourceMaster result = this.dataContext .DataSourcesMaster .FirstOrDefault(pk => pk.MasterReport_Id == MasterReport_Id); if (result == null) { return(null); } return(result.CopyToObject(new DataSourceMasterModel()) as DataSourceMasterModel); }
void LoadHmlt() { DataSourceMaster.SelectParameters[0].DefaultValue = ASPxComboBoxSearch.Value.ToString(); DataView dv = (DataView)DataSourceMaster.Select(DataSourceSelectArguments.Empty);; if (dv.Table.Rows.Count > 0) { ContentTypeASPxComboBox.Value = dv.Table.Rows[0]["ContentTypeID"].ToString(); PageStatusComboBox.Value = dv.Table.Rows[0]["PageStatusID"].ToString(); CategoryComboBox.Value = dv.Table.Rows[0]["Category"].ToString(); SubCategoryComboBox.Value = dv.Table.Rows[0]["SubCategory"].ToString(); TitleTextBox.Value = dv.Table.Rows[0]["Title"].ToString(); MetaKeywordsTokenBox.Value = dv.Table.Rows[0]["MetaKeywords"].ToString(); NotesMemo.Value = dv.Table.Rows[0]["Notes"].ToString(); DescriptionMemo.Value = dv.Table.Rows[0]["Description"].ToString(); HtmlEditor1.Html = dv.Table.Rows[0]["Body"].ToString(); } }
public void UpdateDataSourceMaster(DataSourceMasterModel model) { DataSourceMaster existing = this.dataContext .DataSourcesMaster .Where(rx => rx.MasterReport_Id == model.MasterReport_Id) .FirstOrDefault(); if (existing == null) { existing = model.CopyToObject(new DataSourceMaster()) as DataSourceMaster; this.dataContext.DataSourcesMaster.Add(existing); } else { existing = model.CopyToObject(existing) as DataSourceMaster; } this.dataContext.SaveChanges(); model = existing.CopyToObject(model) as DataSourceMasterModel; }