private void dgvProvinceInfo_CellClick(object sender, DataGridViewCellEventArgs e) { //填写的数据,没有点击保存就点击其他行,需提示 if (ls_falg == true) { string no = dgvProvinceInfo.CurrentRow.Cells["ProvinceNo"].Value.ToString();//获取国家no m_province mp = wcf.GetProvinceByNo(no); SetData(mp);//国家赋值 this.txtnameen.Text = dgvProvinceInfo.CurrentRow.Cells["Name_en"].Value.ToString();//英文名 this.txtnamecn.Text = dgvProvinceInfo.CurrentRow.Cells["Name_cn"].Value.ToString();//中文 this.txtProvince_ab.Text = dgvProvinceInfo.CurrentRow.Cells["Province_ab"].Value.ToString();//简称 } }
//获取省份信息根据省份no信息 public m_province GetProvinceByNo(string no) { using (var _DataEntities = new ntasystemEntities()) { return _DataEntities.m_province.FirstOrDefault(p => p.No == no); } }
//cmb赋值 private void SetData(m_province model) { if (wcf.GetCountryList(model.Country_no, string.Empty, string.Empty).ToList().Count > 0) { if (Helper.GlobalVariables.Gi_Language_Type == 1) { this.cmbCountryNo.Text = wcf.GetCountryList(model.Country_no, string.Empty, string.Empty).ToList()[0].Name_cn; } else { this.cmbCountryNo.Text = wcf.GetCountryList(model.Country_no, string.Empty, string.Empty).ToList()[0].Name_en; } } else { this.cmbCountryNo.Text = ""; } }