private void loadXls() { string data = Utils.GetFormValue("dataxls"); string[] s = data.Split(';'); EyouSoft.BLL.SupplierStructure.SupplierOther ssBLL = new EyouSoft.BLL.SupplierStructure.SupplierOther(); List <EyouSoft.Model.SupplierStructure.SupplierOther> list = new List <EyouSoft.Model.SupplierStructure.SupplierOther>(); for (int i = 0; i < s.Length; i++) { string[] smodel = s[i].Split(','); if (smodel.Length == 11 && !string.IsNullOrEmpty(smodel[0]) && !string.IsNullOrEmpty(smodel[1]) && !string.IsNullOrEmpty(smodel[2])) { EyouSoft.Model.SupplierStructure.SupplierOther ssModel = new EyouSoft.Model.SupplierStructure.SupplierOther(); ssModel.ProvinceName = HttpUtility.UrlDecode(smodel[0]); ssModel.CityName = HttpUtility.UrlDecode(smodel[1]); ssModel.UnitName = HttpUtility.UrlDecode(smodel[2]); ssModel.UnitAddress = HttpUtility.UrlDecode(smodel[3]); ssModel.OperatorId = SiteUserInfo.ID; ssModel.IssueTime = DateTime.Now; ssModel.CompanyId = CurrentUserCompanyID; ssModel.AgreementFile = string.Empty; ssModel.IsDelete = false; ssModel.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.其他; ssModel.TradeNum = 0; ssModel.SupplierContact = new List <EyouSoft.Model.CompanyStructure.SupplierContact>(); EyouSoft.Model.CompanyStructure.SupplierContact scModel = new EyouSoft.Model.CompanyStructure.SupplierContact(); scModel.ContactName = HttpUtility.UrlDecode(smodel[4]); //姓名 scModel.JobTitle = HttpUtility.UrlDecode(smodel[5]); //职务 scModel.ContactTel = HttpUtility.UrlDecode(smodel[6]); //电话 scModel.ContactMobile = HttpUtility.UrlDecode(smodel[7]); //手机 scModel.QQ = HttpUtility.UrlDecode(smodel[8]); //QQ scModel.Email = HttpUtility.UrlDecode(smodel[9]); //email ssModel.SupplierContact.Add(scModel); ssModel.Remark = HttpUtility.UrlDecode(smodel[10]); list.Add(ssModel); } } bool res = ssBLL.ImportExcelData(list); Response.Clear(); Response.Write(string.Format("{{\"res\":{0}}}", res ? 1 : -1)); Response.End(); }
/// <summary> /// 导入 /// </summary> private void loadXls() { string data = Utils.GetFormValue("dataxls"); string[] s = data.Split(';'); EyouSoft.BLL.SupplierStructure.SupplierOther ssBLL = new EyouSoft.BLL.SupplierStructure.SupplierOther(); List <EyouSoft.Model.SupplierStructure.SupplierOther> list = new List <EyouSoft.Model.SupplierStructure.SupplierOther>(); for (int i = 0; i < s.Length; i++) { string[] smodel = s[i].Split(','); //判断输出要求 if (smodel.Length == 11 && !string.IsNullOrEmpty(smodel[0]) && !string.IsNullOrEmpty(smodel[1]) && !string.IsNullOrEmpty(smodel[2])) { //实例化Model EyouSoft.Model.SupplierStructure.SupplierOther ssModel = new EyouSoft.Model.SupplierStructure.SupplierOther(); //省份名称 ssModel.ProvinceName = HttpUtility.UrlDecode(smodel[0]); //城市名称 ssModel.CityName = HttpUtility.UrlDecode(smodel[1]); //单位名称 ssModel.UnitName = HttpUtility.UrlDecode(smodel[2]); //地址 ssModel.UnitAddress = HttpUtility.UrlDecode(smodel[3]); //操作人 ssModel.OperatorId = SiteUserInfo.ID; //添加时间 ssModel.IssueTime = DateTime.Now; //公司编号 ssModel.CompanyId = CurrentUserCompanyID; //合作协议 ssModel.AgreementFile = string.Empty; //是否删除 ssModel.IsDelete = false; //单位类型 ssModel.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.航空公司; //交易次数 ssModel.TradeNum = 0; //实例化供应商联系人列表 ssModel.SupplierContact = new List <EyouSoft.Model.CompanyStructure.SupplierContact>(); //实例化供应商Model EyouSoft.Model.CompanyStructure.SupplierContact scModel = new EyouSoft.Model.CompanyStructure.SupplierContact(); //联系人姓名 scModel.ContactName = HttpUtility.UrlDecode(smodel[4]); //联系人职务 scModel.JobTitle = HttpUtility.UrlDecode(smodel[5]); //联系人电话 scModel.ContactTel = HttpUtility.UrlDecode(smodel[6]); //联系人手机 scModel.ContactMobile = HttpUtility.UrlDecode(smodel[7]); //联系人QQ scModel.QQ = HttpUtility.UrlDecode(smodel[8]); //联系人邮箱 scModel.Email = HttpUtility.UrlDecode(smodel[9]);//email //联系人列表赋值 ssModel.SupplierContact.Add(scModel); //备注 ssModel.Remark = HttpUtility.UrlDecode(smodel[10]); //赋值list list.Add(ssModel); } } //导入并判断 bool res = ssBLL.ImportExcelData(list); //输出导入结果 Response.Clear(); Response.Write(string.Format("{{\"res\":{0}}}", res ? 1 : -1)); Response.End(); }