Ejemplo n.º 1
0
 public void CustomerLoad(int provinceId, int cityId, string pageIndexAndCount)
 {
     try
     {
         //ResultModelOfArrayOfModel_Customerd4FqxSXX count = cs.GetCustomerListByRole(Enum_Role.Receiver, true, provinceId, true, cityId, true, null);
         //winFormPager1.DrawControl(count.Data.Count<Model_Customer>());
         ResultModelOfint result = cs.GetCustomerListByRoleCount(Enum_Role.Receiver, true, provinceId, true, cityId, true);
         winFormPager1.DrawControl(result.Data);
         ResultModelOfArrayOfModel_Customerd4FqxSXX customer = cs.GetCustomerListByRole(Enum_Role.Receiver, true, provinceId, true, cityId, 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;
                 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);
     }
 }