/// <summary> /// 获得数据列表 /// </summary> public List <DigiPower.Onlinecol.Standard.Model.T_Company_MDL> DataTableToList(DataTable dt) { List <DigiPower.Onlinecol.Standard.Model.T_Company_MDL> modelList = new List <DigiPower.Onlinecol.Standard.Model.T_Company_MDL>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { DigiPower.Onlinecol.Standard.Model.T_Company_MDL model; for (int n = 0; n < rowsCount; n++) { model = new DigiPower.Onlinecol.Standard.Model.T_Company_MDL(); if (dt.Rows[n]["CompanyID"].ToString() != "") { model.CompanyID = int.Parse(dt.Rows[n]["CompanyID"].ToString()); } model.AREA_CODE = dt.Rows[n]["AREA_CODE"].ToString(); model.CompanyName = dt.Rows[n]["CompanyName"].ToString(); model.CompanyCode = dt.Rows[n]["CompanyCode"].ToString(); model.CompanyNameEn = dt.Rows[n]["CompanyNameEn"].ToString(); if (dt.Rows[n]["CompanyType"].ToString() != "") { model.CompanyType = int.Parse(dt.Rows[n]["CompanyType"].ToString()); } model.Addres = dt.Rows[n]["Addres"].ToString(); model.ChargeUserName = dt.Rows[n]["ChargeUserName"].ToString(); model.CharegeID = dt.Rows[n]["CharegeID"].ToString(); model.ContactPerson = dt.Rows[n]["ContactPerson"].ToString(); model.Zipcode = dt.Rows[n]["Zipcode"].ToString(); model.Tel = dt.Rows[n]["Tel"].ToString(); model.Fax = dt.Rows[n]["Fax"].ToString(); model.Mobile = dt.Rows[n]["Mobile"].ToString(); model.EMail = dt.Rows[n]["EMail"].ToString(); model.Description = dt.Rows[n]["Description"].ToString(); if (dt.Rows[n]["IsCompany"].ToString() != "") { if ((dt.Rows[n]["IsCompany"].ToString() == "1") || (dt.Rows[n]["IsCompany"].ToString().ToLower() == "true")) { model.IsCompany = true; } else { model.IsCompany = false; } } if (dt.Rows[n]["CreateDate"].ToString() != "") { model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString()); } model.CreateIP = dt.Rows[n]["CreateIP"].ToString(); if (dt.Rows[n]["CreateUserID"].ToString() != "") { model.CreateUserID = int.Parse(dt.Rows[n]["CreateUserID"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(DigiPower.Onlinecol.Standard.Model.T_Company_MDL model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(DigiPower.Onlinecol.Standard.Model.T_Company_MDL model) { return(dal.Add(model)); }