protected void Button1_Click(object sender, EventArgs e) { string wherestr = " where 1=1"; if (CBOrg.Checked) { string selectorgid = DropDownList1.SelectedValue; if (selectorgid == "1") { wherestr += " and CustomerInfo.OrganizeID in (select OrganizeID from Organize)"; } else { wherestr += " and CustomerInfo.OrganizeID in (select OrganizeID from Organize where organizeid=" + selectorgid + " or parentid=" + selectorgid + ")"; } } else { wherestr += " and CustomerInfo.OrganizeID in (select OrganizeID from Organize where organizeid=" + Session["OrganizeID"].ToString() + " or parentid=" + Session["OrganizeID"].ToString() + ")"; } if (CBDateTime.Checked) { if (StartDate.Text.Length == 0 || EndDate.Text.Length == 0) { CommonFun.Show(this, "请选择起止日期!"); return; } else { wherestr += " and CustomerInfo.CreateDate between '" + StartDate.Text + "' and '" + EndDate.Text + "'"; } } if (CBMeettitle.Checked) { wherestr += " and CustomerInfo.MeetTitleID=" + DropDownList2.SelectedValue; } if (CBYwy.Checked) { wherestr += " and CustomerInfo.YwyID=" + ywy.SelectedValue; } string selectstr = @"SELECT YwyInfo.YwyName, CustomerInfo.CustomerName, CustomerInfo.CreateDate, Meettitle.Meettitle, ClientType.clientType, Organize.OrgName, CustomerInfo.Sex, CustomerInfo.Age, CustomerInfo.Worked, CustomerInfo.Phone, CustomerInfo.Yqd, CustomerInfo.Hshbf, CustomerInfo.Hfqk, CustomerInfo.Remark, CustomerInfo.Field1, CustomerInfo.Field2, CustomerInfo.Field3, CustomerInfo.OperatorID FROM CustomerInfo INNER JOIN ClientType ON CustomerInfo.ClientTypeID = ClientType.ClientTypeID INNER JOIN Meettitle ON CustomerInfo.MeetTitleID = Meettitle.MeetTitleID INNER JOIN Organize ON CustomerInfo.OrganizeID = Organize.OrganizeID INNER JOIN YwyInfo ON CustomerInfo.YwyID = YwyInfo.YwyID " + wherestr; Session["selectstr"] = selectstr; int recount = BindData(); LPage.Visible = true; LPage.Text = "共" + recount.ToString() + "条记录,每页" + GridView1.PageSize.ToString() + "条记录"; }
protected void Button2_Click(object sender, EventArgs e) { if (GridView1.Rows.Count > 0) { //调用导出方法 GridView1.AllowPaging = false; BindData(); ExportGridViewForUTF8(GridView1, DateTime.Now.ToShortDateString() + ".xls"); } else { CommonFun.Show(this, "没有数据可导出,请先查询数据!"); } }
protected void Button1_Click(object sender, EventArgs e) { string wherestr = " where 1=1"; if (CBOrg.Checked) { string selectorgid = DropDownList1.SelectedValue; if (selectorgid == "1") { wherestr += " and TwoMeeting.OrganizeID in (select OrganizeID from Organize)"; } else { wherestr += " and TwoMeeting.OrganizeID in (select OrganizeID from Organize where organizeid=" + selectorgid + " or parentid=" + selectorgid + ")"; } } else { wherestr += " and TwoMeeting.OrganizeID in (select OrganizeID from Organize where organizeid=" + Session["OrganizeID"].ToString() + " or parentid=" + Session["OrganizeID"].ToString() + ")"; } if (CBDateTime.Checked) { if (StartDate.Text.Length == 0 || EndDate.Text.Length == 0) { CommonFun.Show(this, "请选择起止日期!"); //return; } else { wherestr += " and TwoMeeting.HoldDate between '" + StartDate.Text + "' and '" + EndDate.Text + "'"; } } if (CBFormType.Checked) { wherestr += " and TwoMeeting.HoldFormID=" + DropDownList2.SelectedValue; } string selectstr = @"SELECT Organize.OrgName, TwoMeeting.HoldDate, TwoMeeting.HoldAddr,TwoMeeting.HoldName, HoldForm.FormType, TwoMeeting.ComePeopleNum, TwoMeeting.Qybf, TwoMeeting.Qyjs, TwoMeeting.Zhzyrs, TwoMeeting.Hshbf, TwoMeeting.Field1, TwoMeeting.Field2, TwoMeeting.Field3, TwoMeeting.Field4, TwoMeeting.Field5, TwoMeeting.OperatorID FROM TwoMeeting INNER JOIN Organize ON TwoMeeting.OrganizeID = Organize.OrganizeID INNER JOIN HoldForm ON TwoMeeting.HoldFormID = HoldForm.HoldFormID " + wherestr; Session["selectstr"] = selectstr; int recount = BindData(); LPage.Visible = true; LPage.Text = "共" + recount.ToString() + "条记录,每页" + GridView1.PageSize.ToString() + "条记录"; }
protected void Button1_Click(object sender, EventArgs e) { string wherestr = " where 1=1"; if (CBOrg.Checked) { string selectorgid=DropDownList1.SelectedValue; if (selectorgid=="1") { wherestr += " and ChuangShuo.OrganizeID in (select OrganizeID from Organize)"; } else { wherestr += " and ChuangShuo.OrganizeID in (select OrganizeID from Organize where organizeid=" + selectorgid + " or parentid=" + selectorgid + ")"; } } else { wherestr += " and ChuangShuo.OrganizeID in (select OrganizeID from Organize where organizeid=" + Session["OrganizeID"].ToString() + " or parentid=" + Session["OrganizeID"].ToString() + ")"; } if (CBDateTime.Checked) { if (StartDate.Text.Length==0 || EndDate.Text.Length==0) { CommonFun.Show(this, "请选择起止日期!"); return; } else { wherestr += " and ChuangShuo.HoldDate between '" + StartDate.Text + "' and '" + EndDate.Text + "'"; } } string selectstr = @"SELECT ChuangShuo.HoldDate, ChuangShuo.HoldAddr, ChuangShuo.ComeZhzrs, ChuangShuo.Xchmsrs, ChuangShuo.jfrs, ChuangShuo.Pxrs, ChuangShuo.shgrs, ChuangShuo.Dzkrs, ChuangShuo.tgrs, ChuangShuo.Field1, ChuangShuo.Field2, ChuangShuo.Field3, ChuangShuo.Field4, ChuangShuo.Field5, Organize.OrgName FROM ChuangShuo INNER JOIN Organize ON ChuangShuo.OrganizeID = Organize.OrganizeID " + wherestr; Session["selectstr"] = selectstr; int recount = BindData(); LPage.Visible = true; LPage.Text = "共" + recount.ToString() + "条记录,每页" + GridView1.PageSize.ToString() + "条记录"; }
protected void Button1_Click(object sender, EventArgs e) { string wherestr = " where 1=1"; if (CBOrg.Checked) { string selectorgid = DropDownList1.SelectedValue; if (selectorgid == "1") { wherestr += " and kaoqin.OrganizeID in (select OrganizeID from Organize)"; } else { wherestr += " and kaoqin.OrganizeID in (select OrganizeID from Organize where organizeid=" + selectorgid + " or parentid=" + selectorgid + ")"; } } else { wherestr += " and kaoqin.OrganizeID in (select OrganizeID from Organize where organizeid=" + Session["OrganizeID"].ToString() + " or parentid=" + Session["OrganizeID"].ToString() + ")"; } if (CBDateTime.Checked) { if (StartDate.Text.Length == 0 || EndDate.Text.Length == 0) { CommonFun.Show(this, "请选择起止日期!"); return; } else { wherestr += " and kaoqin.KaoqinDate between '" + StartDate.Text + "' and '" + EndDate.Text + "'"; } } string selectstr = @"SELECT Organize.OrgName, kaoqin.KaoqinDate, kaoqin.Rs, kaoqin.remark, kaoqin.KaoqinID, kaoqin.OrganizeID FROM kaoqin INNER JOIN Organize ON kaoqin.OrganizeID = Organize.OrganizeID " + wherestr; Session["selectstr"] = selectstr; //DbHelper db = new DbHelper(); //DbCommand cmd = db.GetSqlStringCommond(selectstr); int recount = BindData(); LPage.Visible = true; LPage.Text = "共" + recount.ToString() + "条记录,每页" + GridView1.PageSize.ToString() + "条记录"; }
protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "MemDelete") { Cultural.Model.Member mem = new Cultural.Model.Member(); mem = bll.GetModel(int.Parse(e.CommandArgument.ToString())); if (Session[Common.Session_MemStatus].ToString() != "5" && mem.Status == "5") { CommonFun.Show(this.Page, "您无权删除超级管理员!"); } else { mem.Status = "7"; bll.Update(mem); BindData(); } } }