コード例 #1
0
        private void CustomerInfAdd_Load(object sender, EventArgs e)
        {
            //初始化ComboBox
            InitFuncs inf = new InitFuncs();

            inf.InitComboBox(this.s_CustType, "[客户]类别");
            inf.InitComboBox(this.s_Degree, "[客户]等级");
            inf.InitComboBox(this.s_whichTrade, "[客户]所在行业");
            inf.InitComboBox(this.s_Country, "[客户]国家");
            inf.InitComboBox(this.s_Province, "[客户]省");
            inf.InitComboBox(this.s_City, "[客户]城市");

            inf.InitComboBox(this.t_AreaCode, "T_AreaInf", "Area");
            inf.InitComboBox(this.t_ImportanceDegreeId, "T_CustomerImp", "importance");

            if (custid.Trim() == "")
            {
                tabControl1.Enabled = false;
            }
            else
            {
                tabControl1.Enabled = true;
            }

            s_InputTime.Text = DBUtil.getServerTime().ToString();
            if (this.type == "edit")
            {
                this.s_CustID.ReadOnly = true;
                string strsql = "select * from T_CustomerInf where CustID='{0}'";
                strsql = string.Format(strsql, this.custid);

                inf.ShowDatas(this.panelcustomer, strsql);

                //以下两行必须在ShowDatas后
                DBUtil dbUtil = new DBUtil();
                t_AreaCode.Text           = (new DBUtil()).Get_Single_val("T_AreaInf", "Area", "areaId", S_AreaCode.Text.Trim());
                t_ImportanceDegreeId.Text = (new DBUtil()).Get_Single_val("T_CustomerImp", "importance", "Iid", S_ImportanceDegreeId.Text.Trim());

                //初始化抬头
                SqlDBConnect SDB = new SqlDBConnect();
                s_BillHead.Clear();
                string strSql = "select BillHead as 发票抬头 from T_CustomerTitle where CustID='{0}'";//"select * from T_SelItems where ItemType='{0}'";
                strSql = string.Format(strSql, s_CustID.Text.Trim());
                DataSet  ds    = SDB.Get_Ds(strSql);
                int      Lins  = ds.Tables[0].Rows.Count;
                string[] match = new string[ds.Tables[0].Rows.Count];
                for (int i = 0; i < match.Length; i++)
                {
                    s_BillHead.Text += ds.Tables[0].Rows[i]["发票抬头"].ToString() + "\r\n";//回车换行
                }
            }
            if (this.custid != "")
            {//初始化联系人;
                init_lxr();
                //初始化发票
                init_fp();
                //初始化多地址
                init_muladd();
            }
            //限制值类型文本框的输入
            (new InitFuncs()).Num_limited(this.panelcustomer);
        }