Exemplo n.º 1
0
        public bool getuserdata(int custid, string dbconnectstr, string dbname, ref DataTable dt1, ref DataTable dt2, ref DataTable dt3)
        {
            SqlProcess sp = new SqlProcess();
            string dbtable1 = "..banktranid ";
            string dbtable2 = "..custbaseinfo ";
            string dbtable3 = "..logbanktran ";

            //查客户数据
            string sql1 = "select custlname,idtype,idno,fundid,moneytype,bankid,orgid from " + dbname + dbtable1 + "where custid=" + custid.ToString();
            sp.ExecSingleSQL(dbconnectstr, sql1, dt1);
            //若未查到信息,返回false
            if (dt1.Rows.Count == 0)
                return false;

            //查客户类型数据
            string sql2 = "select singleflag from " + dbname + dbtable2 + "where custid=" + custid.ToString();
            sp.ExecSingleSQL(dbconnectstr, sql2, dt2);
            //若未查到信息,返回false
            if (dt2.Rows.Count == 0)
                return false;

            //查流水
            string sql3 = "select sno from " + dbname + dbtable3 + "where custid=" + custid.ToString() + " order by sno desc";
            sp.ExecSingleSQL(dbconnectstr, sql3, dt3);
            //若未查到信息,返回false
            if (dt3.Rows.Count == 0)
                return false;

            return true;
        }
