/// <summary> /// 删除记录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton1_Command(object sender, CommandEventArgs e) { int Id = Convert.ToInt32(e.CommandName); int relt = -1; cuttentPage = MTCPager1.PageIndex; Tunnel.Model.Tunnel_index model = mbll.GetModel(Id); //if (ul.JiaoSe(ul.LoginID) != "系统管理员" && ul.LoginID != model.UserId) //{ // Tunnel.Common.Message.Show("你不可以删除他人信息"); // return; //} //DelPricAndRider(Id); relt = mbll.Delete(Id); if (relt == 0) { Tunnel.Common.Message.Show("删除成功"); string strsql = ""; strsql = "insert into tunnel_log(l_user,l_time,l_content,l_ip,l_sort) values(" + ul.LoginID + ",'" + DateTime.Now + "','公司事务>>科室信息>>彻底删除科室信息。标题:" + model.Title + "','" + Tunnel.Common.Common.GetIp() + "',2)"; Tunnel.Data.DbHelperSQL.ExecuteSql(strsql); } else { Tunnel.Common.Message.Show("删除失败"); } PageBind2(); }
/// <summary> /// 得到一个对象实体 /// </summary> public Tunnel.Model.Tunnel_index GetModel(long i_id) { SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.BigInt), }; parameters[0].Value = i_id; Tunnel.Model.Tunnel_index model = new Tunnel.Model.Tunnel_index(); DataSet ds = DbHelperSQL.RunProcedure("UP_Tunnel_Index_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; int n = 0; model.Id = Convert.ToInt32(dt.Rows[n]["id"].ToString()); model.TypeId = int.Parse(dt.Rows[n]["typeId"].ToString()); model.UserId = int.Parse(dt.Rows[n]["userId"].ToString()); model.SetDate = dt.Rows[n]["setDate"].ToString(); model.Title = dt.Rows[n]["title"].ToString(); model.Content = dt.Rows[n]["content"].ToString(); model.ImagePaht = dt.Rows[n]["ImagePaht"].ToString(); model.HtmlSource = dt.Rows[n]["HtmlSource"].ToString(); model.Files = dt.Rows[n]["files"].ToString(); model.Filename = dt.Rows[n]["filename"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 获得数据列表 /// </summary> /// <param name="pb">分页基本信息</param> /// <param name="count">返回总数</param> /// <returns></returns> public List <Tunnel.Model.Tunnel_index> GetList3(PageBase pb, ref int count) { DataTable dt = dal.GetList2(pb, ref count).Tables[0]; List <Tunnel.Model.Tunnel_index> modelList = new List <Tunnel.Model.Tunnel_index>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0 && pb.DoCount == 0) { Tunnel.Model.Tunnel_index model; for (int n = 0; n < rowsCount; n++) { model = new Tunnel.Model.Tunnel_index(); model.Id = Convert.ToInt32(dt.Rows[n]["id"].ToString()); model.TypeId = int.Parse(dt.Rows[n]["typeId"].ToString()); model.UserId = int.Parse(dt.Rows[n]["userId"].ToString()); model.SetDate = dt.Rows[n]["setDate"].ToString(); model.Title = dt.Rows[n]["title"].ToString(); model.Content = dt.Rows[n]["content"].ToString(); model.ImagePaht = dt.Rows[n]["ImagePaht"].ToString(); model.HtmlSource = dt.Rows[n]["HtmlSource"].ToString(); model.Filename = dt.Rows[n]["filename"].ToString(); model.ReadUser = dt.Rows[n]["readUser"].ToString().Trim(); modelList.Add(model); } } return(modelList); }
public int Add(Tunnel.Model.Tunnel_index model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 8), new SqlParameter("@typeId", SqlDbType.Int, 8), new SqlParameter("@title", SqlDbType.VarChar, 200), new SqlParameter("@content", SqlDbType.Text), new SqlParameter("@imagePaht", SqlDbType.VarChar, 100), new SqlParameter("@htmlSource", SqlDbType.Text), new SqlParameter("@userId", SqlDbType.Int, 8), new SqlParameter("@files", SqlDbType.VarChar, 500), new SqlParameter("@bum_bz", SqlDbType.Int, 4), new SqlParameter("@filename", SqlDbType.VarChar, 500), new SqlParameter("@readUser", SqlDbType.VarChar, 500), }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.TypeId; parameters[2].Value = model.Title; parameters[3].Value = model.Content; parameters[4].Value = model.ImagePaht; parameters[5].Value = model.HtmlSource; parameters[6].Value = model.UserId; parameters[7].Value = model.Files; parameters[8].Value = model.Bum_bz; parameters[9].Value = model.Filename; parameters[10].Value = model.ReadUser; DbHelperSQL.RunProcedure("UP_Tunnel_Index_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }
private void PageBind(int indexId) { Tunnel.Model.Tunnel_index model = new Tunnel.Model.Tunnel_index(); Tunnel.BLL.Tunnel_Index index = new Tunnel.BLL.Tunnel_Index(); model = index.GetModel(indexId); tb_Title.Text = model.Title; DropDownList1.SelectedValue = model.TypeId.ToString(); FCKeditor.Value = model.Content; }
/// <summary> /// 页面数据绑定 /// </summary> public void PageBind() { Tunnel.Model.Tunnel_index model = new Tunnel.Model.Tunnel_index(); model = tbll.GetModel(Convert.ToInt64(Id)); title = model.Title; content = model.Content; setDate = model.SetDate; htmlSource = model.HtmlSource; userId = model.UserId; if (!string.IsNullOrEmpty(model.Files)) { fujian = "<a href='../" + model.Files + "' style='color: blue' >点击下载附件</a>"; } }
private void PageBind(int indexId) { Tunnel.Model.Tunnel_index model = new Tunnel.Model.Tunnel_index(); Tunnel.BLL.Tunnel_Index index = new Tunnel.BLL.Tunnel_Index(); model = index.GetModel(indexId); tb_Title.Text = model.Title; DropDownList1.SelectedValue = model.TypeId.ToString(); FCKeditor.Value = model.Content; if (!model.Files.Equals("")) { Label3.Visible = false; Label2.Visible = true; Label4.Visible = true; Label2.Text = "<br/>附件名:" + model.Files.Substring(model.Files.LastIndexOf("\\") + 1); Label3.Text = model.Files; } else { Label3.Visible = false; Label2.Visible = false; Label4.Visible = false; } if (model.ReadUser.Trim() != "") { lblUserID.Text = model.ReadUser.Trim(); string[] strUser = lblUserID.Text.Trim().Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); lblUser.Text = "浏览人:"; for (int i = 0; i < strUser.Length; i++) { lblUser.Text += ShowUserName(strUser[i]) + ","; } lblUser.Text = lblUser.Text.Trim().Substring(0, lblUser.Text.Trim().Length - 1); lblUser.Visible = true; lblUserMes.Visible = true; } else { lblUser.Visible = false; lblUserMes.Visible = false; } //tb_toname.Text = model.ReadUser.Trim(); }
/// <summary> /// 一周安排new两天 /// </summary> public string PageBind() { string htmlSource = string.Empty; Tunnel.BLL.Tunnel_Index tbll = new Tunnel.BLL.Tunnel_Index(); Tunnel.Model.Tunnel_index model = new Tunnel.Model.Tunnel_index(); List <Tunnel.Model.Tunnel_index> txList = tbll.GetModelList("id=(select max(id) from tunnel_index where typeid=30 and del=0)"); if (txList.Count > 0) { model = txList[0]; if (Math.Abs(Convert.ToDateTime(model.SetDate).Subtract(DateTime.Now).Days) < 2) { htmlSource = "<font color='red'>new !</font>"; } } else { htmlSource = ""; } return(htmlSource); }
/// <summary> /// 获得数据列表 /// </summary> public List <Tunnel.Model.Tunnel_index> DataTableToList(DataTable dt) { List <Tunnel.Model.Tunnel_index> modelList = new List <Tunnel.Model.Tunnel_index>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Tunnel.Model.Tunnel_index model; for (int n = 0; n < rowsCount; n++) { model = new Tunnel.Model.Tunnel_index(); if (dt.Rows[n]["id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["typeId"].ToString() != "") { model.TypeId = int.Parse(dt.Rows[n]["typeId"].ToString()); } model.Title = dt.Rows[n]["title"].ToString(); model.Content = dt.Rows[n]["content"].ToString(); model.ImagePaht = dt.Rows[n]["imagePaht"].ToString(); model.HtmlSource = dt.Rows[n]["htmlSource"].ToString(); if (dt.Rows[n]["setDate"].ToString() != "") { model.SetDate = Convert.ToString(dt.Rows[n]["setDate"].ToString()); } if (dt.Rows[n]["userId"].ToString() != "") { model.UserId = int.Parse(dt.Rows[n]["userId"].ToString()); } model.Files = dt.Rows[n]["files"].ToString(); model.Filename = dt.Rows[n]["filename"].ToString(); modelList.Add(model); } } return((List <Tunnel.Model.Tunnel_index>)modelList); }
//添加至信息表 protected void Button1_Click(object sender, EventArgs e) { if (titleId == 1) { if (!"0".Equals(Request.Form["DropDownList1"])) { string title = this.tb_Title.Text.Trim(); int typeid = Convert.ToInt32(this.DropDownList1.SelectedValue); string htmlsourcce = this.FCKeditor.Value; // Request.Form["content1"]; //this.FCKeditor.Value; string imagepaht = stringFormat(From_Content(htmlsourcce)).Trim(); string content = FCKeditor.Value; //Request.Form["content1"]; //FreeTextBox1.HtmlStrippedText; int userid = ul.LoginID; if (!string.IsNullOrEmpty(imagepaht)) { if (imagepaht.Substring(0, 1) == "/") { imagepaht = imagepaht.Substring(1, imagepaht.Length - 1); } imagepaht = imagepaht.Replace("src=/sdoa/", ""); } Tunnel.Model.Tunnel_index model = new Tunnel.Model.Tunnel_index(); model.Id = indexId; model.Title = title; model.TypeId = typeid; model.HtmlSource = htmlsourcce; model.ImagePaht = imagepaht; model.Content = content; model.UserId = userid; HttpPostedFile hpf = file1.PostedFile; if (Convert.ToDouble(hpf.ContentLength) / 1024 / 1024 > 10) { Response.Write("<script>alert('附件大小不能大于10MB');</script>"); return; } else { CreateMdAndFilePaht(hpf); } model.Files = filePaht; //infofiles //string str = titleName; Tunnel.BLL.Tunnel_information bllf = new Tunnel.BLL.Tunnel_information(); Tunnel.BLL.Tunnel_Index index = new Tunnel.BLL.Tunnel_Index(); int relt = -1; relt = index.Update(model); if (relt > 0) { Tunnel.Common.Message.Show("修改成功!", "N_InformationManage.aspx?type=" + Request.QueryString["type"]); } else { Tunnel.Common.Message.Show("修改失败!", "N_InformationManage.aspx?type=" + Request.QueryString["type"]); } // MessageBox(str, url); } else { Tunnel.Common.Message.Show("请选择子栏目!"); } } else { if (!"0".Equals(Request.Form["DropDownList1"])) { string title = this.tb_Title.Text.Trim(); int typeid = Convert.ToInt32(this.DropDownList1.SelectedValue); string htmlsourcce = this.FCKeditor.Value; // Request.Form["content1"]; //this.FCKeditor.Value; string imagepaht = stringFormat(From_Content(htmlsourcce)).Trim(); string content = FCKeditor.Value; //Request.Form["content1"]; //FreeTextBox1.HtmlStrippedText; int userid = ul.LoginID; if (!string.IsNullOrEmpty(imagepaht)) { if (imagepaht.Substring(0, 1) == "/") { imagepaht = imagepaht.Substring(1, imagepaht.Length - 1); } imagepaht = imagepaht.Replace("src=/sdoa/", ""); } Tunnel.Model.Tunnel_index model = new Tunnel.Model.Tunnel_index(); model.Title = title; model.TypeId = typeid; model.HtmlSource = htmlsourcce; model.ImagePaht = imagepaht; model.Content = content; model.UserId = userid; HttpPostedFile hpf = file1.PostedFile; if (Convert.ToDouble(hpf.ContentLength) / 1024 / 1024 > 10) { Response.Write("<script>alert('附件大小不能大于10MB');</script>"); return; } else { CreateMdAndFilePaht(hpf); } model.Files = filePaht; //infofiles //string str = titleName; Tunnel.BLL.Tunnel_information bllf = new Tunnel.BLL.Tunnel_information(); int relt = -1; relt = bllf.Add(model); if (relt > 0) { Tunnel.Common.Message.Show("增加成功!", "N_InformationManage.aspx?type=" + Request.QueryString["type"]); string strsql = ""; strsql = "insert into tunnel_log(l_user,l_time,l_content,l_ip,l_sort) values(" + ul.LoginID + ",'" + DateTime.Now + "','公司事务>>党工团信息>>修改党工团信息。标题:" + model.Title + "','" + Tunnel.Common.Common.GetIp() + "',1)"; Tunnel.Data.DbHelperSQL.ExecuteSql(strsql); } else { Tunnel.Common.Message.Show("增加失败!", "N_InformationManage.aspx?type=" + Request.QueryString["type"]); } // MessageBox(str, url); } else { Tunnel.Common.Message.Show("请选择子栏目!"); } } }
public int Add(Tunnel.Model.Tunnel_index model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Tunnel.Model.Tunnel_index model) { return(dal.Update(model)); }
/// <summary> /// 修改 /// </summary> /// <param name="message">信息集合</param> /// <returns>修改结果</returns> public int Update(Tunnel.Model.Tunnel_index message) { return(m_InfoItem.Update(message)); }
/// <summary> /// 添加 /// </summary> /// <param name="message">信息集合</param> /// <returns>添加结果</returns> public int Add(Tunnel.Model.Tunnel_index message) { return(m_InfoItem.Add(message)); }