/// <summary> /// 编辑 /// </summary> /// <param name="context"></param> /// <returns></returns> public string EditJointProject(HttpContext context) { int autoId = int.Parse(context.Request["AutoID"]); string projectName = context.Request["ProjectName"]; string companyName = context.Request["CompanyName"]; string baseName = context.Request["BaseName"]; string thumbnails = context.Request["Thumbnails"]; WBJointProjectInfo model = bll.Get <WBJointProjectInfo>(string.Format("AutoID={0} And WebsiteOwner='{1}'", autoId, bll.WebsiteOwner)); //if (model==null) //{ // resp.Status = 0; // resp.Msg = "对接项目不存在"; // return Common.JSONHelper.ObjectToJson(resp); //} //var CompanyModel = bll.Get<WBCompanyInfo>(string.Format("CompanyName='{0}'", CompanyName)); //if (CompanyModel == null) //{ // resp.Status = 0; // resp.Msg = "企业不存在"; // return Common.JSONHelper.ObjectToJson(resp); //} //var BasseModel = bll.Get<WBBaseInfo>(string.Format("BaseName='{0}'", BaseName)); //if (BasseModel == null) //{ // resp.Status = 0; // resp.Msg = "基地不存在"; // return Common.JSONHelper.ObjectToJson(resp); //} //var ProjectModel = bll.Get<WBProjectInfo>(string.Format("ProjectName='{0}'", ProjectName)); //if (ProjectModel == null) //{ // resp.Status = 0; // resp.Msg = "项目不存在"; // return Common.JSONHelper.ObjectToJson(resp); //} model.ProjectName = projectName; model.Thumbnails = thumbnails; model.CompanyName = companyName; model.BaseName = baseName; 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 AddJointProject(HttpContext context) { string projectName = context.Request["ProjectName"]; string companyName = context.Request["CompanyName"]; string baseName = context.Request["BaseName"]; string thumbnails = context.Request["Thumbnails"]; //var CompanyModel = bll.Get<WBCompanyInfo>(string.Format("CompanyName='{0}'", CompanyName)); //if (CompanyModel == null) //{ // resp.Status = 0; // resp.Msg = "企业不存在"; // return Common.JSONHelper.ObjectToJson(resp); //} //var BasseModel = bll.Get<WBBaseInfo>(string.Format("BaseName='{0}'", BaseName)); //if (BasseModel == null) //{ // resp.Status = 0; // resp.Msg = "基地不存在"; // return Common.JSONHelper.ObjectToJson(resp); //} //var ProjectModel = bll.Get<WBProjectInfo>(string.Format("ProjectName='{0}'", ProjectName)); //if (ProjectModel == null) //{ // resp.Status = 0; // resp.Msg = "项目不存在"; // return Common.JSONHelper.ObjectToJson(resp); //} WBJointProjectInfo model = new WBJointProjectInfo(); model.ProjectName = projectName; model.Thumbnails = thumbnails; model.CompanyName = companyName; model.BaseName = baseName; 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 <WBJointProjectInfo>(string.Format("AutoID={0}", Convert.ToInt32(Request["id"]))); if (model == null) { Response.End(); } else { } } }