Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string SendMobile = textBox1.Text.Trim();
            string SendContent = textBox2.Text.Trim();

            if (SendMobile == "" || SendContent == "")
            {
                MessageBox.Show("请填写手机号或测试内容", "警告信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            };



            string AID = comboBox1.SelectedValue.ToString();

            DataTable dt = DBconn.getDataView("SELECT [AccountNo],[PassWord]FROM [dbo].[CFG_Account] WITH(NOLOCK) WHERE [AID] = " + AID);
            string CorpID = dt.Rows[0][0].ToString();
            string Pwd = dt.Rows[0][1].ToString();
            string SendTime = DateTime.Now.ToString("yyyyMMddHHmmss");

            try
            {
                Dxt.LinkWS LinkWs = new Dxt.LinkWS();


                int ReS = LinkWs.Send(CorpID.Trim(), Pwd.Trim(), SendMobile.Trim(), SendContent.Trim(), "", SendTime.Trim());
                if (ReS == 0)
                {
                    MessageBox.Show("发送成功!");
                    this.Close();
                }
                else if (ReS == -1)
                {
                    MessageBox.Show("帐号未注册!");
                }
                else if (ReS == -2)
                {
                    MessageBox.Show("其他错误!");
                }
                else if (ReS == -3)
                {
                    MessageBox.Show("帐号密码不匹配!");
                }
                else if (ReS == -4)
                {
                    MessageBox.Show("手机号码不正确!");
                }
                else if (ReS == -5)
                {
                    MessageBox.Show("余额不足!");
                }
                else if (ReS == -6)
                {
                    MessageBox.Show("定时发送时间不是有效时间!");
                }
            }
            catch (System.Net.WebException WebExcp)
            {
                MessageBox.Show("网络错误,无法连接到服务器!");
            }


            return;
        }
Beispiel #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentCell == null)
            {
                return;
            };

            int sltRow = dataGridView1.CurrentCell.RowIndex;

            string strStatus = dataGridView1.Rows[sltRow].Cells["注册状态"].Value.ToString();

            if (strStatus == "已注册") {

                string CorpID = dataGridView1.Rows[sltRow].Cells["企业号"].Value.ToString();
                string Pwd = dataGridView1.Rows[sltRow].Cells[3].Value.ToString();

                try
                {
                    Dxt.LinkWS LinkWs = new Dxt.LinkWS();
                    int ReS = LinkWs.SelSum(CorpID.Trim(), Pwd.Trim());
                    if (ReS >= 0)
                    {

                        MessageBox.Show("还剩" + ReS.ToString() + "条");
                    }
                    else if (ReS == -1)
                    {
                        MessageBox.Show("帐号未注册!");
                    }
                    else if (ReS == -2)
                    {
                        MessageBox.Show("其他错误!");
                    }
                    else if (ReS == -3)
                    {
                        MessageBox.Show("帐号密码不匹配!");
                    }
                }
                catch (System.Net.WebException WebExcp)
                {
                    MessageBox.Show("网络错误,无法连接到服务器!");
                }
                
            } else {
                MessageBox.Show("请检查注册状态", "警告信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;     
            }
        }
Beispiel #3
0
        private void button3_Click(object sender, EventArgs e)
        {

            if (dataGridView1.CurrentCell == null) {
                return;
            };

            int sltRow = dataGridView1.CurrentCell.RowIndex;

            string strStatus = dataGridView1.Rows[sltRow].Cells["注册状态"].Value.ToString();

            if (strStatus == "未注册") {
                //获取数据

                string AID = dataGridView1.Rows[sltRow].Cells["AID"].Value.ToString();  //主键

                string CorpID = dataGridView1.Rows[sltRow].Cells["企业号"].Value.ToString();
                string Pwd = dataGridView1.Rows[sltRow].Cells[3].Value.ToString();  //密码
                string CorpName = dataGridView1.Rows[sltRow].Cells["公司名称"].Value.ToString();
                string LinkMan = dataGridView1.Rows[sltRow].Cells["联系人"].Value.ToString();
                string Tel = dataGridView1.Rows[sltRow].Cells["联系电话"].Value.ToString();
                string Mobile = dataGridView1.Rows[sltRow].Cells["移动电话"].Value.ToString();
                string Email = dataGridView1.Rows[sltRow].Cells["邮箱"].Value.ToString();
                string Memo = dataGridView1.Rows[sltRow].Cells["备注"].Value.ToString();

                //调用webServer
                Dxt.LinkWS LinkWs = new Dxt.LinkWS();

                int ReS = LinkWs.Reg(CorpID.Trim(), Pwd.Trim(), CorpName.Trim(), LinkMan.Trim(), Tel.Trim(), Mobile.Trim(), Email.Trim(), Memo.Trim());

                try
                {
                    if (ReS == 0)
                    {

                        string strSQL = "AStatus = 1 WHERE AID = " + AID;
                        bool bRst = DBconn.Update("[dbo].[CFG_Account]", strSQL);

                        MessageBox.Show("注册成功");
                    }
                    else if (ReS == -1)
                    {
                        MessageBox.Show("帐号已经注册,请先注销!");
                    }
                    else if (ReS == -2)
                    {
                        MessageBox.Show("其他错误!");
                    }
                    else if (ReS == -3)
                    {
                        MessageBox.Show("帐号密码不匹配!");
                    }
                }
                catch (System.Net.WebException WebExcp)
                {
                    MessageBox.Show("网络错误,无法连接到服务器!");
                    throw;
                }
                finally
                {
                    loadData();
                }

            } else {
                MessageBox.Show("请检查注册状态","警告信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            };
        } 
Beispiel #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentCell == null)
            {
                return;
            };

            int sltRow = dataGridView1.CurrentCell.RowIndex;

            string strASts = dataGridView1.Rows[sltRow].Cells["注册状态"].Value.ToString();
            string strSSts = dataGridView1.Rows[sltRow].Cells["启用状态"].Value.ToString();


            if (strSSts == "未启用") {
                if (strASts == "已注册")
                {
                    //代码

                    string AID = dataGridView1.Rows[sltRow].Cells["AID"].Value.ToString();  //主键
                    string CorpID = dataGridView1.Rows[sltRow].Cells["企业号"].Value.ToString();
                    string Pwd = dataGridView1.Rows[sltRow].Cells[3].Value.ToString();

                    try
                    {
                        Dxt.LinkWS LinkWs = new Dxt.LinkWS();
                        int ReS = LinkWs.UnReg(CorpID.Trim(), Pwd.Trim());
                        if (ReS == 0)
                        {

                            string strSQL = "AStatus = 0 WHERE AID = " + AID;
                            bool bRst = DBconn.Update("[dbo].[CFG_Account]", strSQL);

                            MessageBox.Show("注销成功");
                        }
                        else if (ReS == -1)
                        {
                            MessageBox.Show("帐号未注册!");
                        }
                        else if (ReS == -2)
                        {
                            MessageBox.Show("其他错误!");
                        }
                        else if (ReS == -3)
                        {
                            MessageBox.Show("帐号密码不匹配!");
                        }
                    }
                    catch (System.Net.WebException WebExcp)
                    {
                        MessageBox.Show("网络错误,无法连接到服务器!");
                    }
                    finally
                    {
                        loadData();
                    }

                }
                else
                {
                    MessageBox.Show("请检查注册状态", "警告信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                };
            } else {
                MessageBox.Show("请先停用后再试", "警告信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;                    
            };
            
        }