Exemplo n.º 2
0
        public bool getuserdata(int custid, string dbconnectstr, string dbname, ref DataTable dt1, ref DataTable dt2, ref DataTable dt3)
        {
            SqlProcess sp       = new SqlProcess();
            string     dbtable1 = "..banktranid ";
            string     dbtable2 = "..custbaseinfo ";
            string     dbtable3 = "..logbanktran ";

            //查客户数据
            string sql1 = "select custlname,idtype,idno,fundid,moneytype,bankid,orgid from " + dbname + dbtable1 + "where custid=" + custid.ToString();

            sp.ExecSingleSQL(dbconnectstr, sql1, dt1);
            //若未查到信息,返回false
            if (dt1.Rows.Count == 0)
            {
                return(false);
            }

            //查客户类型数据
            string sql2 = "select singleflag from " + dbname + dbtable2 + "where custid=" + custid.ToString();

            sp.ExecSingleSQL(dbconnectstr, sql2, dt2);
            //若未查到信息,返回false
            if (dt2.Rows.Count == 0)
            {
                return(false);
            }

            //查流水
            string sql3 = "select sno from " + dbname + dbtable3 + "where custid=" + custid.ToString() + " order by sno desc";

            sp.ExecSingleSQL(dbconnectstr, sql3, dt3);
            //若未查到信息,返回false
            if (dt3.Rows.Count == 0)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取客户数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btgetdata_Click(object sender, EventArgs e)
        {
            //数据库连接描述
            string dbconnect_str = "Data Source=" + tbDataSource.Text + ";" +
                                   "Initial Catalog=" + tbdbname.Text + ";" +
                                   "Persist Security Info=True;" +
                                   "User ID=" + tbdbuserid.Text + ";" +
                                   "Password="******";";
            //连接数据库
            SqlProcess sp = new SqlProcess();

            //测试数据库连接
            if (!sp.ConnectSQL(dbconnect_str))
            {
                MessageBox.Show("-10001数据库连接失败!请重新配置。");
                return;
            }

            //查找客户信息
            DataTable dtResult  = new DataTable(); //结果集
            DataTable dtResult2 = new DataTable(); //结果集2
            DataTable dtResult3 = new DataTable(); //结果集3
            int       custid    = 0;

            try
            {
                custid = int.Parse(tbCustid.Text);
            }
            catch
            {
                MessageBox.Show("-10002custid配置有误,必须为数字");
                return;
            }

            bool bSuccess = getuserdata(custid, dbconnect_str, tbdbname.Text, ref dtResult, ref dtResult2, ref dtResult3);

            if (!bSuccess)
            {
                MessageBox.Show("-10010未查到客户数据");
                return;
            }

            //客户数据写入
            for (int i = 0; i < Cfg.nParaNum; ++i)
            {
                if (lb[i].Text == "b_custname")
                {
                    tbv[i].Text     = dtResult.Rows[0]["custlname"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_idtype")
                {
                    tbv[i].Text     = dtResult.Rows[0]["idtype"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_idno")
                {
                    tbv[i].Text     = dtResult.Rows[0]["idno"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_bankid")
                {
                    tbv[i].Text     = dtResult.Rows[0]["bankid"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_moneytype")
                {
                    tbv[i].Text     = dtResult.Rows[0]["moneytype"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_fundid")
                {
                    string orgid  = dtResult.Rows[0]["orgid"].ToString().Trim();
                    string fundid = dtResult.Rows[0]["fundid"].ToString().Trim();
                    string smid   = null;
                    for (int j = 0; j < 10 - fundid.Length; j++)
                    {
                        smid = smid + "0";
                    }
                    tbv[i].Text     = orgid + smid + fundid;
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_custtype")
                {
                    tbv[i].Text     = dtResult2.Rows[0]["singleflag"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_bksno")
                {
                    Random ran  = new Random();
                    int    rkey = ran.Next(10000, 99999);
                    tbv[i].Text     = dtResult3.Rows[0]["sno"].ToString().Trim() + rkey.ToString();
                    lb[i].ForeColor = Color.ForestGreen;
                }

                tssLable.Text      = "导入客户数据成功";
                tssLable.ForeColor = Color.ForestGreen;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取客户数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btgetdata_Click(object sender, EventArgs e)
        {
            //数据库连接描述
            string dbconnect_str = "Data Source=" + tbDataSource.Text + ";" +
                                    "Initial Catalog=" + tbdbname.Text + ";" +
                                    "Persist Security Info=True;" +
                                    "User ID=" + tbdbuserid.Text + ";" +
                                    "Password="******";";
            //连接数据库
            SqlProcess sp = new SqlProcess();
            //测试数据库连接
            if (!sp.ConnectSQL(dbconnect_str))
            {
                MessageBox.Show("-10001数据库连接失败!请重新配置。");
                return;
            }

            //查找客户信息
            DataTable dtResult = new DataTable(); //结果集
            DataTable dtResult2 = new DataTable(); //结果集2
            DataTable dtResult3 = new DataTable(); //结果集3
            int custid = 0;
            try
            {
                custid = int.Parse(tbCustid.Text);
            }
            catch
            {
                MessageBox.Show("-10002custid配置有误,必须为数字");
                return;
            }

            bool bSuccess = getuserdata(custid, dbconnect_str, tbdbname.Text, ref dtResult, ref dtResult2, ref dtResult3);
            if (!bSuccess)
            {
                MessageBox.Show("-10010未查到客户数据");
                return;
            }

            //客户数据写入
            for (int i = 0; i < Cfg.nParaNum; ++i)
            {
                if (lb[i].Text == "b_custname")
                {
                    tbv[i].Text = dtResult.Rows[0]["custlname"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_idtype")
                {
                    tbv[i].Text = dtResult.Rows[0]["idtype"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_idno")
                {
                    tbv[i].Text = dtResult.Rows[0]["idno"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_bankid")
                {
                    tbv[i].Text = dtResult.Rows[0]["bankid"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_moneytype")
                {
                    tbv[i].Text = dtResult.Rows[0]["moneytype"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_fundid")
                {
                    string orgid = dtResult.Rows[0]["orgid"].ToString().Trim();
                    string fundid = dtResult.Rows[0]["fundid"].ToString().Trim();
                    string smid = null;
                    for (int j = 0; j < 10 - fundid.Length; j++)
                    {
                        smid = smid + "0";
                    }
                    tbv[i].Text = orgid + smid + fundid;
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_custtype")
                {
                    tbv[i].Text = dtResult2.Rows[0]["singleflag"].ToString().Trim();
                    lb[i].ForeColor = Color.ForestGreen;
                }
                else if (lb[i].Text == "b_bksno")
                {
                    Random ran = new Random();
                    int rkey = ran.Next(10000, 99999);
                    tbv[i].Text = dtResult3.Rows[0]["sno"].ToString().Trim() + rkey.ToString();
                    lb[i].ForeColor = Color.ForestGreen;
                }

                tssLable.Text = "导入客户数据成功";
                tssLable.ForeColor = Color.ForestGreen;
            }
        }