public int Add(M_SinglePage model) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.NVarChar, 100), new SqlParameter("@FolderPath", SqlDbType.NVarChar, 50), new SqlParameter("@FileName", SqlDbType.NVarChar, 100), new SqlParameter("@FileExtend", SqlDbType.NVarChar, 50), new SqlParameter("@TemplatePath", SqlDbType.NVarChar, 150), new SqlParameter("@Content", SqlDbType.NVarChar, 200), new SqlParameter("@AddTime", SqlDbType.DateTime) }; commandParameters[0].Value = model.Name; commandParameters[1].Value = model.FolderPath; commandParameters[2].Value = model.FileName; commandParameters[3].Value = model.FileExtend; commandParameters[4].Value = model.TemplatePath; commandParameters[5].Value = model.Content; commandParameters[6].Value = model.AddTime; return Convert.ToInt32(SqlHelper.ExecuteScalar(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_SinglePage_Add", commandParameters)); }
public void Update(M_SinglePage model) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@SingleId", SqlDbType.Int, 4), new SqlParameter("@Name", SqlDbType.NVarChar, 100), new SqlParameter("@FolderPath", SqlDbType.NVarChar, 50), new SqlParameter("@FileName", SqlDbType.NVarChar, 100), new SqlParameter("@FileExtend", SqlDbType.NVarChar, 50), new SqlParameter("@TemplatePath", SqlDbType.NVarChar, 150), new SqlParameter("@Content", SqlDbType.NVarChar, 200), new SqlParameter("@AddTime", SqlDbType.DateTime) }; commandParameters[0].Value = model.SingleId; commandParameters[1].Value = model.Name; commandParameters[2].Value = model.FolderPath; commandParameters[3].Value = model.FileName; commandParameters[4].Value = model.FileExtend; commandParameters[5].Value = model.TemplatePath; commandParameters[6].Value = model.Content; commandParameters[7].Value = model.AddTime; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_SinglePage_Update", commandParameters); }
public M_SinglePage GetModel(int SingleId) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@SingleId", SqlDbType.Int, 4) }; commandParameters[0].Value = SingleId; M_SinglePage page = new M_SinglePage(); DataSet set = SqlHelper.ExecuteDataSet(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_SinglePage_GetModel", commandParameters); page.SingleId = SingleId; if (set.Tables[0].Rows.Count > 0) { page.Name = set.Tables[0].Rows[0]["Name"].ToString(); page.FolderPath = set.Tables[0].Rows[0]["FolderPath"].ToString(); page.FileName = set.Tables[0].Rows[0]["FileName"].ToString(); page.FileExtend = set.Tables[0].Rows[0]["FileExtend"].ToString(); page.TemplatePath = set.Tables[0].Rows[0]["TemplatePath"].ToString(); page.Content = set.Tables[0].Rows[0]["Content"].ToString(); if (set.Tables[0].Rows[0]["AddTime"].ToString() != "") { page.AddTime = DateTime.Parse(set.Tables[0].Rows[0]["AddTime"].ToString()); } return page; } return null; }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetNoStore(); if (!Page.IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["SingleId"])) { try { SingleId = int.Parse(Request.QueryString["SingleId"]); } catch { } } MsinglePage = BSinglePage.GetModel(SingleId); if (!Page.IsPostBack) { FormName.Text = MsinglePage.Name; TextBox1.Text = "<a href=\"" + Param.ApplicationRootPath + "" + MsinglePage.FolderPath + "" + MsinglePage.FileName + "" + MsinglePage.FileExtend + "\" target=\"_blank\">" + MsinglePage.Name + "</a>"; } } }
private void GetModel() { MsinglePage = BSinglePage.GetModel(SingleId); txtName.Text=MsinglePage.Name; txtFolderPath.Text = MsinglePage.FolderPath.Substring(1, MsinglePage.FolderPath.Length-1); txtFileName.Text=MsinglePage.FileName; txtFileExtend.Text=MsinglePage.FileExtend; txtTemplatePath.Text=MsinglePage.TemplatePath; txtContent.Text=MsinglePage.Content; }
public void Update(M_SinglePage model) { this.dal.Update(model); }
public int Add(M_SinglePage model) { return this.dal.Add(model); }