• [C#]项目客户使用地域锁定


    string localPriname, localcityname, localregname, localtownname;
    string localPricode, localcitycode, localregcode, localtowncode;
     
    private void ControlLocalSelect(string proCode, string cityCode, string CountyCode)
    {
        localPriname = cbll.GetPriName(proCode);
     
     
        if (proCode != "" && cityCode != "" && CountyCode != "")
        {
            localregname = cbll.GetRegName(CountyCode, out localcitycode, out localPricode);
            localcityname = cbll.GetCityName(cityCode);
     
            lookUpEdit1.Text = localPriname;
            lookUpEdit1.EditValue = proCode;
     
            lookUpEdit5.Text = localPriname;
            lookUpEdit5.EditValue = proCode;
     
            BindCity();
            lookUpEdit2.Text = localcityname;
            lookUpEdit2.EditValue = cityCode;
     
            BindCity1();
            lookUpEdit6.Text = localcityname;
            lookUpEdit6.EditValue = cityCode;
     
            BindRegionCombox();
            lookUpEdit3.Text = localregname;
            lookUpEdit3.EditValue = CountyCode;
     
            BindRegionCombox1();
            lookUpEdit8.Text = localregname;
            lookUpEdit8.EditValue = CountyCode;
     
            BindTownCombox();
            lookUpEdit4.Text = localtownname;
            lookUpEdit4.EditValue = localtowncode;
     
            BindTownCombox1();
            lookUpEdit7.Text = localtownname;
            lookUpEdit7.EditValue = localtowncode;
     
            lookUpEdit1.Visible = false;
            lookUpEdit2.Visible = false;
            lookUpEdit3.Visible = false;
            lookUpEdit5.Visible = false;
            lookUpEdit6.Visible = false;
            lookUpEdit8.Visible = false;
     
            lookUpEdit1.Enabled = false;
            lookUpEdit2.Enabled = false;
            lookUpEdit3.Enabled = false;
            lookUpEdit5.Enabled = false;
            lookUpEdit6.Enabled = false;
            lookUpEdit8.Enabled = false;
     
            lookUpEdit1.Visible = true;
            lookUpEdit2.Visible = true;
            lookUpEdit3.Visible = true;
            lookUpEdit5.Visible = true;
            lookUpEdit6.Visible = true;
            lookUpEdit8.Visible = true;
        }
        else if (proCode != "" && cityCode != "" && CountyCode == "")
        {
            localcityname = cbll.GetCityName(cityCode);
     
            lookUpEdit1.Text = localPriname;
            lookUpEdit1.EditValue = proCode;
     
            lookUpEdit5.Text = localPriname;
            lookUpEdit5.EditValue = proCode;
     
            BindCity();
            lookUpEdit2.Text = localcityname;
            lookUpEdit2.EditValue = cityCode;
     
            BindCity1();
            lookUpEdit6.Text = localcityname;
            lookUpEdit6.EditValue = cityCode;
     
            BindRegionCombox();
            BindRegionCombox1();
     
            lookUpEdit1.Enabled = false;
            lookUpEdit2.Enabled = false;
            lookUpEdit5.Visible = false;
            lookUpEdit6.Visible = false;
     
            lookUpEdit1.Visible = false;
            lookUpEdit2.Visible = false;
            lookUpEdit5.Enabled = false;
            lookUpEdit6.Enabled = false;
     
            lookUpEdit1.Visible = true;
            lookUpEdit2.Visible = true;
            lookUpEdit5.Visible = true;
            lookUpEdit6.Visible = true;
        }
        else if (proCode != "" && cityCode == "" && CountyCode == "")
        {
            lookUpEdit1.Text = localPriname;
            lookUpEdit1.EditValue = proCode;
     
            lookUpEdit5.Text = localPriname;
            lookUpEdit5.EditValue = proCode;
     
            BindCity();
            BindCity1();
     
            lookUpEdit1.Enabled = false;
            lookUpEdit1.Visible = false;
            lookUpEdit1.Visible = true;
     
            lookUpEdit5.Enabled = false;
            lookUpEdit5.Visible = false;
            lookUpEdit5.Visible = true;
        }
     
        lookUpEdit4.Visible = false;
        lookUpEdit4.Visible = true;
     
        lookUpEdit7.Visible = false;
        lookUpEdit7.Visible = true;
    }
     
    private void From1_Load(object sender, EventArgs e)
    {
        ControlLocalSelect(Customer.ProvinceCode, Customer.CityCode, Customer.CountyCode);
    }
     
     
    private void BindCity()
    {
        lookUpEdit2.Properties.DisplayMember = "Corp_Town_Name";
        lookUpEdit2.Properties.ValueMember = "Corp_Town_Code";
     
        try
        {
            DataTable dt = rbll.GetCity1(lookUpEdit1.EditValue.ToString());
            DataRow dr = dt.NewRow();
            dr["Corp_Town_Code"] = -1;
            dr["Corp_Town_Name"] = "-全部选择-";
            dt.Rows.InsertAt(dr, 0);
            lookUpEdit2.Properties.DataSource = dt;
     
            if (Customer.CityCode != "")
            {
                lookUpEdit2.Text = cbll.GetCityName(Customer.CityCode);
                lookUpEdit2.EditValue = Customer.CityCode;
            }
        }
        catch (Exception ex)
        {
            XtraMessageBox.Show("绑定城市列表失败:" + ex.Message, "友情提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
  • 相关阅读:
    leetcode刷题29
    leetcode刷题28
    leetcode刷题27
    leetcode刷题23
    leetcode刷题22
    leetcode刷题21
    leetcode刷题20
    Unity中通过DoTween实现转盘效果
    U3D工作注意事项,不要再犯!
    Unity中String字符串的优化
  • 原文地址:https://www.cnblogs.com/Hsppl/p/2599185.html
Copyright © 2020-2023  润新知