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 btn_OK_Click(object sender, System.EventArgs e) { UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); DateTime begintime = DateTime.Parse(tbx_begintime.Text); DateTime endtime = DateTime.Parse(tbx_endtime.Text); 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); ltl_AddContactSellman.Text = dt_sellman.Rows.Count.ToString(); 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); ltl_Contact.Text = dt_contact.Rows.Count.ToString(); 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); ltl_CallinContact.Text = dt_callincontact.Rows.Count.ToString(); 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); ltl_NewClient.Text = dt_newclient.Rows.Count.ToString(); SqlDataReader dr_neoclient = cm.GetNegotiateClient(); DataTable dt_neoclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_neoclient); dt_neoclient.TableName = "NeoClient"; ds.Tables.Add(dt_neoclient); ltl_NegotiateClient_Total.Text = dt_neoclient.Rows.Count.ToString(); SqlDataReader dr_neonewclient = cm.GetNewNegotiateClient(begintime,endtime); DataTable dt_neonewclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_neonewclient); dt_neonewclient.TableName = "NeoNewClient"; ds.Tables.Add(dt_neonewclient); ltl_NegotiateClient_New.Text = dt_neonewclient.Rows.Count.ToString(); 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); ltl_New3Client_New.Text = dt_new3client.Rows.Count.ToString(); SqlDataReader dr_3client = cm.Get3StarClient(); DataTable dt_3client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_3client); dt_3client.TableName = "3Client"; ds.Tables.Add(dt_3client); ltl_New3Client_Total.Text = dt_3client.Rows.Count.ToString(); int fee = 0; int feetimes = 0; foreach(DataRow row in dt_contact.Rows) { if(row["Fee"].ToString()!="0") { fee += Int32.Parse(row["fee"].ToString()); feetimes++; } } ltl_Fee.Text = fee.ToString(); ltl_FeeTimes.Text = feetimes.ToString(); SqlDataReader dr_feeclient = cm.GetFeeBySellmanID(0,begintime,endtime); DataTable dt_feeclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_feeclient); dt_feeclient.TableName = "FeeClient"; ds.Tables.Add(dt_feeclient); ltl_FeeClient.Text = dt_feeclient.Rows.Count.ToString(); dt_sellman.DefaultView.RowFilter = "Fee>0"; ltl_FeeSellman.Text = dt_sellman.DefaultView.Count.ToString(); }
private void btn_OK_Click(object sender, System.EventArgs e) { UDS.Components.CM cm = new UDS.Components.CM(); DataSet ds = new DataSet(); DateTime begintime = DateTime.Parse(tbx_begintime.Text); DateTime endtime = DateTime.Parse(tbx_endtime.Text); 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); ltl_AddContactSellman.Text = dt_sellman.Rows.Count.ToString(); 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); ltl_Contact.Text = dt_contact.Rows.Count.ToString(); 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); ltl_CallinContact.Text = dt_callincontact.Rows.Count.ToString(); 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); ltl_NewClient.Text = dt_newclient.Rows.Count.ToString(); SqlDataReader dr_neoclient = cm.GetNegotiateClient(); DataTable dt_neoclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_neoclient); dt_neoclient.TableName = "NeoClient"; ds.Tables.Add(dt_neoclient); ltl_NegotiateClient_Total.Text = dt_neoclient.Rows.Count.ToString(); SqlDataReader dr_neonewclient = cm.GetNewNegotiateClient(begintime, endtime); DataTable dt_neonewclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_neonewclient); dt_neonewclient.TableName = "NeoNewClient"; ds.Tables.Add(dt_neonewclient); ltl_NegotiateClient_New.Text = dt_neonewclient.Rows.Count.ToString(); 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); ltl_New3Client_New.Text = dt_new3client.Rows.Count.ToString(); SqlDataReader dr_3client = cm.Get3StarClient(); DataTable dt_3client = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_3client); dt_3client.TableName = "3Client"; ds.Tables.Add(dt_3client); ltl_New3Client_Total.Text = dt_3client.Rows.Count.ToString(); int fee = 0; int feetimes = 0; foreach (DataRow row in dt_contact.Rows) { if (row["Fee"].ToString() != "0") { fee += Int32.Parse(row["fee"].ToString()); feetimes++; } } ltl_Fee.Text = fee.ToString(); ltl_FeeTimes.Text = feetimes.ToString(); SqlDataReader dr_feeclient = cm.GetFeeBySellmanID(0, begintime, endtime); DataTable dt_feeclient = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_feeclient); dt_feeclient.TableName = "FeeClient"; ds.Tables.Add(dt_feeclient); ltl_FeeClient.Text = dt_feeclient.Rows.Count.ToString(); dt_sellman.DefaultView.RowFilter = "Fee>0"; ltl_FeeSellman.Text = dt_sellman.DefaultView.Count.ToString(); }