protected void BindCarTeamsBySearh() { //生成车队类 EyouSoft.Model.SupplierStructure.SupplierCarTeam carTeam = new EyouSoft.Model.SupplierStructure.SupplierCarTeam(); //生成查询条件方法 EyouSoft.Model.SupplierStructure.SupplierCarTeamSearchInfo searInfo = new EyouSoft.Model.SupplierStructure.SupplierCarTeamSearchInfo(); #region 控件赋值 string carType = Server.UrlDecode(Utils.GetQueryStringValue("cartype")); string carName = Server.UrlDecode(Utils.GetQueryStringValue("carname")); int cityId = Utils.GetInt(Utils.GetQueryStringValue("cityId")); int provinceId = Utils.GetInt(Utils.GetQueryStringValue("proid")); this.ucProvince1.ProvinceId = provinceId; this.ucCity1.ProvinceId = provinceId; this.ucCity1.CityId = cityId; this.car_type.Value = carType; this.carTeam_name.Value = carName; #endregion searInfo.CarType = carType; searInfo.CityId = cityId; searInfo.Name = carName; searInfo.ProvinceId = provinceId; IList <EyouSoft.Model.SupplierStructure.SupplierCarTeam> carTeams = carTeamManager.GetCarTeams(CurrentUserCompanyID, pageSize, pageIndex, ref recordCount, searInfo); this.rptList.DataSource = carTeams; this.rptList.DataBind(); BindExportPage(); }
/// <summary> /// 初始化省市 /// </summary> /// <param name="cid"></param> protected void InitPorAndCity(int cid) { EyouSoft.Model.SupplierStructure.SupplierCarTeam carTeam = new EyouSoft.Model.SupplierStructure.SupplierCarTeam(); carTeam = carTeamBll.GetCarTeamInfo(cid); this.ucCity1.CityId = carTeam.CityId; this.ucProvince1.ProvinceId = carTeam.ProvinceId; this.ucCity1.ProvinceId = carTeam.ProvinceId; }
/// <summary> /// 初始化页面的数据 /// </summary> /// <param name="cid"></param> protected void DataInit(int cid) { EyouSoft.Model.SupplierStructure.SupplierCarTeam carTeam = carTeamBll.GetCarTeamInfo(cid); if (carTeam.Id != 0) { this.companyName.Value = carTeam.UnitName; this.companyAddress.Value = carTeam.UnitAddress; this.companyRemark.Value = carTeam.Remark; linkmans = carTeam.SupplierContact; BindLiknMan(carTeam.SupplierContact); BindCarInfo(carTeam.CarsInfo); } }
/// <summary> /// 更新车队供应商信息,正值时成功,负值或0时失败 /// </summary> /// <param name="info">车队供应商信息业务实体</param> /// <returns>正值:成功 负值或0:失败</returns> public int UpdateCarTeam(EyouSoft.Model.SupplierStructure.SupplierCarTeam info) { if (info.Id < 1) { return(0); } using (TransactionScope AddTran = new TransactionScope()) { bool dalResult = false; EyouSoft.BLL.CompanyStructure.SupplierBaseHandle basicbll = new EyouSoft.BLL.CompanyStructure.SupplierBaseHandle(); int updateBasicinfoResult = basicbll.UpdateSupplierBase(info); basicbll = null; if (updateBasicinfoResult != 1) { return(-1); } dalResult = dal.UpdateCarTeamAttach(info); if (!dalResult) { return(-2); } dalResult = dal.DeleteCars(info.Id); if (!dalResult) { return(-4); } dalResult = dal.InsertCars(info.Id, info.CarsInfo); if (!dalResult) { return(-3); } AddTran.Complete(); } return(1); }
/// <summary> /// 获取车队供应商信息(含车辆信息集合,不含供应商基本信息) /// </summary> /// <param name="supplierId">供应商编号</param> /// <returns></returns> public EyouSoft.Model.SupplierStructure.SupplierCarTeam GetCarTeamAttachInfo(int supplierId) { EyouSoft.Model.SupplierStructure.SupplierCarTeam info = null; DbCommand cmd = this._db.GetSqlStringCommand(SQL_SELECT_GetCarTeamAttachInfo); this._db.AddInParameter(cmd, "SupplierId", DbType.Int32, supplierId); using (IDataReader rdr = DbHelper.ExecuteReader(cmd, this._db)) { if (rdr.Read()) { info = new EyouSoft.Model.SupplierStructure.SupplierCarTeam() { Id = supplierId, CarsInfo = new List <EyouSoft.Model.SupplierStructure.SupplierCarInfo>() }; } if (info != null && rdr.NextResult()) { while (rdr.Read()) { info.CarsInfo.Add(new EyouSoft.Model.SupplierStructure.SupplierCarInfo() { CarType = rdr["CarType"].ToString(), CarNumber = rdr["CarNumber"].ToString(), Image = rdr["Image"].ToString(), Price = rdr.IsDBNull(rdr.GetOrdinal("Price")) ? 0 : rdr.GetDecimal(rdr.GetOrdinal("Price")), DriverName = rdr["DriverName"].ToString(), DriverPhone = rdr["DriverPhone"].ToString(), GuideWord = rdr["GuideWord"].ToString(), PrivaderId = rdr.IsDBNull(rdr.GetOrdinal("PrivaderId")) ? 0 : (rdr.GetOrdinal("PrivaderId")) }); } } } return(info); }
/// <summary> /// 写入车队供应商信息,正值时成功,负值或0时失败 /// </summary> /// <param name="info">车队供应商信息业务实体</param> /// <returns>正值:成功 负值或0:失败</returns> public int InsertCarTeamInfo(EyouSoft.Model.SupplierStructure.SupplierCarTeam info) { if (info != null) { if (info.CompanyId == 0) { return(-1); } using (TransactionScope AddTran = new TransactionScope()) { bool dalResult = false; EyouSoft.BLL.CompanyStructure.SupplierBaseHandle basicbll = new EyouSoft.BLL.CompanyStructure.SupplierBaseHandle(); info.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.车队; info.Id = basicbll.AddSupplierBase(info); basicbll = null; if (info.Id < 1) { return(-1); } dalResult = dal.AddCarTeamAttach(info); if (!dalResult) { return(-2); } dalResult = dal.InsertCars(info.Id, info.CarsInfo); if (!dalResult) { return(-3); } AddTran.Complete(); } } return(1); }
/// <summary> /// 获取车队供应商信息业务实体 /// </summary> /// <param name="supplierId">供应商编号</param> /// <returns></returns> public EyouSoft.Model.SupplierStructure.SupplierCarTeam GetCarTeamInfo(int supplierId) { if (supplierId < 1) { return(null); } EyouSoft.Model.SupplierStructure.SupplierCarTeam info = dal.GetCarTeamAttachInfo(supplierId); EyouSoft.BLL.CompanyStructure.SupplierBaseHandle basicbll = new EyouSoft.BLL.CompanyStructure.SupplierBaseHandle(); EyouSoft.Model.CompanyStructure.SupplierBasic basicinfo = basicbll.GetSupplierBase(supplierId); basicbll = null; if (basicinfo != null && info != null) { info.CityId = basicinfo.CityId; info.CityName = basicinfo.CityName; info.CompanyId = basicinfo.CompanyId; info.Id = basicinfo.Id; info.IsDelete = basicinfo.IsDelete; info.IssueTime = basicinfo.IssueTime; info.OperatorId = basicinfo.OperatorId; info.ProvinceId = basicinfo.ProvinceId; info.ProvinceName = basicinfo.ProvinceName; info.Remark = basicinfo.Remark; info.SupplierContact = basicinfo.SupplierContact; info.SupplierPic = basicinfo.SupplierPic; info.SupplierType = basicinfo.SupplierType; info.TradeNum = basicinfo.TradeNum; info.UnitAddress = basicinfo.UnitAddress; info.UnitName = basicinfo.UnitName; return(info); } return(null); }
protected void btnSave_Click1(object sender, EventArgs e) { #region 数据验证 string msg = "请选择图片文件"; if (!EyouSoft.Common.Function.UploadFile.CheckFileType(Request.Files, "car_img", new[] { ".jpg", ".png", ".gif", ".bmp", ".jpeg" }, null, out msg)) { EyouSoft.Common.Function.MessageBox.ResponseScript(this, Utils.ShowMsg("请选择图片文件上传!")); return; } #endregion //创建车辆信息类 //创建车队信息类 EyouSoft.Model.SupplierStructure.SupplierCarTeam carTeam = new EyouSoft.Model.SupplierStructure.SupplierCarTeam(); if (Utils.GetInt(Utils.GetQueryStringValue("cid")) != 0) { carTeam = carTeamBll.GetCarTeamInfo(cid); } //获取页面上所有联系人的信息 IList <EyouSoft.Model.CompanyStructure.SupplierContact> contacts = new List <EyouSoft.Model.CompanyStructure.SupplierContact>(); string[] linkman_names = Utils.GetFormValues("linkman_name"); string[] linkman_bussiness = Utils.GetFormValues("linkman_bussiness"); string[] linkman_phone = Utils.GetFormValues("linkman_phone"); string[] linkman_tel = Utils.GetFormValues("linkman_tel"); string[] linkman_qq = Utils.GetFormValues("linkman_qq"); string[] linkman_email = Utils.GetFormValues("linkman_email"); string[] linkman_fax = Utils.GetFormValues("linkman_fax"); //判断页面上添加联系人的数量 if (linkman_names.Length >= 1) { for (int i = 0; i < linkman_names.Length; i++) { //创建供应商联系人类 EyouSoft.Model.CompanyStructure.SupplierContact contact = new EyouSoft.Model.CompanyStructure.SupplierContact(); contact.QQ = linkman_qq[i]; contact.Email = linkman_email[i]; contact.ContactName = linkman_names[i]; contact.ContactMobile = linkman_phone[i]; contact.ContactTel = linkman_tel[i]; contact.JobTitle = linkman_bussiness[i]; contact.ContactFax = linkman_fax[i]; contacts.Add(contact); } } //获取页面上所有车辆的信息 IList <EyouSoft.Model.SupplierStructure.SupplierCarInfo> carInfos = new List <EyouSoft.Model.SupplierStructure.SupplierCarInfo>(); string[] car_types = Utils.GetFormValues("car_type"); string[] car_nums = Utils.GetFormValues("car_num"); string[] car_prices = Utils.GetFormValues("car_price"); string[] car_drivers = Utils.GetFormValues("car_driver"); string[] car_driverPhones = Utils.GetFormValues("car_driverPhone"); string[] car_worlds = Utils.GetFormValues("car_world"); string[] hid_img = Utils.GetFormValues("hid_img"); //判断页面上的添加车辆的数量 if (car_types.Length >= 1) { for (int i = 0; i < car_types.Length; i++) { EyouSoft.Model.SupplierStructure.SupplierCarInfo carInfo = new EyouSoft.Model.SupplierStructure.SupplierCarInfo(); string imagePath = ""; string imgName = ""; EyouSoft.Common.Function.UploadFile.FileUpLoad(Request.Files[i], "CarFile", out imagePath, out imgName); carInfo.CarNumber = car_nums[i]; carInfo.CarType = car_types[i]; carInfo.DriverName = car_drivers[i]; carInfo.DriverPhone = car_driverPhones[i]; carInfo.GuideWord = car_worlds[i]; if (imagePath == "" && hid_img[i] != "") { carInfo.Image = hid_img[i]; } else { carInfo.Image = imagePath; } carInfo.Price = Utils.GetDecimal(car_prices[i], 0); carInfo.PrivaderId = SiteUserInfo.CompanyID; carInfos.Add(carInfo); } } carTeam.CarsInfo = carInfos; carTeam.SupplierContact = contacts; carTeam.Remark = Utils.GetFormValue("companyRemark"); carTeam.UnitAddress = Utils.GetFormValue("companyAddress"); carTeam.UnitName = Utils.GetFormValue("companyName"); carTeam.CityId = Utils.GetInt(this.city_id.Value); carTeam.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.车队; carTeam.CompanyId = SiteUserInfo.CompanyID; carTeam.ProvinceId = Utils.GetInt(this.pro_id.Value); //设置车队信息的省份名字 EyouSoft.Model.CompanyStructure.Province Provincemodel = new EyouSoft.BLL.CompanyStructure.Province().GetModel(this.ucProvince1.ProvinceId); if (Provincemodel != null) { carTeam.ProvinceName = Provincemodel.ProvinceName; } //设置车队信息的城市名字 EyouSoft.Model.CompanyStructure.City citymodel = new EyouSoft.BLL.CompanyStructure.City().GetModel(this.ucCity1.CityId); if (citymodel != null) { carTeam.CityName = citymodel.CityName; } int result = 0; if (Utils.GetInt(Utils.GetQueryStringValue("cid")) != 0) { result = carTeamBll.UpdateCarTeam(carTeam); } else { result = carTeamBll.InsertCarTeamInfo(carTeam); } if (result > 0) { MessageBox.ResponseScript(this, string.Format(";alert('{0}');window.parent.location='/SupplierControl/CarsManager/CarsList.aspx';window.parent.Boxy.getIframeDialog('{1}').hide()", "保存成功", Utils.GetQueryStringValue("iframeId"))); } else { MessageBox.ResponseScript(this, ";alert('保存失败!');"); } }
private void loadXls() { //取得数据源 string data = Utils.GetFormValue("dataxls"); //对数据源分割处理 string[] s = data.Split(';'); EyouSoft.BLL.SupplierStructure.SupplierCarTeam carTeamBll = new EyouSoft.BLL.SupplierStructure.SupplierCarTeam(); IList <EyouSoft.Model.SupplierStructure.SupplierCarTeam> list = new List <EyouSoft.Model.SupplierStructure.SupplierCarTeam>(); //为list集合赋值 for (int i = 0; i < s.Length; i++) { string[] smodel = s[i].Split(','); if (smodel.Length == 17 && !string.IsNullOrEmpty(smodel[0]) && !string.IsNullOrEmpty(smodel[1]) && !string.IsNullOrEmpty(smodel[2])) { EyouSoft.Model.SupplierStructure.SupplierCarTeam carteamInfo = new EyouSoft.Model.SupplierStructure.SupplierCarTeam(); EyouSoft.Model.CompanyStructure.SupplierContact contact = new EyouSoft.Model.CompanyStructure.SupplierContact(); EyouSoft.Model.SupplierStructure.SupplierCarInfo carInfo = new EyouSoft.Model.SupplierStructure.SupplierCarInfo(); IList <EyouSoft.Model.SupplierStructure.SupplierCarInfo> carInfos = new List <EyouSoft.Model.SupplierStructure.SupplierCarInfo>(); IList <EyouSoft.Model.CompanyStructure.SupplierContact> contacts = new List <EyouSoft.Model.CompanyStructure.SupplierContact>(); carteamInfo.ProvinceName = HttpUtility.UrlDecode(smodel[0]); carteamInfo.CityName = HttpUtility.UrlDecode(smodel[1]); carteamInfo.UnitName = HttpUtility.UrlDecode(smodel[2]); carteamInfo.UnitAddress = HttpUtility.UrlDecode(smodel[3]); carInfo.GuideWord = HttpUtility.UrlDecode(smodel[4]); contact.ContactName = HttpUtility.UrlDecode(smodel[5]); contact.JobTitle = HttpUtility.UrlDecode(smodel[6]); contact.ContactTel = HttpUtility.UrlDecode(smodel[7]); contact.ContactMobile = HttpUtility.UrlDecode(smodel[8]); contact.QQ = HttpUtility.UrlDecode(smodel[9]); contact.Email = HttpUtility.UrlDecode(smodel[10]); carInfo.CarType = HttpUtility.UrlDecode(smodel[11]); carInfo.CarNumber = HttpUtility.UrlDecode(smodel[12]); carInfo.Price = Utils.GetDecimal(HttpUtility.UrlDecode(smodel[13])); carInfo.DriverName = HttpUtility.UrlDecode(smodel[14]); carInfo.DriverPhone = HttpUtility.UrlDecode(smodel[15]); carteamInfo.Remark = HttpUtility.UrlDecode(smodel[16]); carteamInfo.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.车队; carteamInfo.TradeNum = 0; carteamInfo.CompanyId = SiteUserInfo.CompanyID; carInfos.Add(carInfo); contacts.Add(contact); carteamInfo.CarsInfo = carInfos; carteamInfo.SupplierContact = contacts; list.Add(carteamInfo); } } int res = 0; //导入从excel获得数据 res = carTeamBll.InsertCarTeams(list); bool result = false; if (res > 0) { result = true; } Response.Clear(); Response.Write(string.Format("{{\"res\":{0}}}", result ? 1 : -1)); Response.End(); }
/// <summary> /// 修改供应商车队信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateCarTeamAttach(EyouSoft.Model.SupplierStructure.SupplierCarTeam model) { return(true); }