private void loadXls() { string data = Utils.GetFormValue("dataxls"); string[] s = data.Split(';'); EyouSoft.BLL.SupplierStructure.SupplierRestaurant srbll = new EyouSoft.BLL.SupplierStructure.SupplierRestaurant(); IList <EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo> srinfo = new List <EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo>(); for (int i = 0; i < s.Length; i++) { string[] smodel = s[i].Split(','); if (smodel.Length == 14 && !string.IsNullOrEmpty(smodel[0]) && !string.IsNullOrEmpty(smodel[1]) && !string.IsNullOrEmpty(smodel[2])) { EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo srModel = new EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo(); srModel.ProvinceName = HttpUtility.UrlDecode(smodel[0]); srModel.CityName = HttpUtility.UrlDecode(smodel[1]); srModel.UnitName = HttpUtility.UrlDecode(smodel[2]); srModel.Cuisine = HttpUtility.UrlDecode(smodel[3]); srModel.UnitAddress = HttpUtility.UrlDecode(smodel[4]); srModel.Introduce = HttpUtility.UrlDecode(smodel[5]); srModel.TourGuide = HttpUtility.UrlDecode(smodel[6]); srModel.SupplierContact = new List <EyouSoft.Model.CompanyStructure.SupplierContact>(); EyouSoft.Model.CompanyStructure.SupplierContact contect = new EyouSoft.Model.CompanyStructure.SupplierContact(); contect.ContactName = HttpUtility.UrlDecode(smodel[7]); contect.JobTitle = HttpUtility.UrlDecode(smodel[8]); contect.ContactTel = HttpUtility.UrlDecode(smodel[9]); contect.ContactMobile = HttpUtility.UrlDecode(smodel[10]); contect.QQ = HttpUtility.UrlDecode(smodel[11]); contect.Email = HttpUtility.UrlDecode(smodel[12]); contect.CompanyId = SiteUserInfo.CompanyID; srModel.SupplierContact.Add(contect); srModel.Remark = HttpUtility.UrlDecode(smodel[13]); srModel.OperatorId = SiteUserInfo.ID; srModel.IssueTime = DateTime.Now; srModel.CompanyId = CurrentUserCompanyID; srModel.AgreementFile = string.Empty; srModel.IsDelete = false; srModel.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.餐馆; srModel.TradeNum = 0; srModel.Commission = 0; srinfo.Add(srModel); } } int res = 0; res = srbll.InsertRestaurants(srinfo); Response.Clear(); Response.Write(string.Format("{{\"res\":{0}}}", res > 0 ? 1 : -1)); Response.End(); }
protected bool grantto = false; //导出 protected void Page_Load(object sender, EventArgs e) { //实例化餐馆业务逻辑类和实体类 Restaurantbll = new EyouSoft.BLL.SupplierStructure.SupplierRestaurant(); Restaurantinfo = new EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo(); //权限判断 if (!CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_栏目)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.供应商管理_餐馆_栏目, true); } grantadd = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_新增); grantdel = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_删除); grantmodify = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_修改); grantto = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_导出); grantload = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_导入); //初始化省份和城市 this.ucProvince1.CompanyId = CurrentUserCompanyID; this.ucProvince1.IsFav = true; this.ucCity1.CompanyId = CurrentUserCompanyID; this.ucCity1.IsFav = true; if (!this.Page.IsPostBack) { //操作权限 删除or导出excel action = Utils.GetQueryStringValue("action"); switch (action) { case "toexcel": { if (grantto) { CreateExcel("Restaurant" + DateTime.Now.ToShortDateString()); } } break; case "Restaurantdel": { if (grantdel) { RestaurantDel(); } } break; default: DataInit(); break; } } }
protected void Page_Load(object sender, EventArgs e) { //初始化业务逻辑类和实体类 RestaurantBll = new EyouSoft.BLL.SupplierStructure.SupplierRestaurant(); Restaurantinfo = new EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo(); //初始化城市和省份 this.ucProvince1.CompanyId = CurrentUserCompanyID; this.ucProvince1.IsFav = true; this.ucCity1.CompanyId = CurrentUserCompanyID; this.ucCity1.IsFav = true; if (!IsPostBack) { //判断权限 if (CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_栏目)) { type = Utils.GetQueryStringValue("type"); switch (type) { case "modify": if (CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_修改)) { bind(); } else { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.供应商管理_餐馆_修改, false); } break; case "show": show = true; bind(); break; default: if (!CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_新增)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.供应商管理_餐馆_新增, false); } break; } } } }