private void BindData() { UDS.Components.CM cm = new UDS.Components.CM(); SqlDataReader dr_client = null; if (type == "all") { dr_client = cm.GetNewClientBySellman(sellmanid, begintime, endtime); } else if (type == "3stars") { dr_client = cm.GetNew3StarClientBySellmanID(sellmanid, begintime, endtime); } DataSet ds = new DataSet(); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); DataTable dt_client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_client); dt_client.TableName = "Client"; ds.Tables.Add(dt_client); ds.Relations.Add("ClientAddMan_Staff", ds.Tables["Client"].Columns["AddManID"], ds.Tables["Staff"].Columns["Staff_ID"], false); dgrd_sellmanclient.DataSource = dt_client.DefaultView; dgrd_sellmanclient.DataBind(); }
//绑定选择框 private void BindGrid(int type) { UDS.Components.Staff staff = new UDS.Components.Staff(); UDS.Components.CM cm = new UDS.Components.CM(); if (type == 1) { SqlDataReader dr_staff = staff.GetAllStaffs(); DataTable dt_staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_staff); dt_staff.TableName = "Staff"; dgrd_List.Visible = true; dgrd_Linkman.Visible = false; dgrd_List.DataKeyField = "Staff_ID"; dgrd_List.DataSource = dt_staff.DefaultView; dgrd_List.DataBind(); } else if (type == 2) { SqlDataReader dr_linkman = cm.GetLinkmenByClientAddmanID(userid); DataTable dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman); dt_linkman.TableName = "Linkman"; dgrd_Linkman.Visible = true; dgrd_List.Visible = false; dgrd_Linkman.DataKeyField = "ID"; dgrd_Linkman.DataSource = dt_linkman.DefaultView; dgrd_Linkman.DataBind(); } }
private void BindData() { UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); SqlDataReader dr_Linkman = cm.GetAllLinkman(); DataTable dt_Linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Linkman); dt_Linkman.TableName = "Linkman"; ds.Tables.Add(dt_Linkman); SqlDataReader dr_client = null; dr_client = cm.GetContactedClientBySellmanID(sellmanid,begintime,endtime); DataTable dt_client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_client); dt_client.TableName = "Client"; ds.Tables.Add(dt_client); SqlDataReader dr_Fee = cm.GetFeeBySellmanID(sellmanid,begintime,endtime); DataTable dt_Fee = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Fee); dt_Fee.TableName = "Fee"; ds.Tables.Add(dt_Fee); ds.Relations.Add("ClientAddMan_Staff",ds.Tables["Client"].Columns["AddManID"],ds.Tables["Staff"].Columns["Staff_ID"],false); ds.Relations.Add("ClientLinkman_Staff",ds.Tables["Client"].Columns["ChiefLinkmanID"],ds.Tables["Linkman"].Columns["ID"],false); ds.Relations.Add("Client_Fee",ds.Tables["Client"].Columns["ID"],ds.Tables["Fee"].Columns["ClientID"],false); dgrd_fee.DataSource = dt_client.DefaultView; dgrd_fee.DataBind(); }
//��ѡ��� private void BindGrid(int type) { UDS.Components.Staff staff = new UDS.Components.Staff(); UDS.Components.CM cm = new UDS.Components.CM(); if(type==1) { SqlDataReader dr_staff = staff.GetAllStaffs(); DataTable dt_staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_staff); dt_staff.TableName = "Staff"; dgrd_List.Visible = true; dgrd_Linkman.Visible = false; dgrd_List.DataKeyField = "Staff_ID"; dgrd_List.DataSource = dt_staff.DefaultView; dgrd_List.DataBind(); } else if(type==2) { SqlDataReader dr_linkman = cm.GetLinkmenByClientAddmanID(userid); DataTable dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman); dt_linkman.TableName = "Linkman"; dgrd_Linkman.Visible = true; dgrd_List.Visible = false; dgrd_Linkman.DataKeyField = "ID"; dgrd_Linkman.DataSource = dt_linkman.DefaultView; dgrd_Linkman.DataBind(); } }
private void BindData() { UDS.Components.CM cm = new UDS.Components.CM(); SqlDataReader dr_client = null; if(type=="all") { dr_client = cm.GetNewClientBySellman(sellmanid,begintime,endtime); } else if(type=="3stars") { dr_client = cm.GetNew3StarClientBySellmanID(sellmanid,begintime,endtime); } DataSet ds = new DataSet(); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); DataTable dt_client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_client); dt_client.TableName = "Client"; ds.Tables.Add(dt_client); ds.Relations.Add("ClientAddMan_Staff",ds.Tables["Client"].Columns["AddManID"],ds.Tables["Staff"].Columns["Staff_ID"],false); dgrd_sellmanclient.DataSource = dt_client.DefaultView; dgrd_sellmanclient.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); if (type == "all") { SqlDataReader dr_contact = cm.GetContactBySellmanID(sellmanid, begintime, endtime); DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contact); dt.TableName = "Contact"; ds.Tables.Add(dt); } else if (type == "callin") { SqlDataReader dr_callincontact = cm.GetCallinClientBySellmanID(sellmanid, begintime, endtime); DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_callincontact); dt.TableName = "Contact"; ds.Tables.Add(dt); } UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetAllStaffs(); DataTable dt1 = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_staff); dt1.TableName = "Staffs"; ds.Tables.Add(dt1); SqlDataReader dr_linkman = cm.GetAllContactLinkman(); DataTable dt2 = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman); dt2.TableName = "Linkman"; ds.Tables.Add(dt2); SqlDataReader dr_cooperater = cm.GetAllCooperater(); DataTable dt3 = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_cooperater); dt3.TableName = "Cooperater"; ds.Tables.Add(dt3); SqlDataReader dr_att = cm.GetAttachmentByContactID(0); DataTable dt4 = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_att); dt4.TableName = "Attachment"; ds.Tables.Add(dt4); ds.Relations.Add("ContactMarketman_Staffs", ds.Tables["Staffs"].Columns["Staff_ID"], ds.Tables["Contact"].Columns["MarketmanID"]); ds.Relations.Add("Contact_Linkman", ds.Tables["Contact"].Columns["ID"], ds.Tables["Linkman"].Columns["ContactID"], false); ds.Relations.Add("Contact_Cooperater", ds.Tables["Contact"].Columns["ID"], ds.Tables["Cooperater"].Columns["ContactID"], false); ds.Relations.Add("Contact_Attachment", ds.Tables["Contact"].Columns["ID"], ds.Tables["Attachment"].Columns["pertainid"], false); rpt_data.DataSource = ds.Tables["Contact"].DefaultView; rpt_data.DataBind(); }
private void BindData() { begintime = DateTime.Parse(tbx_begintime.Text); endtime = DateTime.Parse(tbx_endtime.Text); UDS.Components.CM cm = new UDS.Components.CM(); UDS.Components.Staff staff = new UDS.Components.Staff(); DataSet ds = new DataSet(); SqlDataReader dr_realname = staff.GetAllStaffs(); DataTable dt_realname = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_realname); dt_realname.TableName = "Realname"; ds.Tables.Add(dt_realname); SqlDataReader dr_sellman = cm.GetSellman(begintime, endtime); DataTable dt_sellman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_sellman); dt_sellman.TableName = "Sellman"; ds.Tables.Add(dt_sellman); SqlDataReader dr_contact = cm.GetContactInfo(begintime, endtime); DataTable dt_contact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contact); dt_contact.TableName = "Contact"; ds.Tables.Add(dt_contact); SqlDataReader dr_callincontact = cm.GetCallinContactInfo(begintime, endtime); DataTable dt_callincontact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_callincontact); dt_callincontact.TableName = "CallinContact"; ds.Tables.Add(dt_callincontact); SqlDataReader dr_newclient = cm.GetNewClient(begintime, endtime); DataTable dt_newclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_newclient); dt_newclient.TableName = "NewClient"; ds.Tables.Add(dt_newclient); SqlDataReader dr_new3client = cm.GetNew3StarClient(begintime, endtime); DataTable dt_new3client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_new3client); dt_new3client.TableName = "New3Client"; ds.Tables.Add(dt_new3client); ds.Relations.Add("staffid_realname", ds.Tables["Sellman"].Columns["SellmanID"], ds.Tables["Realname"].Columns["staff_id"], false); ds.Relations.Add("sellman_contact", ds.Tables["Sellman"].Columns["SellmanID"], ds.Tables["Contact"].Columns["MarketmanID"], false); ds.Relations.Add("sellman_callincontact", ds.Tables["Sellman"].Columns["SellmanID"], ds.Tables["CallinContact"].Columns["MarketmanID"], false); ds.Relations.Add("sellman_newclient", ds.Tables["Sellman"].Columns["SellmanID"], ds.Tables["NewClient"].Columns["AddmanID"], false); ds.Relations.Add("sellman_new3client", ds.Tables["Sellman"].Columns["SellmanID"], ds.Tables["New3Client"].Columns["AddmanID"], false); dgrd_sellman.DataSource = dt_sellman.DefaultView; dgrd_sellman.DataBind(); }
private void BindData() { begintime = DateTime.Parse(tbx_begintime.Text); endtime = DateTime.Parse(tbx_endtime.Text); UDS.Components.CM cm = new UDS.Components.CM(); UDS.Components.Staff staff= new UDS.Components.Staff(); DataSet ds = new DataSet(); SqlDataReader dr_realname = staff.GetAllStaffs(); DataTable dt_realname = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_realname); dt_realname.TableName = "Realname"; ds.Tables.Add(dt_realname); SqlDataReader dr_sellman = cm.GetSellman(begintime,endtime); DataTable dt_sellman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_sellman); dt_sellman.TableName = "Sellman"; ds.Tables.Add(dt_sellman); SqlDataReader dr_contact = cm.GetContactInfo(begintime,endtime); DataTable dt_contact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contact); dt_contact.TableName = "Contact"; ds.Tables.Add(dt_contact); SqlDataReader dr_callincontact = cm.GetCallinContactInfo(begintime,endtime); DataTable dt_callincontact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_callincontact); dt_callincontact.TableName = "CallinContact"; ds.Tables.Add(dt_callincontact); SqlDataReader dr_newclient = cm.GetNewClient(begintime,endtime); DataTable dt_newclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_newclient); dt_newclient.TableName = "NewClient"; ds.Tables.Add(dt_newclient); SqlDataReader dr_new3client = cm.GetNew3StarClient(begintime,endtime); DataTable dt_new3client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_new3client); dt_new3client.TableName = "New3Client"; ds.Tables.Add(dt_new3client); ds.Relations.Add("staffid_realname",ds.Tables["Sellman"].Columns["SellmanID"],ds.Tables["Realname"].Columns["staff_id"],false); ds.Relations.Add("sellman_contact",ds.Tables["Sellman"].Columns["SellmanID"],ds.Tables["Contact"].Columns["MarketmanID"],false); ds.Relations.Add("sellman_callincontact",ds.Tables["Sellman"].Columns["SellmanID"],ds.Tables["CallinContact"].Columns["MarketmanID"],false); ds.Relations.Add("sellman_newclient",ds.Tables["Sellman"].Columns["SellmanID"],ds.Tables["NewClient"].Columns["AddmanID"],false); ds.Relations.Add("sellman_new3client",ds.Tables["Sellman"].Columns["SellmanID"],ds.Tables["New3Client"].Columns["AddmanID"],false); dgrd_sellman.DataSource = dt_sellman.DefaultView; dgrd_sellman.DataBind(); }
//绑定我的协同客户 private void BindMycooperatorClient() { TD2.Attributes["background"] = "../../images/maillistbutton2.gif"; TD1.Attributes["background"] = "../../images/maillistbutton1.gif"; pnl_ClientInfo.Visible = false; pnl.Visible = false; UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); SqlDataReader dr_Client = cm.GetClientInfoBycooperatorID(Int32.Parse(userid)); DataTable dt_Client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Client); dt_Client.TableName = "Client"; ds.Tables.Add(dt_Client); SqlDataReader dr_Contact = cm.GetClientContactInfo(0); DataTable dt_Contact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Contact); dt_Contact.TableName = "Contact"; ds.Tables.Add(dt_Contact); SqlDataReader dr_Linkman = cm.GetAllLinkman(); DataTable dt_Linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Linkman); dt_Linkman.TableName = "Linkman"; ds.Tables.Add(dt_Linkman); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); ds.Relations.Add("ClientAddMan_Staff", ds.Tables["Client"].Columns["AddManID"], ds.Tables["Staff"].Columns["Staff_ID"], false); ds.Relations.Add("ClientLinkmanID_Linkman", ds.Tables["Client"].Columns["ChiefLinkmanID"], ds.Tables["Linkman"].Columns["ID"], false); ds.Tables["Client"].DefaultView.Sort = (string)ViewState["SortField"] + " " + ViewState["SortDirect"]; dgd_Client.DataSource = ds.Tables["Client"].DefaultView; dgd_Client.DataBind(); }
private void BindData() { UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); SqlDataReader dr_Linkman = cm.GetAllLinkman(); DataTable dt_Linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Linkman); dt_Linkman.TableName = "Linkman"; ds.Tables.Add(dt_Linkman); SqlDataReader dr_client = null; dr_client = cm.GetContactedClientBySellmanID(sellmanid, begintime, endtime); DataTable dt_client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_client); dt_client.TableName = "Client"; ds.Tables.Add(dt_client); SqlDataReader dr_Fee = cm.GetFeeBySellmanID(sellmanid, begintime, endtime); DataTable dt_Fee = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Fee); dt_Fee.TableName = "Fee"; ds.Tables.Add(dt_Fee); ds.Relations.Add("ClientAddMan_Staff", ds.Tables["Client"].Columns["AddManID"], ds.Tables["Staff"].Columns["Staff_ID"], false); ds.Relations.Add("ClientLinkman_Staff", ds.Tables["Client"].Columns["ChiefLinkmanID"], ds.Tables["Linkman"].Columns["ID"], false); ds.Relations.Add("Client_Fee", ds.Tables["Client"].Columns["ID"], ds.Tables["Fee"].Columns["ClientID"], false); dgrd_fee.DataSource = dt_client.DefaultView; dgrd_fee.DataBind(); }
private void Bind() { DataSet ds = new DataSet(); UDS.Components.Staff staff1 = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff1.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); try { UDS.Components.Database db = new UDS.Components.Database(); SqlParameter[] prams = { db.MakeInParam("@SQL", SqlDbType.NText, 5000, searchstring) }; SqlDataReader dr = null; db.RunProc("sp_RunSql", prams, out dr); DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr); dt.TableName = "Client"; ds.Tables.Add(dt); ltl_Client.Text = dt.Rows.Count.ToString(); ds.Relations.Add("ClientAddMan_Staff", ds.Tables["Client"].Columns["AddManID"], ds.Tables["Staff"].Columns["Staff_ID"], false); dt.DefaultView.Sort = ViewState["SortField"].ToString() + " " + ViewState["SortDirect"].ToString(); dgrd_clientlist.DataSource = dt.DefaultView; dgrd_clientlist.DataBind(); } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
private void Bind() { DataSet ds = new DataSet(); UDS.Components.Staff staff1 = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff1.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); try { UDS.Components.Database db = new UDS.Components.Database(); SqlParameter[] prams = { db.MakeInParam("@SQL",SqlDbType.NText,5000,searchstring) }; SqlDataReader dr = null; db.RunProc("sp_RunSql",prams,out dr); DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr); dt.TableName = "Client"; ds.Tables.Add(dt); ltl_Client.Text = dt.Rows.Count.ToString(); ds.Relations.Add("ClientAddMan_Staff",ds.Tables["Client"].Columns["AddManID"],ds.Tables["Staff"].Columns["Staff_ID"],false); dt.DefaultView.Sort = ViewState["SortField"].ToString() + " " + ViewState["SortDirect"].ToString(); dgrd_clientlist.DataSource = dt.DefaultView; dgrd_clientlist.DataBind(); } catch(Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } }
private void BindDDL() { #region 协同人员列表初始化 UDS.Components.Staff staff = new UDS.Components.Staff(); try { ddlMoveTo.DataTextField = "Staff_Name"; ddlMoveTo.DataValueField = "Staff_ID"; ddlMoveTo.DataSource = staff.GetAllStaffs(); ddlMoveTo.DataBind(); } catch (Exception e) { UDS.Components.Error.Log(e.ToString()); Server.Transfer("../Error.aspx"); } finally { staff = null; } #endregion }
//���ҵ�Эͬ�ͻ� private void BindMycooperatorClient() { TD2.Attributes["background"] = "../../images/maillistbutton2.gif"; TD1.Attributes["background"] = "../../images/maillistbutton1.gif"; pnl_ClientInfo.Visible = false; pnl.Visible = false; UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); SqlDataReader dr_Client = cm.GetClientInfoBycooperatorID(Int32.Parse(userid)); DataTable dt_Client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Client); dt_Client.TableName = "Client"; ds.Tables.Add(dt_Client); SqlDataReader dr_Contact = cm.GetClientContactInfo(0); DataTable dt_Contact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Contact); dt_Contact.TableName = "Contact"; ds.Tables.Add(dt_Contact); SqlDataReader dr_Linkman = cm.GetAllLinkman(); DataTable dt_Linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Linkman); dt_Linkman.TableName = "Linkman"; ds.Tables.Add(dt_Linkman); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); ds.Relations.Add("ClientAddMan_Staff",ds.Tables["Client"].Columns["AddManID"],ds.Tables["Staff"].Columns["Staff_ID"],false); ds.Relations.Add("ClientLinkmanID_Linkman",ds.Tables["Client"].Columns["ChiefLinkmanID"],ds.Tables["Linkman"].Columns["ID"],false); ds.Tables["Client"].DefaultView.Sort = (string)ViewState["SortField"] + " " + ViewState["SortDirect"]; dgd_Client.DataSource = ds.Tables["Client"].DefaultView; dgd_Client.DataBind(); }
//���ҵĿͻ� private void BindGrid() { TD1.Attributes["background"] = "../../images/maillistbutton2.gif"; TD2.Attributes["background"] = "../../images/maillistbutton1.gif"; UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); SqlDataReader dr_Client = cm.GetMyClients(Int32.Parse(userid)); DataTable dt_Client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Client); dt_Client.TableName = "Client"; ds.Tables.Add(dt_Client); SqlDataReader dr_Contact = cm.GetClientContactInfo(0); DataTable dt_Contact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Contact); dt_Contact.TableName = "Contact"; ds.Tables.Add(dt_Contact); SqlDataReader dr_Linkman = cm.GetAllLinkman(); DataTable dt_Linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Linkman); dt_Linkman.TableName = "Linkman"; ds.Tables.Add(dt_Linkman); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); ds.Relations.Add("ClientAddMan_Staff",ds.Tables["Client"].Columns["AddManID"],ds.Tables["Staff"].Columns["Staff_ID"],false); ds.Relations.Add("ClientLinkmanID_Linkman",ds.Tables["Client"].Columns["ChiefLinkmanID"],ds.Tables["Linkman"].Columns["ID"],false); ds.Tables["Client"].DefaultView.Sort = (string)ViewState["SortField"] + " " + ViewState["SortDirect"]; dgd_Client.DataSource = ds.Tables["Client"].DefaultView; dgd_Client.DataBind(); DateTime monthbegin = DateTime.Now.AddMonths(-1); DateTime monthend = new DateTime(DateTime.Now.Year,DateTime.Now.Month,DateTime.DaysInMonth(DateTime.Now.Year,DateTime.Now.Month)); SqlDataReader dr_ContactTimes = cm.GetContactByStaffIDandTime(Int32.Parse(userid),monthbegin,monthend); int contacttimes = 0; try { while (dr_ContactTimes.Read()) { contacttimes++; } } finally { dr_ContactTimes.Close(); } if(Session["cm_permission"].ToString() == "administrator") { pnl.Visible = true; pnl_ClientInfo.Visible = true; } else { pnl.Visible = false; pnl_ClientInfo.Visible = false; } //���û�пͻ����� ��������� ��ϵ�� �� �Ӵ������ ��ť if (dgd_Client.Items.Count==0) { btn_AddLinkman.Visible = false; btn_AddContact.Visible = false; } else { btn_AddLinkman.Visible = true; btn_AddContact.Visible = true; } ltl_ClientCount.Text = dt_Client.Rows.Count.ToString(); ltl_ContactTimes.Text = contacttimes.ToString(); }
private void btn_OK_Click(object sender, System.EventArgs e) { if(lbx_search.Items.Count>0) { string searchstring = ""; string tmp = ""; DateTime begintime = new DateTime(); DateTime endtime = DateTime.Now; foreach(ListItem lt in lbx_search.Items) { string [] searcharr = new string[2]; searcharr = lt.Value.Split(':'); switch(searcharr[0].Trim()) { case "������Ա����": UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staffid = staff.GetStaffIDByRealName(searcharr[1]); tmp = "UDS_CM_ClientContact.MarketmanID='"; while(dr_staffid.Read()) { tmp += dr_staffid["staff_id"] + "' or UDS_CM_ClientContact.MarketmanID='"; } dr_staffid.Close(); if(tmp=="UDS_CM_ContactInfo.MarketmanID='") searchstring = "1=2"; else { tmp = tmp.Substring(0,tmp.Length-37); searchstring += "(" + tmp + ") and "; } break; case "�ͻ�����": UDS.Components.CM cm = new UDS.Components.CM(); SqlDataReader dr_clientid = cm.GetClientIDByName(searcharr[1]); tmp = "UDS_CM_ClientContact.ClientID='"; while(dr_clientid.Read()) { tmp += dr_clientid["ID"] + "' or UDS_CM_ClientContact.ClientID='"; } dr_clientid.Close(); if(tmp=="UDS_CM_ClientContact.ClientID='") searchstring = "1=2"; else { tmp = tmp.Substring(0,tmp.Length-34); searchstring += "(" + tmp + ") and "; } break; case "�ͻ����": searchstring += "UDS_CM_ClientContact.ClientID=" + searcharr[1] + " and "; break; case "���۽�": switch(searcharr[1]) { case "����": searchstring += "patindex('%trace%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "���": searchstring += "patindex('%boot%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "��Ʒ�Ƽ�": searchstring += "patindex('%commend%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "������": searchstring += "patindex('%requirement%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "�����ύ": searchstring += "patindex('%submit%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "����̸��": searchstring += "patindex('%negotiate%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "��Ŀʵʩ": searchstring += "patindex('%actualize%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "���ٷ���": searchstring += "patindex('%traceservice%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "��β��": searchstring += "patindex('%last%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; } break; case "�ɽ�Ԥ��": searchstring += "UDS_CM_ClientContact.BargainPrognosis='" + searcharr[1] + "' and "; break; case "�ѽ�Ǣ����": searchstring += "UDS_CM_ClientContact.ContactTimes=" + searcharr[1] + " and "; break; case "��Ǣ����ְ��": searchstring += "UDS_CM_Linkman.[Position]='" + searcharr[1] + "' and "; break; case "�״ν�Ǣʱ��": searchstring += "UDS_CM_ClientInfo.FirstContactTime='" + searcharr[1] + "' and "; break; case "���һ�ν�Ǣʱ��": searchstring += "UDS_CM_ClientInfo.ContactTime='" + searcharr[1] + "' and "; break; case "�´�Լ��ʱ��": searchstring += "UDS_CM_ClientInfo.NextContactTime='" + searcharr[1] + "' and "; break; case "����������¼": //�õ�������ʼ��(��һ -- ����) begintime = DateTime.Now; switch((int)DateTime.Now.DayOfWeek) { case 0: begintime = begintime.AddDays(-6); break; default: begintime = begintime.AddDays(1-(int)DateTime.Now.DayOfWeek); break; } searchstring += "(UDS_CM_ClientContact.updatetime between '" + begintime.ToShortDateString() + "' and '" + endtime.ToShortDateString() + "') and "; break; case "����������¼": //�õ�������ʼ�� begintime = DateTime.Now; begintime = begintime.AddDays(1-DateTime.Now.Day); searchstring += "(UDS_CM_ClientContact.updatetime between '" + begintime.ToShortDateString() + "' and '" + endtime.ToShortDateString() + "') and "; break; } } searchstring = "select * from UDS_CM_ClientInfo where ID IN (select UDS_CM_ClientInfo.ID from UDS_CM_ClientContact left join UDS_CM_ClientContact_Linkman ON UDS_CM_ClientContact.ID=UDS_CM_ClientContact_Linkman.ContactID left join UDS_CM_Linkman ON UDS_CM_ClientContact_Linkman.LinkmanID=UDS_CM_ClientContact_Linkman.id,UDS_CM_ClientInfo where UDS_CM_ClientContact.clientid=UDS_CM_ClientInfo.id and " + searchstring; if(searchstring.EndsWith("and ")) { searchstring = searchstring.Substring(0,searchstring.Length-4); } searchstring += " group by UDS_CM_ClientInfo.ID)"; DataSet ds = new DataSet(); UDS.Components.Staff staff1 = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff1.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); UDS.Components.Database db = new UDS.Components.Database(); SqlParameter[] prams = { db.MakeInParam("@SQL",SqlDbType.NText,5000,searchstring) }; SqlDataReader dr = null; db.RunProc("sp_RunSql",prams,out dr); DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr); dt.TableName = "Client"; ds.Tables.Add(dt); ltl_Client.Text = dt.Rows.Count.ToString(); ds.Relations.Add("ClientAddMan_Staff",ds.Tables["Client"].Columns["AddManID"],ds.Tables["Staff"].Columns["Staff_ID"],false); dgrd_ContactList.DataSource = dt.DefaultView; dgrd_ContactList.DataBind(); } }
private void BindData(string type) { UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); switch(type) { case "ac": SqlDataReader dr_contactedclient = cm.GetContactedClientBySellmanID(0,begintime,endtime); DataTable dt_contactedclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contactedclient); dt_contactedclient.TableName = "Client"; ds.Tables.Add(dt_contactedclient); break; case "cc": SqlDataReader dr_contactedcallinclient = cm.GetCallinClientBySellmanID(0,begintime,endtime); DataTable dt_contactedcallinclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contactedcallinclient); dt_contactedcallinclient.TableName = "Client"; ds.Tables.Add(dt_contactedcallinclient); break; case "nc": SqlDataReader dr_newclient = cm.GetCallinClientBySellmanID(0,begintime,endtime); DataTable dt_newclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_newclient); dt_newclient.TableName = "Client"; ds.Tables.Add(dt_newclient); break; case "neoc": SqlDataReader dr_neoclient = cm.GetNegotiateClient(); DataTable dt_neoclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_neoclient); dt_neoclient.TableName = "Client"; ds.Tables.Add(dt_neoclient); break; case "neonc": SqlDataReader dr_neonewclient = cm.GetNewNegotiateClient(begintime,endtime); DataTable dt_neonewclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_neonewclient); dt_neonewclient.TableName = "Client"; ds.Tables.Add(dt_neonewclient); break; case "n3c": SqlDataReader dr_new3client = cm.GetNew3StarClient(begintime,endtime); DataTable dt_new3client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_new3client); dt_new3client.TableName = "Client"; ds.Tables.Add(dt_new3client); break; case "3c": SqlDataReader dr_3client = cm.Get3StarClient(); DataTable dt_3client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_3client); dt_3client.TableName = "Client"; ds.Tables.Add(dt_3client); break; } UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetAllStaffs(); DataTable dt_staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_staff); dt_staff.TableName = "Staff"; ds.Tables.Add(dt_staff); ds.Relations.Add("StaffID_Staff",ds.Tables["Client"].Columns["AddmanID"],ds.Tables["Staff"].Columns["Staff_ID"],false); ltl_Client.Text = ds.Tables["Client"].Rows.Count.ToString(); dgrd_Client.DataSource = ds.Tables["Client"].DefaultView; dgrd_Client.DataBind(); }
private void Page_Load(object sender, System.EventArgs e) { // �ڴ˴������û������Գ�ʼ��ҳ�� UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); if(type=="all") { SqlDataReader dr_contact = cm.GetContactBySellmanID(sellmanid,begintime,endtime); DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contact); dt.TableName = "Contact"; ds.Tables.Add(dt); } else if(type=="callin") { SqlDataReader dr_callincontact = cm.GetCallinClientBySellmanID(sellmanid,begintime,endtime); DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_callincontact); dt.TableName = "Contact"; ds.Tables.Add(dt); } UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetAllStaffs(); DataTable dt1 = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_staff); dt1.TableName = "Staffs"; ds.Tables.Add(dt1); SqlDataReader dr_linkman = cm.GetAllContactLinkman(); DataTable dt2 = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman); dt2.TableName = "Linkman"; ds.Tables.Add(dt2); SqlDataReader dr_cooperater = cm.GetAllCooperater(); DataTable dt3 = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_cooperater); dt3.TableName = "Cooperater"; ds.Tables.Add(dt3); SqlDataReader dr_att = cm.GetAttachmentByContactID(0); DataTable dt4 = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_att); dt4.TableName = "Attachment"; ds.Tables.Add(dt4); ds.Relations.Add("ContactMarketman_Staffs",ds.Tables["Staffs"].Columns["Staff_ID"],ds.Tables["Contact"].Columns["MarketmanID"]); ds.Relations.Add("Contact_Linkman",ds.Tables["Contact"].Columns["ID"],ds.Tables["Linkman"].Columns["ContactID"],false); ds.Relations.Add("Contact_Cooperater",ds.Tables["Contact"].Columns["ID"],ds.Tables["Cooperater"].Columns["ContactID"],false); ds.Relations.Add("Contact_Attachment",ds.Tables["Contact"].Columns["ID"],ds.Tables["Attachment"].Columns["pertainid"],false); rpt_data.DataSource = ds.Tables["Contact"].DefaultView; rpt_data.DataBind(); }
//绑定我的客户 private void BindGrid() { TD1.Attributes["background"] = "../../images/maillistbutton2.gif"; TD2.Attributes["background"] = "../../images/maillistbutton1.gif"; UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); SqlDataReader dr_Client = cm.GetMyClients(Int32.Parse(userid)); DataTable dt_Client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Client); dt_Client.TableName = "Client"; ds.Tables.Add(dt_Client); SqlDataReader dr_Contact = cm.GetClientContactInfo(0); DataTable dt_Contact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Contact); dt_Contact.TableName = "Contact"; ds.Tables.Add(dt_Contact); SqlDataReader dr_Linkman = cm.GetAllLinkman(); DataTable dt_Linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Linkman); dt_Linkman.TableName = "Linkman"; ds.Tables.Add(dt_Linkman); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); ds.Relations.Add("ClientAddMan_Staff", ds.Tables["Client"].Columns["AddManID"], ds.Tables["Staff"].Columns["Staff_ID"], false); ds.Relations.Add("ClientLinkmanID_Linkman", ds.Tables["Client"].Columns["ChiefLinkmanID"], ds.Tables["Linkman"].Columns["ID"], false); ds.Tables["Client"].DefaultView.Sort = (string)ViewState["SortField"] + " " + ViewState["SortDirect"]; dgd_Client.DataSource = ds.Tables["Client"].DefaultView; dgd_Client.DataBind(); DateTime monthbegin = DateTime.Now.AddMonths(-1); DateTime monthend = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)); SqlDataReader dr_ContactTimes = cm.GetContactByStaffIDandTime(Int32.Parse(userid), monthbegin, monthend); int contacttimes = 0; while (dr_ContactTimes.Read()) { contacttimes++; } dr_ContactTimes.Close(); if (Session["cm_permission"].ToString() == "administrator") { pnl.Visible = true; pnl_ClientInfo.Visible = true; } else { pnl.Visible = false; pnl_ClientInfo.Visible = false; } //如果没有客户,则 不出现添加 联系人 和 接触情况的 按钮 if (dgd_Client.Items.Count == 0) { btn_AddLinkman.Visible = false; btn_AddContact.Visible = false; } else { btn_AddLinkman.Visible = true; btn_AddContact.Visible = true; } ltl_ClientCount.Text = dt_Client.Rows.Count.ToString(); ltl_ContactTimes.Text = contacttimes.ToString(); }
private void BindData(string type) { begintime = DateTime.Parse(tbx_begintime.Text); endtime = DateTime.Parse(tbx_endtime.Text); UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetAllStaffs(); DataTable dt_staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_staff); dt_staff.TableName = "Staff"; ds.Tables.Add(dt_staff); SqlDataReader dr_client = cm.GetContactedClientBySellmanID(0, begintime, endtime); DataTable dt_client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_client); dt_client.TableName = "Client"; ds.Tables.Add(dt_client); ltl_Client.Text = dt_client.Rows.Count.ToString(); if (type == "client") //按客户排列 { dgrd_clientfee.Visible = true; dgrd_sellmanfee.Visible = false; SqlDataReader dr_contact = cm.GetContactInfo(begintime, endtime); DataTable dt_contact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contact); dt_contact.TableName = "Contact"; ds.Tables.Add(dt_contact); SqlDataReader dr_linkman = cm.GetAllLinkman(); DataTable dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman); dt_linkman.TableName = "Linkman"; ds.Tables.Add(dt_linkman); ds.Relations.Add("ClientAddMan_Staff", ds.Tables["Client"].Columns["AddManID"], ds.Tables["Staff"].Columns["Staff_ID"], false); ds.Relations.Add("ClientLinkman_Staff", ds.Tables["Client"].Columns["ChiefLinkmanID"], ds.Tables["Linkman"].Columns["ID"], false); ds.Relations.Add("Client_Contact", ds.Tables["Client"].Columns["ID"], ds.Tables["Contact"].Columns["ClientID"], false); dgrd_clientfee.DataSource = dt_client.DefaultView; dgrd_clientfee.DataBind(); ltl_Fee.Text = totalfee.ToString(); } else if (type == "sellman") { dgrd_clientfee.Visible = false; dgrd_sellmanfee.Visible = true; SqlDataReader dr_sellman = cm.GetSellman(begintime, endtime); DataTable dt_sellman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_sellman); dt_sellman.TableName = "Sellman"; ds.Tables.Add(dt_sellman); foreach (DataRow row in dt_sellman.Rows) { totalfee += Int32.Parse(row["fee"].ToString()); } ds.Relations.Add("StaffID_RealName", ds.Tables["Sellman"].Columns["Staff_Name"], ds.Tables["Staff"].Columns["Staff_Name"], false); dgrd_sellmanfee.DataSource = dt_sellman.DefaultView; dgrd_sellmanfee.DataBind(); ltl_Fee.Text = totalfee.ToString(); } }
private void BindData(string type) { UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); switch (type) { case "ac": SqlDataReader dr_contactedclient = cm.GetContactedClientBySellmanID(0, begintime, endtime); DataTable dt_contactedclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contactedclient); dt_contactedclient.TableName = "Client"; ds.Tables.Add(dt_contactedclient); break; case "cc": SqlDataReader dr_contactedcallinclient = cm.GetCallinClientBySellmanID(0, begintime, endtime); DataTable dt_contactedcallinclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contactedcallinclient); dt_contactedcallinclient.TableName = "Client"; ds.Tables.Add(dt_contactedcallinclient); break; case "nc": SqlDataReader dr_newclient = cm.GetCallinClientBySellmanID(0, begintime, endtime); DataTable dt_newclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_newclient); dt_newclient.TableName = "Client"; ds.Tables.Add(dt_newclient); break; case "neoc": SqlDataReader dr_neoclient = cm.GetNegotiateClient(); DataTable dt_neoclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_neoclient); dt_neoclient.TableName = "Client"; ds.Tables.Add(dt_neoclient); break; case "neonc": SqlDataReader dr_neonewclient = cm.GetNewNegotiateClient(begintime, endtime); DataTable dt_neonewclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_neonewclient); dt_neonewclient.TableName = "Client"; ds.Tables.Add(dt_neonewclient); break; case "n3c": SqlDataReader dr_new3client = cm.GetNew3StarClient(begintime, endtime); DataTable dt_new3client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_new3client); dt_new3client.TableName = "Client"; ds.Tables.Add(dt_new3client); break; case "3c": SqlDataReader dr_3client = cm.Get3StarClient(); DataTable dt_3client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_3client); dt_3client.TableName = "Client"; ds.Tables.Add(dt_3client); break; } UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetAllStaffs(); DataTable dt_staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_staff); dt_staff.TableName = "Staff"; ds.Tables.Add(dt_staff); ds.Relations.Add("StaffID_Staff", ds.Tables["Client"].Columns["AddmanID"], ds.Tables["Staff"].Columns["Staff_ID"], false); ltl_Client.Text = ds.Tables["Client"].Rows.Count.ToString(); dgrd_Client.DataSource = ds.Tables["Client"].DefaultView; dgrd_Client.DataBind(); }
private void BindData(string type) { begintime = DateTime.Parse(tbx_begintime.Text); endtime = DateTime.Parse(tbx_endtime.Text); UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetAllStaffs(); DataTable dt_staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_staff); dt_staff.TableName = "Staff"; ds.Tables.Add(dt_staff); SqlDataReader dr_client = cm.GetContactedClientBySellmanID(0,begintime,endtime); DataTable dt_client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_client); dt_client.TableName = "Client"; ds.Tables.Add(dt_client); ltl_Client.Text = dt_client.Rows.Count.ToString(); if(type=="client")//���ͻ����� { dgrd_clientfee.Visible = true; dgrd_sellmanfee.Visible = false; SqlDataReader dr_contact = cm.GetContactInfo(begintime,endtime); DataTable dt_contact = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_contact); dt_contact.TableName = "Contact"; ds.Tables.Add(dt_contact); SqlDataReader dr_linkman = cm.GetAllLinkman(); DataTable dt_linkman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_linkman); dt_linkman.TableName = "Linkman"; ds.Tables.Add(dt_linkman); ds.Relations.Add("ClientAddMan_Staff",ds.Tables["Client"].Columns["AddManID"],ds.Tables["Staff"].Columns["Staff_ID"],false); ds.Relations.Add("ClientLinkman_Staff",ds.Tables["Client"].Columns["ChiefLinkmanID"],ds.Tables["Linkman"].Columns["ID"],false); ds.Relations.Add("Client_Contact",ds.Tables["Client"].Columns["ID"],ds.Tables["Contact"].Columns["ClientID"],false); dgrd_clientfee.DataSource = dt_client.DefaultView; dgrd_clientfee.DataBind(); ltl_Fee.Text = totalfee.ToString(); } else if(type=="sellman") { dgrd_clientfee.Visible = false; dgrd_sellmanfee.Visible = true; SqlDataReader dr_sellman = cm.GetSellman(begintime,endtime); DataTable dt_sellman = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_sellman); dt_sellman.TableName = "Sellman"; ds.Tables.Add(dt_sellman); foreach(DataRow row in dt_sellman.Rows) { totalfee += Int32.Parse(row["fee"].ToString()); } ds.Relations.Add("StaffID_RealName",ds.Tables["Sellman"].Columns["Staff_Name"],ds.Tables["Staff"].Columns["Staff_Name"],false); dgrd_sellmanfee.DataSource = dt_sellman.DefaultView; dgrd_sellmanfee.DataBind(); ltl_Fee.Text = totalfee.ToString(); } }
private void btn_OK_Click(object sender, System.EventArgs e) { if (lbx_search.Items.Count > 0) { string searchstring = ""; string tmp = ""; DateTime begintime = new DateTime(); DateTime endtime = DateTime.Now; foreach (ListItem lt in lbx_search.Items) { string [] searcharr = new string[2]; searcharr = lt.Value.Split(':'); switch (searcharr[0].Trim()) { case "销售人员姓名": UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staffid = staff.GetStaffIDByRealName(searcharr[1]); tmp = "UDS_CM_ClientContact.MarketmanID='"; while (dr_staffid.Read()) { tmp += dr_staffid["staff_id"] + "' or UDS_CM_ClientContact.MarketmanID='"; } dr_staffid.Close(); if (tmp == "UDS_CM_ContactInfo.MarketmanID='") { searchstring = "1=2"; } else { tmp = tmp.Substring(0, tmp.Length - 37); searchstring += "(" + tmp + ") and "; } break; case "客户名称": UDS.Components.CM cm = new UDS.Components.CM(); SqlDataReader dr_clientid = cm.GetClientIDByName(searcharr[1]); tmp = "UDS_CM_ClientContact.ClientID='"; while (dr_clientid.Read()) { tmp += dr_clientid["ID"] + "' or UDS_CM_ClientContact.ClientID='"; } dr_clientid.Close(); if (tmp == "UDS_CM_ClientContact.ClientID='") { searchstring = "1=2"; } else { tmp = tmp.Substring(0, tmp.Length - 34); searchstring += "(" + tmp + ") and "; } break; case "客户编号": searchstring += "UDS_CM_ClientContact.ClientID=" + searcharr[1] + " and "; break; case "销售阶段": switch (searcharr[1]) { case "跟踪": searchstring += "patindex('%trace%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "启动": searchstring += "patindex('%boot%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "产品推荐": searchstring += "patindex('%commend%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "需求定义": searchstring += "patindex('%requirement%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "方案提交": searchstring += "patindex('%submit%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "商务谈判": searchstring += "patindex('%negotiate%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "项目实施": searchstring += "patindex('%actualize%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "跟踪服务": searchstring += "patindex('%traceservice%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; case "收尾款": searchstring += "patindex('%last%',UDS_CM_ClientContact.curstatus)>=0" + " and "; break; } break; case "成交预估": searchstring += "UDS_CM_ClientContact.BargainPrognosis='" + searcharr[1] + "' and "; break; case "已接洽次数": searchstring += "UDS_CM_ClientContact.ContactTimes=" + searcharr[1] + " and "; break; case "接洽对象职务": searchstring += "UDS_CM_Linkman.[Position]='" + searcharr[1] + "' and "; break; case "首次接洽时间": searchstring += "UDS_CM_ClientInfo.FirstContactTime='" + searcharr[1] + "' and "; break; case "最后一次接洽时间": searchstring += "UDS_CM_ClientInfo.ContactTime='" + searcharr[1] + "' and "; break; case "下次约见时间": searchstring += "UDS_CM_ClientInfo.NextContactTime='" + searcharr[1] + "' and "; break; case "本周新增记录": //得到本周起始日(周一 -- 周日) begintime = DateTime.Now; switch ((int)DateTime.Now.DayOfWeek) { case 0: begintime = begintime.AddDays(-6); break; default: begintime = begintime.AddDays(1 - (int)DateTime.Now.DayOfWeek); break; } searchstring += "(UDS_CM_ClientContact.updatetime between '" + begintime.ToShortDateString() + "' and '" + endtime.ToShortDateString() + "') and "; break; case "本月新增记录": //得到本月起始日 begintime = DateTime.Now; begintime = begintime.AddDays(1 - DateTime.Now.Day); searchstring += "(UDS_CM_ClientContact.updatetime between '" + begintime.ToShortDateString() + "' and '" + endtime.ToShortDateString() + "') and "; break; } } searchstring = "select * from UDS_CM_ClientInfo where ID IN (select UDS_CM_ClientInfo.ID from UDS_CM_ClientContact left join UDS_CM_ClientContact_Linkman ON UDS_CM_ClientContact.ID=UDS_CM_ClientContact_Linkman.ContactID left join UDS_CM_Linkman ON UDS_CM_ClientContact_Linkman.LinkmanID=UDS_CM_ClientContact_Linkman.id,UDS_CM_ClientInfo where UDS_CM_ClientContact.clientid=UDS_CM_ClientInfo.id and " + searchstring; if (searchstring.EndsWith("and ")) { searchstring = searchstring.Substring(0, searchstring.Length - 4); } searchstring += " group by UDS_CM_ClientInfo.ID)"; DataSet ds = new DataSet(); UDS.Components.Staff staff1 = new UDS.Components.Staff(); SqlDataReader dr_Staff = staff1.GetAllStaffs(); DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff); dt_Staff.TableName = "Staff"; ds.Tables.Add(dt_Staff); UDS.Components.Database db = new UDS.Components.Database(); SqlParameter[] prams = { db.MakeInParam("@SQL", SqlDbType.NText, 5000, searchstring) }; SqlDataReader dr = null; db.RunProc("sp_RunSql", prams, out dr); DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr); dt.TableName = "Client"; ds.Tables.Add(dt); ltl_Client.Text = dt.Rows.Count.ToString(); ds.Relations.Add("ClientAddMan_Staff", ds.Tables["Client"].Columns["AddManID"], ds.Tables["Staff"].Columns["Staff_ID"], false); dgrd_ContactList.DataSource = dt.DefaultView; dgrd_ContactList.DataBind(); } }