Пример #1
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 public void getCustomerLoad(int provinceId, int cityId, int county, string pageIndexAndCount)
 {
     try
     {
         //ResultModelOfArrayOfModel_Customerd4FqxSXX count = cs.GetCustomerListByRole(Enum_Role.Sender, true, provinceId, true, cityId, true, null);
         //ResultModelOfint result = cs.GetCustomerListByRoleCount(Enum_Role.Sender, true, provinceId, true, cityId, true);
         //winFormPager1.DrawControl(count.Data.Count<Model_Customer>());
         //ResultModelOfArrayOfModel_Customerd4FqxSXX customer = cs.GetCustomerListByRole(Enum_Role.Sender, true, provinceId, true, cityId, true, pageIndexAndCount);
         ResultModelOfint result = cs.GetCustomerListByCountyCount(Enum_Role.Sender, true, provinceId, true, cityId, true, county, true);
         winFormPager1.DrawControl(result.Data);
         ResultModelOfArrayOfModel_Customerd4FqxSXX customer = cs.GetCustomerListByCounty(Enum_Role.Sender, true, provinceId, true, cityId, true, county, true, pageIndexAndCount);
         //if (count.Data.Count<Model_Customer>()<=0)
         if (result.Data <= 0)
         {
             contextMenuStrip1.Enabled = false;
         }
         else
         {
             contextMenuStrip1.Enabled = true;
         }
         if (customer.Code != 0)
         {
             MessageBox.Show(customer.Message);
         }
         else
         {
             dataGridView1.AutoGenerateColumns = false;
             dataGridView1.Rows.Clear();
             foreach (Model_Customer item in customer.Data)
             {
                 int rowIndex = dataGridView1.Rows.Add();
                 dataGridView1.Rows[rowIndex].Cells[0].Value = item.Idk__BackingField;
                 dataGridView1.Rows[rowIndex].Cells[1].Value = item.FullNamek__BackingField;
                 dataGridView1.Rows[rowIndex].Cells[2].Value = item.ContactPersonk__BackingField;
                 dataGridView1.Rows[rowIndex].Cells[3].Value = item.Accountk__BackingField;
                 dataGridView1.Rows[rowIndex].Cells[4].Value = item.ContactTelk__BackingField;
                 dataGridView1.Rows[rowIndex].Cells[5].Value = item.ProvinceNamek__BackingField + "-" + item.CityNamek__BackingField + "-" + item.CountyNamek__BackingField;
                 dataGridView1.Rows[rowIndex].Cells[6].Value = item.ContactAddressk__BackingField;
                 dataGridView1.Rows[rowIndex].Cells[7].Value = item.CreateAtk__BackingField.ToString("yyyy-MM-dd HH:mm:ss");
                 if (item.Activedk__BackingField == Enum_Active.Enabled)
                 {
                     dataGridView1.Rows[rowIndex].Cells[8].Value = "启用";
                 }
                 else
                 {
                     dataGridView1.Rows[rowIndex].Cells[8].Value = "停用";
                 }
                 dataGridView1.Rows[rowIndex].Cells[9].Value = item.Remarkk__BackingField.Split('|')[1];
                 dataGridView1.Rows[rowIndex].Tag            = item;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }