예제 #1
0
        private void userDGV_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (userDGV.CurrentRow == null)
            {
                return;
            }
            int    userID           = Convert.ToInt32(userDGV.CurrentRow.Cells["id"].Value);
            bool   isreserve        = (userDGV.CurrentRow.Cells["isReserve"].Value.ToString() == "潜在");
            int    currentManagerId = Convert.ToInt32(_userDS.Tables["user"].Select("id=" + userID)[0]["manager_id"]);
            string colName          = userDGV.CurrentCell.OwningColumn.Name;

            switch (colName)
            {
            case "userId":
            case "userName":
            {
                ViewSingleUserForm viewSingleUser = new ViewSingleUserForm(userID, isreserve);
                viewSingleUser.ShowDialog(this);
                break;
            }

            case "communicate":
            {
                OMWorkBench.CreateForm(new CommunicateLoginForm(-1, userID, currentManagerId));
                break;
            }

            case "managerRemind":
            {
                OMWorkBench.CreateForm(new ManagerMindForm(currentManagerId));
                break;
            }
            }
        }
예제 #2
0
        private void AgentDGV_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (AgentDGV.CurrentRow == null)
            {
                return;
            }
            currentAgentId = Convert.ToInt32(AgentDGV.CurrentRow.Cells["id"].Value);
            int    currentManagerId = Convert.ToInt32(_childDS.Tables[0].Select("id=" + currentAgentId)[0]["manager_id"]);
            string colName          = AgentDGV.CurrentCell.OwningColumn.Name;

            switch (colName)
            {
            case "code":
            case "agentName":
            {
                OMWorkBench.CreateForm(new ChildAgentInfoForm(currentAgentId));
                break;
            }

            case "communicate":
            {
                OMWorkBench.CreateForm(new CommunicateLoginForm(currentAgentId, -1, currentManagerId));
                break;
            }

            case "managerMind":
            {
                OMWorkBench.CreateForm(new ManagerMindForm(currentManagerId));
                break;
            }
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoginForm login = new LoginForm();

            if (login.ShowDialog() == DialogResult.OK)
            {
                OMWorkBench.BaseInfoDS  = login.BaseInfoDataSet;
                OMWorkBench.CurrentInfo = login.SelfInfoDataSet;
                DataRow loginRow = login.SelfInfoDataSet.Tables["login"].Rows[0];
                OMWorkBench.AgentId    = Convert.ToInt32(loginRow["id"]);
                OMWorkBench.AgentName  = loginRow["name"].ToString();
                OMWorkBench.Balance    = Convert.ToDecimal(loginRow["balance"]);
                OMWorkBench.MangerId   = Convert.ToInt32(loginRow["id1"]);
                OMWorkBench.MangerName = loginRow["name1"].ToString();
                OMWorkBench.AreaId     = Convert.ToInt32(loginRow["area_id"]);
                OMWorkBench.Grade      = Convert.ToInt32(loginRow["grade"]);
                OMWorkBench.Rights     = OMWorkBench.StrToBitStr(Convert.ToString(loginRow["rights"]));
            }
            else
            {
                return;
            }
            Application.Run(OMWorkBench.MainForm);
        }
예제 #5
0
        /// <summary>
        /// 广告管理
        /// </summary>
        public override void CheckCmd()
        {
            int    userId   = Convert.ToInt32(userDGV.CurrentRow.Cells["id"].Value);
            string userName = userDGV.CurrentRow.Cells["userName"].Value.ToString();

            OMWorkBench.CreateForm(new ViewAdvSiteForm(userId, userName));
        }
예제 #6
0
        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("登录失败!");
            }
        }
예제 #7
0
        private void MainForm4_Load(object sender, EventArgs e)
        {
            LeftTreeView leftTree = new LeftTreeView();

            leftTree.Show(MainDockPanel, DockState.DockLeft);

            OMWorkBench.CreateForm(new SelfManagerForm(OMWorkBench.MangerId));//  AgentInfoForm(OMWorkBench.AgentId));
        }
예제 #8
0
        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();
        }
예제 #9
0
 private void RightSetForm_Load(object sender, EventArgs e)
 {
     OKBtn.Enabled = OMWorkBench.ModifyManager;
     for (int i = 0; i < _rightStr.Length; i++)
     {
         char rightArr = _rightStr[i];
         _bitArrayStr += Convert.ToString(rightArr, 2).PadLeft(8, '0');
     }
     BitArrayStr = OMWorkBench.StrToBitStr(_rightStr);
 }
예제 #10
0
        private void RightBtn_Click(object sender, EventArgs e)
        {
            RightSetForm right = new RightSetForm("ÿÿÿÿÿÿÿÿÿÿùw");

            if (right.ShowDialog(this) == DialogResult.OK)
            {
                string bitRight = right.BitArrayStr;
                rightStr = OMWorkBench.BitStrToStr(bitRight);
            }
        }
