protected override void OnLoad(EventArgs e) { agentDS = OMWorkBench.DeserializeDataSet(OMWorkBench.DataAgent.GetChildAgents(OMWorkBench.AgentId, OMWorkBench.MangerId, 0)); userDS = OMWorkBench.DataAgent.GetChildUsers(OMWorkBench.AgentId, OMWorkBench.MangerId, 0); _addAgentTable = agentDS.Tables["organization"].Clone(); _addUserTable = userDS.Tables["user"].Clone(); allAgentBDS.DataSource = agentDS.Tables["organization"]; allAgentListBox.DataSource = allAgentBDS; allAgentListBox.ValueMember = "id"; allAgentListBox.DisplayMember = "name"; allUserBDS.DataSource = userDS.Tables["user"]; allUserListBox.DataSource = allUserBDS; allUserListBox.ValueMember = "id"; allUserListBox.DisplayMember = "name"; addAgentBDS.DataSource = _addAgentTable; addAgentListBox.DataSource = addAgentBDS; addAgentListBox.ValueMember = "id"; addAgentListBox.DisplayMember = "name"; addUserBDS.DataSource = userDS.Tables["user"]; addUserListBox.DataSource = addUserBDS; addUserListBox.ValueMember = "id"; addUserListBox.DisplayMember = "name"; base.OnLoad(e); }
private void LoginButtton_Click(object sender, EventArgs e) { baseInfoDataSet = OMWorkBench.DeserializeDataSet(dataAgent.GetBaseInfo()); selfInfoDataSet = dataAgent.Login(AgentIDTextBox.Text, userNameTextBox.Text, passWordTextBox.Text); if (selfInfoDataSet != null) { this.DialogResult = DialogResult.OK; if (SaveLoginInfo.Checked) { XmlDocument doc = new XmlDocument(); XmlElement docEle = doc.CreateElement("docEle"); docEle.SetAttribute("agentName", AgentIDTextBox.Text); docEle.SetAttribute("userName", userNameTextBox.Text); docEle.SetAttribute("passWord", passWordTextBox.Text); doc.AppendChild(docEle); doc.Save(@"c:\om.xml"); } this.Close(); } else { MessageBox.Show("登录失败!"); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); DataSet agentDS = OMWorkBench.DeserializeDataSet(OMWorkBench.DataAgent.GetSingleAgent(_agentId)); DataRow agentDR = agentDS.Tables[0].Rows[0]; agentIDTextBox.Text = agentDR["code"].ToString(); agentNameTextBox.Text = agentDR["name"].ToString(); }
public NewCustomTaskForm(DataSet customDS) { InitializeComponent(); _customDS = customDS; addDelAreaControl1.AreaTable = OMWorkBench.BaseInfoDS.Tables["area"]; DataSet _childDS = OMWorkBench.DeserializeDataSet(OMWorkBench.DataAgent.GetChildAgents(OMWorkBench.AgentId, OMWorkBench.MangerId, 0)); addDelAgentControl1.AreaTable = _childDS.Tables["organization"]; }
public AgentToOtherForm(int agentId) { InitializeComponent(); _agentId = agentId; DataSet agentDS = OMWorkBench.DeserializeDataSet(OMWorkBench.DataAgent.GetChildAgents(OMWorkBench.AgentId, OMWorkBench.MangerId, 0)); agentTable = agentDS.Tables[0]; managerTable = OMWorkBench.DataAgent.GetManager(OMWorkBench.AgentId); toOtherComboBox.DataSource = managerTable; toOtherComboBox.ValueMember = "id"; toOtherComboBox.DisplayMember = "name"; }
private void OKBtn_Click(object sender, EventArgs e) { DataSet changeDS = OMWorkBench.BaseInfoDS.Clone(); DataTable agentTable = OMWorkBench.DeserializeDataSet(OMWorkBench.DataAgent.GetSingleAgent(_agentId)).Tables[0]; // changeDS.Tables["organization"]; DataTable managerTable = OMWorkBench.DataAgent.GetManager(_agentId); // changeDS.Tables["manager"]; changeDS.Tables["organization"].Merge(agentTable.Copy()); changeDS.Tables["manager"].Merge(managerTable); DataTable orgTable = changeDS.Tables["organization"]; DataTable monthTaskTable = changeDS.Tables["month_task"]; DataTable seasonTaskTable = changeDS.Tables["season_task"]; DataTable orgCashFlowTable = changeDS.Tables["organize_cash_flow"]; orgTable.Rows[0]["is_reserve"] = 'n'; //月任务表 DataRow monthTaskRow = monthTaskTable.NewRow(); monthTaskRow["start_date"] = AddTimeDateTimePicker.Value; monthTaskRow["rate_d"] = return1TextBox.Text; monthTaskRow["rate_c"] = return2TextBox.Text; monthTaskRow["rate_b"] = return3TextBox.Text; monthTaskRow["rate_a"] = return4TextBox.Text; monthTaskRow["task_amount"] = MonthTaskTextBox.Text; monthTaskRow["finished_amount"] = firstChargeTextBox.Text; monthTaskTable.LoadDataRow(monthTaskRow.ItemArray, false); //季任务表 DataRow seasonTaskRow = seasonTaskTable.NewRow(); seasonTaskRow["start_date"] = AddTimeDateTimePicker.Value; seasonTaskRow["rate_base"] = quarterReturn1TextBox.Text; seasonTaskRow["rate_inc"] = quarterReturn2TextBox.Text; seasonTaskRow["task_amount"] = quarterTaskTextBox.Text; seasonTaskRow["finished_amount"] = firstChargeTextBox.Text; seasonTaskTable.LoadDataRow(seasonTaskRow.ItemArray, false); //代理商现金流量表 DataRow orgCashFlowRow = orgCashFlowTable.NewRow(); orgCashFlowRow["amount"] = firstChargeTextBox.Text; orgCashFlowRow["finance_type"] = 1; orgCashFlowRow["trade_time"] = AddTimeDateTimePicker.Value; orgCashFlowRow["send_organize_id"] = OMWorkBench.AgentId; orgCashFlowRow["send_manager_id"] = OMWorkBench.MangerId; orgCashFlowTable.LoadDataRow(orgCashFlowRow.ItemArray, false); OMWorkBench.DataAgent.NewAgent(changeDS); this.DialogResult = DialogResult.OK; Close(); }
public override void NewCmd() { NewAgentForm newAgent = new NewAgentForm(AgentType.Standard); if (newAgent.ShowDialog() == DialogResult.OK) { _childDS = OMWorkBench.DeserializeDataSet(OMWorkBench.DataAgent.GetChildAgents(_parentAgentId, _parentMangerId, 0)); agentBDS.DataSource = _childDS.Tables["organization"]; AgentDGV.DataSource = agentBDS; int agentCount = Convert.ToInt32(agentCountLinkLabel.Text); agentCount++; agentCountLinkLabel.Text = agentCount.ToString(); int agentZCount = Convert.ToInt32(agentCount2LinkLabel.Text); } base.NewCmd(); }
private void AgentInfoForm_Load(object sender, EventArgs e) { _agentDS = OMWorkBench.DeserializeDataSet(OMWorkBench.DataAgent.GetSingleAgent(_agentId)); #region DataTable areaTable = OMWorkBench.BaseInfoDS.Tables["area"]; DataTable orgTable = _agentDS.Tables["organization"]; //代理商基础信息表 DataTable cashFlowRecordTable = _agentDS.Tables["flowRecords"]; //现金流记录表 DataTable downCashFlowRecordTable = _agentDS.Tables["downflowRecords"]; //对下现金流量表 DataTable lastChargeRecordTable = _agentDS.Tables["lastChargeRecord"]; //最后充值记录 DataTable cashFlowTable = _agentDS.Tables["organize_cash_flow"]; //现金流表 DataTable monthTaskTable = _agentDS.Tables["month_task"]; //月任务表 DataTable seasonTaskTable = _agentDS.Tables["season_task"]; //季任务表 DataRow orgRow = orgTable.Rows[0]; IDLab.Text = orgRow["code"].ToString(); NameLab.Text = orgRow["name"].ToString(); SiteLab.Text = orgRow["website_url"].ToString(); addressLab.Text = orgRow["address"].ToString(); AreaLab.Text = areaTable.Select("id=" + Convert.ToInt32(orgRow["area_id"]))[0]["name"].ToString(); //所在地理区域 TelLab.Text = orgRow["phone"].ToString(); //电话 switch (orgRow["grade"].ToString()) //代理等级 { case "0": LevelLab.Text = "Jeelu"; break; case "1": LevelLab.Text = "总代"; break; case "2": LevelLab.Text = "二代"; break; } if (_agentDS.Tables["org_stat"].Rows.Count > 0) //下级代理商数量统计 { SubStandardAgentNumLab.Text = _agentDS.Tables["org_stat"].Rows[0]["standardAgentCount"].ToString(); //正式代理商 SubLateAgentNumLab.Text = _agentDS.Tables["org_stat"].Rows[0]["lateAgentCount"].ToString(); //潜在代理商 } if (_agentDS.Tables["org_user_stat"].Rows.Count > 0) //下级广告主数量统计 { SubStandardUserNumLab.Text = _agentDS.Tables["org_user_stat"].Rows[0]["standardUserCount"].ToString(); //正式广告主 SubLateUserNumLab.Text = _agentDS.Tables["org_user_stat"].Rows[0]["lateUserCount"].ToString(); //潜在广告主 } ManagerNumLab.Text = orgRow["managerNum"].ToString(); //管理员数量 ParentAgentLab.Text = orgRow["pname"].ToString(); //所属代理商 decimal balance = Convert.ToDecimal(orgRow["balance"]); //余额 BalanceLab.Text = balance.ToString("#.##"); OMWorkBench.Balance = balance; if (lastChargeRecordTable.Rows.Count > 0) //最后充值 { LastChargeTimeLab.Text = lastChargeRecordTable.Rows[0]["trade_time"].ToString(); //最后充值时间 LastChargeNumLab.Text = Convert.ToDecimal(lastChargeRecordTable.Rows[0]["amount"]).ToString("#.##"); //最后充值金额 } else { LastChargeTimeLab.Text = ""; LastChargeNumLab.Text = ""; } ChargeSubLab.Text = downCashFlowRecordTable.Rows[0]["chargeChildRecords"].ToString(); //对下充值记录 ChargeLab.Text = cashFlowRecordTable.Rows[0]["chargeRecords"].ToString(); //被充值记录 ReturnSubLab.Text = downCashFlowRecordTable.Rows[0]["returnChildRecords"].ToString(); //向下返点记录 ReturnLab.Text = cashFlowRecordTable.Rows[0]["returnRecords"].ToString(); //返点记录 if (monthTaskTable.Rows.Count > 0) { decimal taskAmount = Convert.ToDecimal(monthTaskTable.Rows[0]["return_amount"] == DBNull.Value ? "0" : monthTaskTable.Rows[0]["task_amount"]); decimal monthRetRate = balance == 0 ? 0 : (taskAmount - balance) / balance; MonthTaskLab.Text = taskAmount.ToString("#.##"); //月任务 MonthReturnRateLab.Text = monthTaskTable.Rows[0]["return_rate"].ToString() + " %"; //月返点比率 monthReturnAmountLabel.Text = Convert.ToDecimal(monthTaskTable.Rows[0]["return_amount"]).ToString("#.##"); //月返点金额 } else { MonthTaskLab.Text = MonthReturnRateLab.Text = monthReturnAmountLabel.Text = "0"; } if (seasonTaskTable.Rows.Count > 0) { QuarterNumLab.Text = seasonTaskTable.Rows[0]["return_amount"].ToString(); //季度返点金额 QuarterReturnRateLab.Text = (Convert.ToDecimal(seasonTaskTable.Rows[0]["return_rate"])).ToString("p"); //季度返点比率 } else { QuarterNumLab.Text = QuarterReturnRateLab.Text = "0"; } decimal returnAmount = Convert.ToDecimal(cashFlowRecordTable.Rows[0]["returnSum"]); decimal returnSubAmount = Convert.ToDecimal(downCashFlowRecordTable.Rows[0]["returnchildSum"]); decimal incomeAmount = returnAmount - returnSubAmount; IncomeLab.Text = incomeAmount.ToString("#.##");//收益=被返点-向下返点 #endregion }
protected override void OnLoad(EventArgs e) { byte[] agentByte = null; if (OMWorkBench.AgentViewAll) { agentByte = OMWorkBench.DataAgent.GetChildAgents(_parentAgentId, _parentMangerId, 0); } else if (OMWorkBench.AgentViewUnderSub) { agentByte = OMWorkBench.DataAgent.GetChildAgents(_parentAgentId, _parentMangerId, 1); } else if (OMWorkBench.AgentViewUnder) { agentByte = OMWorkBench.DataAgent.GetChildAgents(_parentAgentId, _parentMangerId, 2); } _childDS = OMWorkBench.DeserializeDataSet(agentByte); agentBDS.DataSource = _childDS.Tables["organization"]; agentBDS.Filter = "1=1 "; if (_isSelfAgent) { agentBDS.Filter += "and managerName='" + OMWorkBench.MangerName + "'"; } AgentDGV.DataSource = agentBDS; id.DataPropertyName = "id"; code.DataPropertyName = "code"; agentName.DataPropertyName = "name"; manager.DataPropertyName = "managerName"; area.DataPropertyName = "areaName"; isReserve.DataPropertyName = "isReserve"; communicate.DataPropertyName = "comCount"; _areaTable = OMWorkBench.BaseInfoDS.Tables["area"]; BindingSource areaBDS = new BindingSource(); areaBDS.DataSource = _areaTable; areaBDS.Filter = "level=1"; areaComboBox.DataSource = _areaTable; areaComboBox.DisplayMember = "name"; areaComboBox.ValueMember = "code"; agentCountLinkLabel.Text = _childDS.Tables["organization"].Rows.Count.ToString(); agentCount2LinkLabel.Text = _childDS.Tables["organization"].Select("grade=1").GetLength(0).ToString(); agentCount3LinkLabel.Text = _childDS.Tables["organization"].Select("grade=2").GetLength(0).ToString(); foreach (DataRow dr in _childDS.Tables["organization"].Rows) { if (Convert.ToInt32(dr["manager_id"]) == OMWorkBench.MangerId) { underAgent.Add(Convert.ToInt32(dr["id"])); } } foreach (DataRow dr in _childDS.Tables["organization"].Rows) { foreach (int agentId in underAgent) { if (Convert.ToInt32(dr["parent_id"]) == agentId) { underSubAgent.Add(Convert.ToInt32(dr["id"])); } } } underSubAgent.AddRange(underAgent); base.OnLoad(e); }
protected override void OnLoad(EventArgs e) { if (OMWorkBench.UserViewAll) { _userDS = OMWorkBench.DataAgent.GetChildUsers(OMWorkBench.AgentId, OMWorkBench.MangerId, 0); } else if (OMWorkBench.UserViewUnderCorp) { _userDS = OMWorkBench.DataAgent.GetChildUsers(OMWorkBench.AgentId, OMWorkBench.MangerId, 1); } else if (OMWorkBench.UserViewUnderManagerSub) { _userDS = OMWorkBench.DataAgent.GetChildUsers(OMWorkBench.AgentId, OMWorkBench.MangerId, 2); } else if (OMWorkBench.UserViewUnderManager) { _userDS = OMWorkBench.DataAgent.GetChildUsers(OMWorkBench.AgentId, OMWorkBench.MangerId, 3); } _userDS.WriteXml(@"c:\xx.xml"); _userBDS.DataSource = _userDS.Tables["user"]; userDGV.DataSource = _userBDS; id.DataPropertyName = "id"; userId.DataPropertyName = "username"; userName.DataPropertyName = "realname"; userArea.DataPropertyName = "areaName"; ownerOrg.DataPropertyName = "orgName"; ownerManager.DataPropertyName = "managerName"; communicate.DataPropertyName = "comCount"; isReserve.DataPropertyName = "isReserve"; _userBDS.Filter = "1=1 "; if (_isSelfUser) { _userBDS.Filter += "and managerName='" + OMWorkBench.MangerName + "'"; } userDGV.DataSource = _userBDS; DataTable _areaTable = OMWorkBench.BaseInfoDS.Tables["area"]; BindingSource areaBDS = new BindingSource(); areaBDS.DataSource = _areaTable; areaBDS.Filter = "level=1"; areaComboBox.DataSource = _areaTable; areaComboBox.DisplayMember = "name"; areaComboBox.ValueMember = "code"; userCountLinkLabel.Text = _userDS.Tables["user"].Rows.Count.ToString(); userCount2LinkLabel.Text = _userDS.Tables["user"].Select("manageState=1").GetLength(0).ToString(); userCount3LinkLabel.Text = _userDS.Tables["user"].Select("manageState=0").GetLength(0).ToString(); underCorp = new List <int>(); underManager = new List <int>(); underManagerSub = new List <int>(); foreach (DataRow dr in _userDS.Tables["user"].Rows) { if (Convert.ToInt32(dr["manager_id"]) == OMWorkBench.MangerId) { underManager.Add(Convert.ToInt32(dr["id"])); } } foreach (DataRow dr in _userDS.Tables["user"].Rows) { int orgId = Convert.ToInt32(dr["organization_id"]); if (!underManager.Contains(orgId) && orgId == OMWorkBench.AgentId) { underCorp.Add(Convert.ToInt32(dr["id"])); } } DataSet subAgentDS = OMWorkBench.DeserializeDataSet(OMWorkBench.DataAgent.GetChildAgents(OMWorkBench.AgentId, OMWorkBench.MangerId, 2)); foreach (DataRow pdr in _userDS.Tables["user"].Rows) { int porgId = Convert.ToInt32(pdr["id"]); if (!(underManager.Contains(porgId) || underCorp.Contains(porgId))) { foreach (DataRow dr in subAgentDS.Tables["organization"].Rows) { int orgId = Convert.ToInt32(dr["organization_id"]); if (orgId == porgId) { underManagerSub.Add(Convert.ToInt32(pdr["id"])); } } } } underManagerSub.AddRange(underManager); base.OnLoad(e); }