//判断项目是否含有 预订产品,如果有 列表页面 显示出项目信息 internal int GetProjectUnyuding(int projectid) { string sql = "SELECT top 1 id FROM [b2b_com_project] where id=@projectid and id in (select projectid from b2b_com_pro where server_type=12) "; var cmd = sqlHelper.PrepareTextSqlCommand(sql); cmd.AddParam("@projectid", projectid); int unyuding = 0; try { using (var reader = cmd.ExecuteReader()) { B2b_com_project u = null; if (reader.Read()) { unyuding = reader.GetValue <int>("id"); } return(unyuding); } } catch { return(0); } }
public int EditProject(B2b_com_project model) { using (var helper = new SqlHelper()) { int id = new Internal_b2b_com_project(helper).EditProject(model); return(id); } }
internal B2b_com_project GetProject(int projectid, int comid) { string sql = "SELECT * FROM [EtownDB].[dbo].[b2b_com_project] where id=@projectid and comid=@comid"; var cmd = sqlHelper.PrepareTextSqlCommand(sql); cmd.AddParam("@projectid", projectid); cmd.AddParam("@comid", comid); using (var reader = cmd.ExecuteReader()) { B2b_com_project u = null; if (reader.Read()) { u = new B2b_com_project() { Id = reader.GetValue <int>("id"), Projectname = reader.GetValue <string>("projectname"), Projectimg = reader.GetValue <int>("projectimg"), Province = reader.GetValue <string>("province"), City = reader.GetValue <string>("city"), Industryid = reader.GetValue <int>("industryid"), Briefintroduce = reader.GetValue <string>("briefintroduce"), Address = reader.GetValue <string>("address"), Mobile = reader.GetValue <string>("mobile"), Coordinate = reader.GetValue <string>("coordinate"), Serviceintroduce = reader.GetValue <string>("serviceintroduce"), Onlinestate = reader.GetValue <string>("onlinestate"), Comid = reader.GetValue <int>("comid"), Createtime = reader.GetValue <DateTime>("createtime"), Createuserid = reader.GetValue <int>("createuserid"), hotelset = reader.GetValue <int>("hotelset"), grade = reader.GetValue <decimal>("grade"), star = reader.GetValue <string>("star"), parking = reader.GetValue <int>("parking"), cu = reader.GetValue <string>("cu"), }; } return(u); } }
protected void Page_Load(object sender, EventArgs e) { comid = Request["comid"].ConvertTo <int>(0); if (comid > 0) { B2b_company company = new B2bCompanyData().GetCompanyBasicById(comid); //判断公司是否含有项目,不含有的话,添加默认项目 int count = new B2b_com_projectData().GetProjectCountByComId(company.ID); if (count == 0) { B2b_company_info companyinfo = new B2bCompanyInfoData().GetCompanyInfo(company.ID); B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(company.ID.ToString()); B2b_com_project model = new B2b_com_project() { Id = 0, Projectname = company.Com_name, Projectimg = saleset.Logo.ConvertTo <int>(0), Province = companyinfo.Province.ConvertTo <string>(""), City = companyinfo.City, Industryid = company.Com_type, Briefintroduce = companyinfo.Scenic_intro, Address = companyinfo.Scenic_address, Mobile = companyinfo.Tel, Coordinate = "", Serviceintroduce = companyinfo.Serviceinfo, Onlinestate = "1", Comid = company.ID, Createtime = DateTime.Now, Createuserid = 0 }; int result = new B2b_com_projectData().EditProject(model); //设置公司下产品的项目id都改为默认项目id int result2 = new B2bComProData().UpProjectId(company.ID.ToString(), result); } } }
internal B2b_com_project GetProject(int projectid) { string sql = "SELECT createtime,createuserid, [id],[projectname] ,[projectimg],[province],[city],[industryid],[briefintroduce],[address],[mobile],[coordinate],[serviceintroduce],[onlinestate],comid,bindingprojectid FROM [b2b_com_project] where id=@projectid "; var cmd = sqlHelper.PrepareTextSqlCommand(sql); cmd.AddParam("@projectid", projectid); using (var reader = cmd.ExecuteReader()) { B2b_com_project u = null; if (reader.Read()) { u = new B2b_com_project() { Id = reader.GetValue <int>("id"), Projectname = reader.GetValue <string>("projectname"), Projectimg = reader.GetValue <int>("projectimg"), Province = reader.GetValue <string>("province"), City = reader.GetValue <string>("city"), Industryid = reader.GetValue <int>("industryid"), Briefintroduce = reader.GetValue <string>("briefintroduce"), Address = reader.GetValue <string>("address"), Mobile = reader.GetValue <string>("mobile"), Coordinate = reader.GetValue <string>("coordinate"), Serviceintroduce = reader.GetValue <string>("serviceintroduce"), Onlinestate = reader.GetValue <string>("onlinestate"), Comid = reader.GetValue <int>("comid"), Createtime = reader.GetValue <DateTime>("createtime"), Createuserid = reader.GetValue <int>("createuserid"), bindingprojectid = reader.GetValue <int>("bindingprojectid"), }; } return(u); } }
protected void Page_Load(object sender, EventArgs e) { if (UserHelper.ValidateLogin()) { comid = UserHelper.CurrentCompany.ID; } projectid = Request["projectid"].ConvertTo <int>(0); nowdate = DateTime.Now.ToString("yyyy-MM-dd"); monthdate = DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd"); proid = Request["proid"].ConvertTo <int>(0); servertype = Request["servertype"].ConvertTo <int>(1); if (proid > 0) { int bindingid = new B2bComProData().GetbindingidbyProid(proid); if (bindingid > 0) { new B2bComProData().Getsalenum(bindingid, out limitbuytotalnum, out buynum); } else { new B2bComProData().Getsalenum(proid, out limitbuytotalnum, out buynum); } } //产品主图片 BindHeadPortrait(proid); ShowImgBind(proid); //产品子级图片(多图片)上传 BindChildImg(proid); //获取所属行业 B2b_company_manageuser user = UserHelper.CurrentUser(); B2b_company company = UserHelper.CurrentCompany; var comdata = B2bCompanyData.GetCompany(company.ID); if (comdata != null) { industryid = comdata.Com_type; } //判断公司是否含有项目,不含有的话,添加默认项目 int count = new B2b_com_projectData().GetProjectCountByComId(company.ID); if (count == 0) { B2b_company_info companyinfo = new B2bCompanyInfoData().GetCompanyInfo(company.ID); B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(company.ID.ToString()); B2b_com_project model = new B2b_com_project() { Id = 0, Projectname = company.Com_name, Projectimg = saleset.Logo.ConvertTo <int>(0), Province = companyinfo.Province.ConvertTo <string>(""), City = companyinfo.City, Industryid = company.Com_type, Briefintroduce = companyinfo.Scenic_intro, Address = companyinfo.Scenic_address, Mobile = companyinfo.Tel, Coordinate = "", Serviceintroduce = companyinfo.Serviceinfo, Onlinestate = "1", Comid = company.ID, Createtime = DateTime.Now, Createuserid = 0 }; int result = new B2b_com_projectData().EditProject(model); //设置公司下产品的项目id都改为默认项目id int result2 = new B2bComProData().UpProjectId(company.ID.ToString(), result); } }
//导入项目列表,不用后删除或者隐藏 protected void Button2_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { byte[] fileBytes = FileUpload1.FileBytes; if (ExcelRender.HasData(new MemoryStream(fileBytes))) { Stream excelFileStream = new MemoryStream(fileBytes); int sheetIndex = 0; int headerRowIndex = 0; using (excelFileStream) { using (IWorkbook workbook = new HSSFWorkbook(excelFileStream)) { using (ISheet sheet = workbook.GetSheetAt(sheetIndex)) { StringBuilder builder = new StringBuilder(); IRow headerRow = sheet.GetRow(headerRowIndex); int cellCount = headerRow.LastCellNum; //LastCellNum = PhysicalNumberOfCells int rowCount = sheet.LastRowNum; //LastRowNum = PhysicalNumberOfRows - 1 for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++) { IRow row = sheet.GetRow(i); if (row != null) { string name = GetCellValue(row.GetCell(0));//项目名称 //判断项目中是否有同名的项目,有的话不在录入 object o = ExcelSqlHelper.ExecuteScalar("select count(1) from b2b_com_project where projectname='" + name + "'"); int c = o == null ? 0 : int.Parse(o.ToString()); if (c > 0) { } else { B2b_com_project model = new B2b_com_project { Id = 0, Projectname = name, Projectimg = 0, Province = "", City = "", Industryid = 0, Briefintroduce = "", Address = "", Mobile = "", Coordinate = "", Serviceintroduce = "", Onlinestate = "0", Comid = 106, Createuserid = UserHelper.CurrentUser().Id, Createtime = DateTime.Now }; int d = new B2b_com_projectData().EditProject(model); } } if (i == rowCount) { Literal1.Text = "导入完成"; } } } } } } } }