예제 #11
0
        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"];
        }
예제 #12
0
        private void Button_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;

            switch (btn.Name)
            {
            case "agentBtn":
            {
                OMWorkBench.CreateForm(new ViewAgentForm(OMWorkBench.AgentId, OMWorkBench.MangerId, OMWorkBench.AgentName, false));
                break;
            }

            case "userBtn":
            {
                OMWorkBench.CreateForm(new ViewUserForm(false));
                break;
            }

            case "jeeluBtn":
            {
                OMWorkBench.CreateForm(new AgentInfoForm(OMWorkBench.AgentId));
                break;
            }

            case "webUnionBtn":
            {
                OMWorkBench.CreateForm(new ViewWebUnionForm());
                break;
            }

            case "newBtn":
            {
                OMWorkBench.CreateForm(new ViewNewsForm());
                break;
            }

            case "managerBtn":
            {
                OMWorkBench.CreateForm(new ViewManagerForm(OMWorkBench.AgentId, OMWorkBench.AgentName));
                break;
            }

            case "selfDefinedRetrunBtn":
            {
                OMWorkBench.CreateForm(new ViewCustomTask());
                break;
            }

            default:
                break;
            }
        }
예제 #13
0
        private void GiveDataToSiteForm(string tabText, string filterStr)
        {
            if (_webSiteDS == null)
            {
                _webSiteDS = OMWorkBench.DataAgent.GetWebSite(-1);
            }
            string          siteTypeCount = tabText + "网站数量: ";
            ViewWebSiteForm viewWebSite   = new ViewWebSiteForm(_webSiteDS, webUnionDS, siteTypeCount);

            viewWebSite.FilterStr = filterStr;
            viewWebSite.TabText  += "--" + tabText;
            OMWorkBench.CreateForm(viewWebSite);
        }
예제 #14
0
        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";
        }
예제 #15
0
        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();
        }
예제 #16
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewCell cell = advWebSiteDGV.CurrentRow.Cells[e.ColumnIndex] as DataGridViewCell;
            int    siteId         = Convert.ToInt32(advWebSiteDGV.CurrentRow.Cells["id"].Value);
            string sitename       = advWebSiteDGV.CurrentRow.Cells["siteName"].Value.ToString();

            switch (cell.OwningColumn.Name)
            {
            case "siteName":
            {
                OMWorkBench.CreateForm(new ViewAdvForm(siteId, sitename));
                break;
            }
            }
        }
예제 #17
0
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;

            switch (item.Name)
            {
            case "jeeluToolStripMenuItem":
            {
                OMWorkBench.CreateForm(new AgentInfoForm(OMWorkBench.AgentId));
                break;
            }

            case "managerToolStripMenuItem":
            {
                OMWorkBench.CreateForm(new ViewManagerForm(OMWorkBench.AgentId, OMWorkBench.AgentName));
                break;
            }

            case "agentToolStripMenuItem":
            {
                OMWorkBench.CreateForm(new ViewAgentForm(OMWorkBench.AgentId, OMWorkBench.MangerId, OMWorkBench.AgentName, false));
                break;
            }

            case "userToolStripMenuItem":
            {
                OMWorkBench.CreateForm(new ViewUserForm(false));
                break;
            }

            case "webUnionToolStripMenuItem":
            {
                OMWorkBench.CreateForm(new ViewWebUnionForm());
                break;
            }

            case "newsToolStripMenuItem":
            {
                // OMWorkBench.CreateForm(new ViewNewsForm());
                break;
            }

            case "msgToolStripMenuItem":
            {
                break;
            }
            }
        }
예제 #18
0
        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();
        }
예제 #19
0
        private void managerDGV_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int     managerID  = Convert.ToInt32(managerDGV.CurrentRow.Cells["id"].Value);
            DataRow currentRow = _managerTable.Select("id=" + managerID)[0];

            switch (managerDGV.CurrentCell.OwningColumn.Name)
            {
            case "name":
            {
                SelfManagerForm managerForm = new SelfManagerForm(managerID);
                OMWorkBench.CreateForm(managerForm);
                break;
            }

            case "log": break;

            case "rights":
            {
                if (canModifyOthers)
                {
                    string       rights    = currentRow["rights"].ToString();
                    RightSetForm rightForm = new RightSetForm(rights);
                    if (rightForm.ShowDialog() == DialogResult.OK)
                    {
                        currentRow["rights"] = OMWorkBench.BitStrToStr(rightForm.BitArrayStr);
                        int I = OMWorkBench.DataAgent.UpdateManager(_managerTable.GetChanges());
                        _managerTable.AcceptChanges();
                    }
                }
                break;
            }

            case "remind":
            {
                OMWorkBench.CreateForm(new ManagerMindForm(managerID));
                break;
            }

            default: break;
            }
        }
