private void setNewValue(Company company) { if (!string.IsNullOrEmpty(company.CompanyName)) this.CompanyName = company.CompanyName; if (!string.IsNullOrEmpty(company.CompanyAddress)) this.CompanyAddress = company.CompanyAddress; if (!string.IsNullOrEmpty(company.CompanyPost)) this.CompanyPost = company.CompanyPost; if (!string.IsNullOrEmpty(company.JuridicalPerson)) this.JuridicalPerson = company.JuridicalPerson; if (!string.IsNullOrEmpty(company.JuridicalPersonSex)) this.JuridicalPersonSex = company.JuridicalPersonSex; if (!string.IsNullOrEmpty(company.JuridicalPersonAge)) this.JuridicalPersonAge = company.JuridicalPersonAge; if (!string.IsNullOrEmpty(company.JuridicalPersonJob)) this.JuridicalPersonJob = company.JuridicalPersonJob; if (!string.IsNullOrEmpty(company.Mobile)) this.Mobile = company.Mobile; if (!string.IsNullOrEmpty(company.Tel)) this.Tel = company.Tel; }
/// <summary> /// 根据名称更新企业信息 /// </summary> /// <param name="company">企业对象</param> internal void UpdateCompanyByName(Company company) { if (company.CompanyName == "") return; Company databaseCompany = null; using (IDataReader reader = DB.Select(DataBases.Company).Where(DataBases.Company.CompanyName == company.CompanyName).ToDataReader()) { if (reader.Read()) { databaseCompany = ReadRow(reader); } } if (databaseCompany != null) { databaseCompany.setNewValue(company); databaseCompany.SystemService = this.SystemService; databaseCompany.SQLtransaction = this.SQLtransaction; databaseCompany.Update(); } else { company.SystemService = this.SystemService; company.SQLtransaction = this.SQLtransaction; company.Update(); } }
/// <summary> /// 危险化学品经营许可表 /// </summary> /// <param name="CompanyID">基本信息表编号</param> /// <returns>实体</returns> internal CompanyDangerChemicals CompanyDangerChemicalsGetOne(int CompanyID) { CompanyDangerChemicals Company = new CompanyDangerChemicals(); SelectSqlSection section = DB.Select(DataBases.CompanyDangerChemicals, DataBases.CompanyDangerChemicals.ID.Count()); if (CompanyID >=0) { section.Where(DataBases.CompanyDangerChemicals.CompanyID == CompanyID); } int count = Convert.ToInt32(section.ToScalar()); if (count > 0) { section = DB.Select(DataBases.CompanyDangerChemicals); if (CompanyID >= 0) { section.Where(DataBases.CompanyDangerChemicals.CompanyID == CompanyID); } //section.SetSelectRange(pageSize, (pageSize * (page - 1)), DataBases.CompanyDangerChemicals.ID); using (IDataReader reader = section.ToDataReader()) { while (reader.Read()) { Company = ReadRow(reader); break; } } if (Company.CompanyID >= 0) { SelectSqlSection sectionCompany = DB.Select(DataBases.Company).Where(DataBases.Company.CompanyID == CompanyID); using (IDataReader readerCompany = sectionCompany.ToDataReader()) { while (readerCompany.Read()) { Company.Company.CompanyAddress = readerCompany["CompanyAddress"].ToString(); Company.Company.CompanyID = Convert.ToInt32(readerCompany["CompanyID"].ToString()); Company.Company.CompanyName = readerCompany["CompanyName"].ToString(); Company.Company.CompanyPost = readerCompany["CompanyPost"].ToString(); Company.Company.JuridicalPerson = readerCompany["JuridicalPerson"].ToString(); Company.Company.JuridicalPersonAge = readerCompany["JuridicalPersonAge"].ToString(); Company.Company.JuridicalPersonJob = readerCompany["JuridicalPersonJob"].ToString(); Company.Company.JuridicalPersonSex = readerCompany["JuridicalPersonSex"].ToString(); Company.Company.Mobile = readerCompany["Mobile"].ToString(); Company.Company.Tel = readerCompany["Tel"].ToString(); Company.Company.IsCity = Convert.ToInt32(readerCompany["IsCity"].ToString()); Company.Company.CompanyAreaID = Convert.ToInt32(readerCompany["CompanyAreaID"].ToString()); } } } } return Company; }
private void buttonOK_Click(object sender, EventArgs e) { if (Convert.ToInt32(((ComboBoxItemTextValue)(this.comboBox1.SelectedItem)).selectValue) == -1) { CommonInvoke.MessageBox("请选择类型!"); return; } if (Convert.ToInt32(((ComboBoxItemTextValue)(this.comboBox3.SelectedItem)).selectValue) == -1) { CommonInvoke.MessageBox("请选择区域!"); return; } string path = Application.StartupPath + @"\" + this.txtPath.Text.Trim(); if (!File.Exists(path)) { CommonInvoke.MessageBox("文件不存在,请重新选择!"); return; } DataTable dt = ExcelToTable(path); for (int j = 0; j < dt.Rows.Count; j++) { Company Company = new SOA.ORM.Company(); Company.CompanyName = dt.Rows[j][0].ToString(); Company.JuridicalPerson = dt.Rows[j][1].ToString(); Company.JuridicalPersonSex = dt.Rows[j][2].ToString(); Company.IDCard = dt.Rows[j][3].ToString(); Company.JuridicalPersonJob = dt.Rows[j][4].ToString(); Company.Mobile = dt.Rows[j][5].ToString(); Company.CompanyAddress = dt.Rows[j][6].ToString(); Company.CompanyPost = dt.Rows[j][7].ToString(); Company.BusinessMode = dt.Rows[j][8].ToString(); Company.WarehousAddress = dt.Rows[j][9].ToString(); Company.PermitRange = dt.Rows[j][10].ToString(); Company.PermitValid = dt.Rows[j][11].ToString(); Company.IsCity = 1; Company.CompanyType = Convert.ToInt32(((ComboBoxItemTextValue)(this.comboBox1.SelectedItem)).selectValue); Company.CompanyAreaID = Convert.ToInt32(((ComboBoxItemTextValue)(this.comboBox3.SelectedItem)).selectValue); EList<Company> CompanyList = InvokeUtil.SystemService.CompanyGetAllByName(Company.CompanyName); if (CompanyList.Items.Count <= 0) { InvokeUtil.SystemService.EntityUpdate(Company); } } CommonInvoke.MessageBox("操作成功!"); }
/// <summary> /// 获取公司信息结合 /// </summary> /// <param name="page">分页</param> /// <param name="pageSize"></param> /// <param name="name">名称</param> /// <param name="CompanyType">类型</param> /// <param name="CompanyArea">区域</param> /// <param name="IsCity">是否市级</param> /// <returns></returns> public EList<Company> CompanyNewGetAll(int page, int pageSize, string name, int CompanyType, int CompanyArea, int IsCity) { try { Company Obj = new Company(); Obj.SystemService = this; return Obj.CompanyNewGetAll(page, pageSize, name, CompanyType, CompanyArea, IsCity); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取公司信息结合 /// </summary> /// <param name="name">名称</param> /// <returns></returns> public EList<Company> CompanyGetAllByName(string name) { try { Company Obj = new Company(); Obj.SystemService = this; return Obj.CompanyGetAllByName(name); } catch (Exception ex) { throw ex; } }