public static int getCommcount(string mark, workplanEntity custinfo) { string strWhere = ""; if (mark == "begin") { if (custinfo.Ploginname.Split('_')[1].ToString() == "1") { strWhere = ""; } else { strWhere = " ploginname='" + custinfo.Ploginname.Split('_')[0] + "' "; } } else { if (custinfo.Ploginname.Split('_')[1].ToString() == "1") { strWhere = " convert(datetime,ptdate) >= convert(datetime, '" + custinfo.Ptdate + "') and convert(datetime,ptdate) <= convert(datetime,'" + custinfo.Pedate + "') "; } else { strWhere = " ploginname='" + custinfo.Ploginname.Split('_')[0] + "' and convert(datetime,ptdate) >= convert(datetime, '" + custinfo.Ptdate + "') and convert(datetime,ptdate) <= convert(datetime,'" + custinfo.Pedate + "') "; } } return conString.Getcommentcount("workplan", "id", strWhere); }
/// <summary> /// ��ü�¼��Ϣ�� /// </summary> /// <param name="id"></param> /// <returns></returns> public static workplanEntity getcusnoteInfo(string id) { workplanEntity note = new workplanEntity(); string sql = "select * from workplan where id=" + id; using (SqlDataReader dr = SqlHelper.ExecuteReader(DataBll.conString.constr, CommandType.Text, sql)) { if (dr.Read()) { note.Id = dr["id"].ToString(); note.Ptdate = dr["ptdate"].ToString(); note.Pedate = dr["pedate"].ToString(); note.Puser = dr["puser"].ToString(); note.Ptime = dr["ptime"].ToString(); note.Content1 = dr["content1"].ToString(); note.Bgqk1 = dr["bgqk1"].ToString(); note.Wcqk1 = dr["wcqk1"].ToString(); note.Content2 = dr["content2"].ToString(); note.Bgqk2 = dr["bgqk2"].ToString(); note.Wcqk2 = dr["wcqk2"].ToString(); note.Content3 = dr["content3"].ToString(); note.Bgqk3 = dr["bgqk3"].ToString(); note.Wcqk3 = dr["wcqk3"].ToString(); note.Content4 = dr["content4"].ToString(); note.Bgqk4 = dr["bgqk4"].ToString(); note.Wcqk4 = dr["wcqk4"].ToString(); note.Content5 = dr["content5"].ToString(); note.Bgqk5 = dr["bgqk5"].ToString(); note.Wcqk5 = dr["wcqk5"].ToString(); note.Content6 = dr["content6"].ToString(); note.Bgqk6 = dr["bgqk6"].ToString(); note.Wcqk6 = dr["wcqk6"].ToString(); } } return note; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { this.txtcid.Text =Request.QueryString["id"].ToString(); oper = workplanBll.getcusnoteInfo(Request.QueryString["id"]); } } }
protected void btnconfirm_Click(object sender, EventArgs e) { workplanEntity oper = new workplanEntity(); oper.Ptdate = this.txtptdate.Text; oper.Pedate = this.txtpedate.Text; oper.Puser = this.txtpuser.Text; oper.Content1 = this.txtcontent1.Text; oper.Bgqk1 = this.txtbgqk1.Text; oper.Wcqk1 = this.txtwcqk1.Text; oper.Content2 = this.txtcontent2.Text; oper.Bgqk2 = this.txtbgqk2.Text; oper.Wcqk2 = this.txtwcqk2.Text; oper.Content3 = this.txtcontent3.Text; oper.Bgqk3 = this.txtbgqk3.Text; oper.Wcqk3 = this.txtwcqk3.Text; oper.Content4 = this.txtcontent4.Text; oper.Bgqk4 = this.txtbgqk4.Text; oper.Wcqk4 = this.txtwcqk4.Text; oper.Content5 = this.txtcontent5.Text; oper.Bgqk5 = this.txtbgqk5.Text; oper.Wcqk5 = this.txtwcqk5.Text; oper.Content6 = this.txtcontent6.Text; oper.Bgqk6 = this.txtbgqk6.Text; oper.Wcqk6 = this.txtwcqk6.Text; oper.Ptime = DateTime.Now.ToString(); oper.Ploginname = Session["username"].ToString(); if (action == "update") { oper.Id = cid; int i = workplanBll.updateCusnote(oper); if (i > 0) { action = ""; Response.Redirect("workplanlist.aspx"); } } else { int i = workplanBll.insertCusnote(oper); if (i > 0) { Response.Redirect("workplanlist.aspx"); } } }
/// <summary> /// �������� /// </summary> /// <param name="note"></param> /// <returns></returns> public static int updateCusnote(workplanEntity note) { string sql = "update workplan set ptdate='" + note.Ptdate + "',pedate='" + note.Pedate + "',puser='******',ptime='" + note.Ptime + "',content1='" + note.Content1 + "',bgqk1='" + note.Bgqk1 + "',wcqk1='" + note.Wcqk1 + "',content2='" + note.Content2 + "',bgqk2='" + note.Bgqk2 + "',wcqk2='" + note.Wcqk2 + "',content3='" + note.Content3 + "',bgqk3='" + note.Bgqk3 + "',wcqk3='" + note.Wcqk3 + "',content4='" + note.Content4 + "',bgqk4='" + note.Bgqk4 + "',wcqk4='" + note.Wcqk4 + "',content5='" + note.Content5 + "',bgqk5='" + note.Bgqk5 + "',wcqk5='" + note.Wcqk5 + "',content6='" + note.Content6 + "',bgqk6='" + note.Bgqk6 + "',wcqk6='" + note.Wcqk6 + "',ploginname='"+note.Ploginname+"' where id=" + note.Id.ToString(); return SqlHelper.ExecuteNonQuery(DataBll.conString.constr, CommandType.Text, sql); }
/// <summary> /// �����¼��Ϣ /// </summary> /// <param name="note"></param> /// <returns></returns> public static int insertCusnote(workplanEntity note) { string sql = "insert into workplan ( ptdate,pedate,puser,ptime,content1,bgqk1,wcqk1,content2,bgqk2,wcqk2,content3,bgqk3,wcqk3,content4,bgqk4,wcqk4,content5,bgqk5,wcqk5,content6,bgqk6,wcqk6,ploginname) values"; sql += "('" + note.Ptdate + "','" + note.Pedate + "','" + note.Puser + "','" + note.Ptime + "','" + note.Content1 + "','" + note.Bgqk1 + "','" + note.Wcqk1 + "','" + note.Content2 + "','" + note.Bgqk2 + "','" + note.Wcqk2 + "','" + note.Content3 + "','" + note.Bgqk3 + "','" + note.Wcqk3 + "','" + note.Content4 + "','" + note.Bgqk4 + "','" + note.Wcqk4 + "','" + note.Content5 + "','" + note.Bgqk5 + "','" + note.Wcqk5 + "','" + note.Content6 + "','" + note.Bgqk6 + "','" + note.Wcqk6 + "','"+note.Ploginname+"')"; return SqlHelper.ExecuteNonQuery(DataBll.conString.constr, CommandType.Text, sql); }
public static DataSet getCusnoteinfo(string mark, int pi, int ps, workplanEntity custinfo) { string tablename = " workplan "; string sortfld = " id "; string selecfld = " *"; string PrimaryKey = "id"; int pageindex = pi; int pagesize = ps; int sortType = 1; string strWhere = ""; if (mark == "begin") { if (custinfo.Ploginname.Split('_')[1].ToString() == "1") { strWhere = ""; } else { strWhere = " ploginname='" + custinfo.Ploginname.Split('_')[0] + "' "; } } else { if (custinfo.Ploginname.Split('_')[1].ToString() == "1") { strWhere = " convert(datetime,ptdate) >= convert(datetime, '" + custinfo.Ptdate + "') and convert(datetime,ptdate) <= convert(datetime,'" + custinfo.Pedate + "') "; } else { strWhere = " ploginname='" + custinfo.Ploginname.Split('_')[0] + "' and convert(datetime,ptdate) >= convert(datetime, '" + custinfo.Ptdate + "') and convert(datetime,ptdate) <= convert(datetime,'" + custinfo.Pedate + "') "; } } string strM = "id"; return conString.GetcommdataSource(tablename, PrimaryKey, sortfld, pagesize, pageindex, sortType, strWhere, strM, selecfld); }
void bindlikedata(int pi, int ps, workplanEntity custinfo) { this.Repeater1.DataSource = workplanBll.getCusnoteinfo("", pi, ps, custinfo); this.Repeater1.DataBind(); int pagecount = workplanBll.getCommcount("", custinfo); this.AspNetPager1.PageSize = pageSize; this.AspNetPager1.RecordCount = pagecount; this.AspNetPager1.CustomInfoHTML = "总:" + AspNetPager1.RecordCount.ToString() + "条,每页:%PageSize%条,当前:%CurrentPageIndex%/%PageCount%"; }
void binddata(int pi, int ps) { workplanEntity custinfo = new workplanEntity(); custinfo.Ploginname = Session["username"].ToString()+"_"+Session["rid"].ToString(); this.Repeater1.DataSource = workplanBll.getCusnoteinfo("begin", pi, ps, custinfo); this.Repeater1.DataBind(); int pagecount = workplanBll.getCommcount("begin", custinfo); this.AspNetPager1.PageSize = pageSize; this.AspNetPager1.RecordCount = pagecount; this.AspNetPager1.CustomInfoHTML = "总:" + AspNetPager1.RecordCount.ToString() + "条,每页:%PageSize%条,当前:%CurrentPageIndex%/%PageCount%"; }