예제 #20
0
        private void webUnionDGV_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int unionId = Convert.ToInt32(webUnionDGV.CurrentRow.Cells["webid"].Value);

            switch (webUnionDGV.CurrentCell.OwningColumn.Name)
            {
            case "uname":
            {
                DataSet _webSiteDS    = OMWorkBench.DataAgent.GetWebSite(unionId);
                string  siteTypeCount = "网站数量: ";        //+ _webSiteDS.Tables["website"].Rows.Count.ToString();
                OMWorkBench.CreateForm(new ViewWebSiteForm(_webSiteDS, webUnionDS, siteTypeCount));
                break;
            }

            case "viewInfo":
            {
                DataSet          _webSiteDS = OMWorkBench.DataAgent.GetWebSite(unionId);
                WebUnionInfoForm unionInfo  = new WebUnionInfoForm(unionId, _webSiteDS);
                unionInfo.ShowDialog(this);
                break;
            }
            }
        }
예제 #21
0
        private void Lab_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel linkLabel = sender as LinkLabel;

            switch (linkLabel.Name)
            {
            case "SubAgentNumLab":
            {
                OMWorkBench.CreateForm(new ViewAgentForm(OMWorkBench.AgentId, OMWorkBench.MangerId, OMWorkBench.AgentName, true));
                break;
            }

            case "SubUserNumLab":
            {
                OMWorkBench.CreateForm(new ViewUserForm(true));        //OMWorkBench.AgentId, OMWorkBench.MangerId, OMWorkBench.AgentName));

                break;
            }

            case "ChargeCountLab": break;

            case "ChargeSumLab": break;
            }
        }
예제 #22
0
        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
        }
예제 #23
0
        private void LinkLab_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel clickLab = sender as LinkLabel;

            switch (clickLab.Name)
            {
            case "SubStandardAgentNumLab":
            case "SubLateAgentNumLab":
            {
                OMWorkBench.CreateForm(new ViewAgentForm(OMWorkBench.AgentId, OMWorkBench.MangerId, _agentDS.Tables["organization"].Rows[0]["name"].ToString(), false));
                break;
            }

            case "SubStandardUserNumLab":
            case "SubLateUserNumLab":
            {
                OMWorkBench.CreateForm(new ViewUserForm(false));
                break;
            }

            case "ManagerNumLab":
            {
                OMWorkBench.CreateForm(new ViewManagerForm(OMWorkBench.AgentId, OMWorkBench.AgentName));
                break;
            }

            case "ChargeLab":
            {
                DataTable           chargeHistory     = OMWorkBench.DataAgent.GetAgentChargeRecords(OMWorkBench.AgentId);
                ChargeAgentHistForm chargeHistoryForm = new ChargeAgentHistForm(chargeHistory);
                chargeHistoryForm.ShowDialog(this);
                break;
            }

            case "ChargeSubLab":
            {
                DataTable           chargeHistory     = OMWorkBench.DataAgent.GetAgentChargeSubRecords(OMWorkBench.AgentId);
                ChargeAgentHistForm chargeHistoryForm = new ChargeAgentHistForm(chargeHistory);
                chargeHistoryForm.ShowDialog(this);
                break;
            }

            case "ReturnLab":
            {
                int               sendOrgId    = -1;
                int               receiveOrgId = OMWorkBench.AgentId;
                DataTable         returnTable  = OMWorkBench.DataAgent.GetReturnRecords(sendOrgId, receiveOrgId);
                ReturnRecordsForm returnForm   = new ReturnRecordsForm(returnTable);
                returnForm.ShowDialog(this);
                break;
            }

            case "ReturnSubLab":
            {
                int               sendOrgId    = -1;
                int               receiveOrgId = OMWorkBench.AgentId;
                DataTable         returnTable  = OMWorkBench.DataAgent.GetReturnRecords(sendOrgId, receiveOrgId);
                ReturnRecordsForm returnForm   = new ReturnRecordsForm(returnTable);
                returnForm.ShowDialog(this);
                break;
            }

            default: break;
            }
        }
예제 #24
0
 public override void NewCmd()
 {
     OMWorkBench.CreateForm(new NewManagerForm(OMWorkBench.AgentId));
 }
예제 #25
0
        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);
        }
예제 #26
0
 public override void NewCmd()
 {
     OMWorkBench.CreateForm(new NewManagerForm(Convert.ToInt32(_agentDS.Tables["organization"].Rows[0]["id"])));
 }
예제 #27
0
        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);
        }