/// <summary> /// 获取我收藏的项目列表 /// </summary> /// <param name="context"></param> /// <returns></returns> public string GetAttentionProjectList(HttpContext context) { int pageIndex = int.Parse(context.Request["PageIndex"]); int pageSize = int.Parse(context.Request["PageSize"]); int totalCount = 0; StringBuilder sbWhere = new StringBuilder(string.Format(" UserId='{0}' And AttentionType=2", HttpContext.Current.Session[SessionKey.WanBangUserID].ToString())); totalCount = bll.GetCount <WBAttentionInfo>(sbWhere.ToString()); List <WBAttentionInfo> data = bll.GetLit <WBAttentionInfo>(pageSize, pageIndex, sbWhere.ToString(), "AutoID DESC"); List <WBProjectInfo> newData = new List <WBProjectInfo>(); foreach (var item in data) { WBProjectInfo model = bll.Get <WBProjectInfo>(string.Format("AutoID={0}", item.AttentionAutoID)); if (model != null) { model.UserId = null; model.WebsiteOwner = null; newData.Add(model); } } resp.ExObj = newData; resp.ExStr = ""; int totalpage = bll.GetTotalPage(totalCount, pageSize); if ((totalpage > pageIndex) && (pageIndex.Equals(1))) { resp.ExStr = "1";//是否增加下一页按钮 } return(Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 结束项目 /// </summary> /// <param name="context"></param> /// <returns></returns> public string EndProject(HttpContext context) { if (!DataLoadTool.CheckWanBangLogin()) { resp.Msg = "请先登录"; return(Common.JSONHelper.ObjectToJson(resp)); } int autoId = int.Parse(context.Request["AutoID"]); WBProjectInfo model = bll.Get <WBProjectInfo>(string.Format("AutoID={0} And UserId='{1}'", autoId, HttpContext.Current.Session[SessionKey.WanBangUserID].ToString())); if (model == null) { resp.Msg = "无效项目"; return(Common.JSONHelper.ObjectToJson(resp)); } model.Status = 2; if (bll.Update(model)) { resp.Status = 1; } else { resp.Msg = "操作失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 添加 /// </summary> /// <param name="context"></param> /// <returns></returns> public string AddProjectInfo(HttpContext context) { string userId = context.Request["UserId"]; string projectName = context.Request["ProjectName"]; string thumbnails = context.Request["Thumbnails"]; string area = context.Request["Area"]; string category = context.Request["Category"]; string logistics = context.Request["Logistics"]; string projectCycle = context.Request["ProjectCycle"]; string status = context.Request["Status"]; string timeRequirement = context.Request["TimeRequirement"]; string introduction = context.Request["Introduction"]; var CompanyModel = bll.Get <WBCompanyInfo>(string.Format("UserId='{0}'", userId)); if (CompanyModel == null) { resp.Status = 0; resp.Msg = "项目所属用户名不存在"; return(Common.JSONHelper.ObjectToJson(resp)); } WBProjectInfo model = new WBProjectInfo(); model.UserId = userId; model.ProjectName = projectName; model.Thumbnails = thumbnails; model.Area = area; model.Category = category; model.Logistics = int.Parse(logistics); model.ProjectCycle = int.Parse(projectCycle); model.Status = int.Parse(status); model.TimeRequirement = timeRequirement; model.Introduction = introduction; model.InsertDate = DateTime.Now; model.WebsiteOwner = bll.WebsiteOwner; if (bll.Add(model)) { resp.Status = 1; resp.Msg = "添加项目成功"; } else { resp.Msg = "添加项目失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
protected void Page_Load(object sender, EventArgs e) { webAction = Request["Action"]; actionStr = webAction == "add" ? "添加" : "编辑"; if (webAction == "edit") { model = bll.Get <WBProjectInfo>(string.Format("AutoID={0}", Convert.ToInt32(Request["id"]))); if (model == null) { Response.End(); } else { } } }
/// <summary> /// 编辑 /// </summary> /// <param name="context"></param> /// <returns></returns> public string EditProjectInfo(HttpContext context) { int autoId = int.Parse(context.Request["AutoID"]); string userId = context.Request["UserId"]; string projectName = context.Request["ProjectName"]; string thumbnails = context.Request["Thumbnails"]; string area = context.Request["Area"]; string category = context.Request["Category"]; string logistics = context.Request["Logistics"]; string projectCycle = context.Request["ProjectCycle"]; string status = context.Request["Status"]; string timeRequirement = context.Request["TimeRequirement"]; string introduction = context.Request["Introduction"]; var companyModel = bll.Get <WBCompanyInfo>(string.Format("UserId='{0}'", userId)); if (companyModel == null) { resp.Status = 0; resp.Msg = "项目所属用户名不存在"; return(Common.JSONHelper.ObjectToJson(resp)); } WBProjectInfo model = bll.Get <WBProjectInfo>(string.Format("AutoID={0}", autoId)); model.UserId = userId; model.ProjectName = projectName; model.Thumbnails = thumbnails; model.Area = area; model.Category = category; model.Logistics = int.Parse(logistics); model.ProjectCycle = int.Parse(projectCycle); model.Status = int.Parse(status); model.TimeRequirement = timeRequirement; model.Introduction = introduction; if (bll.Update(model)) { resp.Status = 1; resp.Msg = "更新项目信息成功"; } else { resp.Msg = "更新项目信息失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 编辑项目信息 /// </summary> /// <param name="context"></param> /// <returns></returns> public string EditProjectInfo(HttpContext context) { if (!DataLoadTool.CheckWanBangLogin()) { resp.Msg = "请先登录"; return(Common.JSONHelper.ObjectToJson(resp)); } int autoId = int.Parse(context.Request["AutoID"]); string projectName = context.Request["ProjectName"]; string thumbnails = context.Request["Thumbnails"]; //string Area = context.Request["Area"]; string category = context.Request["Category"]; string logistics = context.Request["Logistics"]; string projectCycle = context.Request["ProjectCycle"]; string timeRequirement = context.Request["TimeRequirement"]; string introduction = context.Request["Introduction"]; WBProjectInfo model = bll.Get <WBProjectInfo>(string.Format("AutoID={0} And UserId='{1}'", autoId, HttpContext.Current.Session[SessionKey.WanBangUserID].ToString())); if (model == null) { resp.Msg = "无效项目"; return(Common.JSONHelper.ObjectToJson(resp)); } model.ProjectName = projectName; //model.Thumbnails = Thumbnails; //model.Area = Area; model.Category = category; model.Logistics = int.Parse(logistics); model.ProjectCycle = int.Parse(projectCycle); model.TimeRequirement = timeRequirement; model.Introduction = introduction; if (bll.Update(model)) { resp.Status = 1; resp.Msg = "更新项目信息成功"; } else { resp.Msg = "更新项目信息失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 添加项目信息 /// </summary> /// <param name="context"></param> /// <returns></returns> public string AddProjectInfo(HttpContext context) { if (!DataLoadTool.CheckWanBangLogin()) { resp.Msg = "请先登录"; return(Common.JSONHelper.ObjectToJson(resp)); } string projectName = context.Request["ProjectName"]; string thumbnails = "/img/hb/hb5.jpg"; string area = context.Request["Area"]; string category = context.Request["Category"]; string logistics = context.Request["Logistics"]; string projectCycle = context.Request["ProjectCycle"]; string timeRequirement = context.Request["TimeRequirement"]; string introduction = context.Request["Introduction"]; WBProjectInfo model = new WBProjectInfo(); model.UserId = HttpContext.Current.Session[SessionKey.WanBangUserID].ToString(); model.ProjectName = projectName; model.Thumbnails = thumbnails; model.Area = bll.Get <WBCompanyInfo>(string.Format("UserId='{0}'", HttpContext.Current.Session[SessionKey.WanBangUserID].ToString())).Area; model.Category = category; model.Logistics = int.Parse(logistics); model.ProjectCycle = int.Parse(projectCycle); model.Status = 0; model.TimeRequirement = timeRequirement; model.Introduction = introduction; model.InsertDate = DateTime.Now; model.WebsiteOwner = bll.WebsiteOwner; if (bll.Add(model)) { resp.Status = 1; resp.Msg = "发布项目成功,请等待审核"; } else { resp.Msg = "发布项目失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
protected void Page_Load(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(Request["id"])) { Response.Write("无参数"); Response.End(); return; } model = bll.Get <WBProjectInfo>(string.Format("AutoId={0}", Request["id"])); if (model == null) { Response.Write("项目不存在"); Response.End(); return; } if (model.Status.Equals(0)) { Response.Write("项目正在审核中,暂时不能查看"); Response.End(); return; } companymodel = bll.Get <WBCompanyInfo>(string.Format("UserId='{0}'", model.UserId)); if (DataLoadTool.CheckWanBangLogin()) { IsLogin = true; if (bll.GetCount <WBAttentionInfo>(string.Format("UserId='{0}' And AttentionAutoID={1} And AttentionType={2}", HttpContext.Current.Session[SessionKey.WanBangUserID].ToString(), model.AutoID, 2)) > 0) { IsAttention = true; } } } catch (Exception) { Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (!DataLoadTool.CheckWanBangLogin()) { Response.Redirect(string.Format("/App/WanBang/Wap/Login.aspx?redirecturl={0}", Request.Url.PathAndQuery)); } if (HttpContext.Current.Session[SessionKey.WanBangUserType].ToString().Equals("0")) { Response.Write("<script>alert('只有企业用户可以发布项目');window.location.href='Index.aspx';</script>"); Response.End(); } if (Request["action"] != null && Request["action"].Equals("edit")) { model = bll.Get <WBProjectInfo>(string.Format("AutoId={0}", Request["id"])); if (model != null) { if (!model.UserId.Equals(HttpContext.Current.Session[SessionKey.WanBangUserID].ToString())) { Response.End(); } } } }