public static void Delete(Project model) { string sql = "select * from PSS_Project where Proj_Id='" + model.Proj_Id + "'"; DataSet ds = SqlHelper.GetDataSetBySql(sql, "PSS_Project"); DataRow dr = ds.Tables["PSS_Project"].Rows[0]; dr.Delete(); SqlHelper.UpdateDataSet(ds, sql, "PSS_Project"); if (ds != null) ds.Dispose(); }
public static List<Project> GetList(string idList) { List<Project> list = new List<Project>(); Project model = null; string sql = "select * from PSS_Project where Proj_Id in (" + idList + ")"; DataSet ds = SqlHelper.GetDataSetBySql(sql, "PSS_Project"); foreach (DataRow dr in ds.Tables["PSS_Project"].Rows) { model = new Project(); if (!string.IsNullOrEmpty(dr["Proj_Id"].ToString())) { model.Proj_Id = int.Parse(dr["Proj_Id"].ToString()); } if (!string.IsNullOrEmpty(dr["Proj_Trimester_Id"].ToString())) { model.Proj_Trimester_Id = int.Parse(dr["Proj_Trimester_Id"].ToString()); } model.Proj_Students_Num = dr["Proj_Students_Num"].ToString(); model.Proj_Title = dr["Proj_Title"].ToString(); model.Proj_Staff_Contact = dr["Proj_Staff_Contact"].ToString(); model.Proj_Client_Contact = dr["Proj_Client_Contact"].ToString(); model.Proj_Client_Company = dr["Proj_Client_Company"].ToString(); model.Proj_Continuation = (bool)dr["Proj_Continuation"]; model.Proj_Description = dr["Proj_Description"].ToString(); model.Proj_Skills_Required = dr["Proj_Skills_Required"].ToString(); model.Proj_Context = dr["Proj_Context"].ToString(); model.Proj_Goals = dr["Proj_Goals"].ToString(); model.Proj_Features = dr["Proj_Features"].ToString(); model.Proj_Challenges = dr["Proj_Challenges"].ToString(); model.Proj_Opportunities = dr["Proj_Opportunities"].ToString(); model.Proj_Presenter = dr["Proj_Presenter"].ToString(); model.Proj_Valid_Dates = dr["Proj_Valid_Dates"].ToString(); if (!string.IsNullOrEmpty(dr["Proj_Update_Time"].ToString())) { model.Proj_Update_Time = DateTime.Parse(dr["Proj_Update_Time"].ToString()); model.Update_Time = model.Proj_Update_Time.ToString("dd/MM/yyyy HH:mm:ss"); } list.Add(model); }; return list; }
public ActionResult IdeaApprove(int ideaId) { Idea model = null; try { model = IdeaService.GetModel(ideaId); model.Idea_Status = 1; IdeaService.Update(model); Project project = new Project(); project.Proj_Presenter = model.Idea_Presenter; project.Proj_Title = model.Idea_Title; project.Proj_Staff_Contact = model.Idea_Staff_Contact; project.Proj_Client_Contact = model.Idea_Client_Contact; project.Proj_Client_Company = model.Idea_Client_Company; project.Proj_Valid_Dates = model.Idea_Valid_Dates; project.Proj_Students_Num = model.Idea_Students_Num; project.Proj_Continuation = model.Idea_Continuation; project.Proj_Description = model.Idea_Description; project.Proj_Skills_Required = model.Idea_Skills_Required; project.Proj_Context = model.Idea_Context; project.Proj_Goals = model.Idea_Goals; project.Proj_Features = model.Idea_Features; project.Proj_Challenges = model.Idea_Challenges; project.Proj_Opportunities = model.Idea_Opportunities; project.Proj_Trimester_Id = model.Idea_Trimester_Id; project.Proj_Update_Time = DateTime.Now; ProjectService.Save(project); } catch (Exception ex) { throw ex; } return Json(model, JsonRequestBehavior.AllowGet); }
public ContentResult ProjectSave(Project model, int? id) { JsonDataGridResult jsonResult = new JsonDataGridResult(); try { Project project = null; if (id.HasValue) { project = ProjectService.GetModel(id.Value); } else { project = new Project(); project.Proj_Presenter = User.Identity.Name.Split(',')[1]; } project.Proj_Title = model.Proj_Title; project.Proj_Staff_Contact = model.Proj_Staff_Contact; project.Proj_Client_Contact = model.Proj_Client_Contact; project.Proj_Client_Company = model.Proj_Client_Company; project.Proj_Valid_Dates = model.Proj_Valid_Dates; project.Proj_Students_Num = model.Proj_Students_Num; project.Proj_Continuation = model.Proj_Continuation; project.Proj_Description = model.Proj_Description; project.Proj_Skills_Required = model.Proj_Skills_Required; project.Proj_Context = model.Proj_Context; project.Proj_Goals = model.Proj_Goals; project.Proj_Features = model.Proj_Features; project.Proj_Challenges = model.Proj_Challenges; project.Proj_Opportunities = model.Proj_Opportunities; project.Proj_Trimester_Id = model.Proj_Trimester_Id; project.Proj_Update_Time = DateTime.Now; if (id.HasValue) { ProjectService.Update(project); } else { ProjectService.Save(project); } jsonResult.result = true; jsonResult.message = ""; } catch (Exception ex) { jsonResult.result = false; jsonResult.message = ex.Message; } string result = JsonConvert.SerializeObject(jsonResult); return Content(result); }
public ActionResult ProjectEditLoad(int? Proj_Id, int trimesterId) { Project model = new Project(); model.Proj_Trimester_Id = trimesterId; if (Proj_Id.HasValue) { model = ProjectService.GetModel(Proj_Id.Value); model.Context = base.Server.UrlEncode(model.Proj_Context).Replace("+", "%20"); model.Description = base.Server.UrlEncode(model.Proj_Description).Replace("+", "%20"); model.Skills_Required = base.Server.UrlEncode(model.Proj_Skills_Required).Replace("+", "%20"); model.Goals = base.Server.UrlEncode(model.Proj_Goals).Replace("+", "%20"); model.Features = base.Server.UrlEncode(model.Proj_Features).Replace("+", "%20"); model.Challenges = base.Server.UrlEncode(model.Proj_Challenges).Replace("+", "%20"); model.Opportunities = base.Server.UrlEncode(model.Proj_Opportunities).Replace("+", "%20"); } List<SelectListItem> list = new List<SelectListItem>(); list.Add(new SelectListItem { Text = "Yes", Value = "True" }); list.Add(new SelectListItem { Text = "No", Value = "False" }); ViewData["list"] = list; return View(model); }
public static void Update(Project model) { string sql = "select * from PSS_Project where Proj_Id='" + model.Proj_Id + "'"; DataSet ds = SqlHelper.GetDataSetBySql(sql, "PSS_Project"); DataRow dr = ds.Tables["PSS_Project"].Rows[0]; dr["Proj_Title"] = model.Proj_Title; dr["Proj_Staff_Contact"] = model.Proj_Staff_Contact; dr["Proj_Client_Contact"] = model.Proj_Client_Contact; dr["Proj_Client_Company"] = model.Proj_Client_Company; dr["Proj_Valid_Dates"] = model.Proj_Valid_Dates; dr["Proj_Students_Num"] = model.Proj_Students_Num; dr["Proj_Continuation"] = model.Proj_Continuation; dr["Proj_Description"] = model.Proj_Description; dr["Proj_Skills_Required"] = model.Proj_Skills_Required; dr["Proj_Context"] = model.Proj_Context; dr["Proj_Goals"] = model.Proj_Goals; dr["Proj_Features"] = model.Proj_Features; dr["Proj_Challenges"] = model.Proj_Challenges; dr["Proj_Opportunities"] = model.Proj_Opportunities; dr["Proj_Trimester_Id"] = model.Proj_Trimester_Id; dr["Proj_Update_Time"] = model.Proj_Update_Time; dr["Proj_Presenter"] = model.Proj_Presenter; SqlHelper.UpdateDataSet(ds, sql, "PSS_Project"); if (ds != null) ds.Dispose(); }
public static Project GetModel(int id) { string sql = "select * from PSS_Project where Proj_Id='" + id + "'"; DataSet ds = SqlHelper.GetDataSetBySql(sql, "PSS_Project"); Project model = null; if (ds.Tables[0].Rows.Count > 0) { model = new Project(); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Proj_Id"].ToString())) { model.Proj_Id = int.Parse(ds.Tables[0].Rows[0]["Proj_Id"].ToString()); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Proj_Trimester_Id"].ToString())) { model.Proj_Trimester_Id = int.Parse(ds.Tables[0].Rows[0]["Proj_Trimester_Id"].ToString()); } model.Proj_Students_Num = ds.Tables[0].Rows[0]["Proj_Students_Num"].ToString(); model.Proj_Title = ds.Tables[0].Rows[0]["Proj_Title"].ToString(); model.Proj_Staff_Contact = ds.Tables[0].Rows[0]["Proj_Staff_Contact"].ToString(); model.Proj_Client_Contact = ds.Tables[0].Rows[0]["Proj_Client_Contact"].ToString(); model.Proj_Client_Company = ds.Tables[0].Rows[0]["Proj_Client_Company"].ToString(); model.Proj_Continuation = (bool)ds.Tables[0].Rows[0]["Proj_Continuation"]; model.Proj_Description = ds.Tables[0].Rows[0]["Proj_Description"].ToString(); model.Proj_Skills_Required = ds.Tables[0].Rows[0]["Proj_Skills_Required"].ToString(); model.Proj_Context = ds.Tables[0].Rows[0]["Proj_Context"].ToString(); model.Proj_Goals = ds.Tables[0].Rows[0]["Proj_Goals"].ToString(); model.Proj_Features = ds.Tables[0].Rows[0]["Proj_Features"].ToString(); model.Proj_Challenges = ds.Tables[0].Rows[0]["Proj_Challenges"].ToString(); model.Proj_Opportunities = ds.Tables[0].Rows[0]["Proj_Opportunities"].ToString(); model.Proj_Presenter = ds.Tables[0].Rows[0]["Proj_Presenter"].ToString(); model.Proj_Valid_Dates = ds.Tables[0].Rows[0]["Proj_Valid_Dates"].ToString(); if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Proj_Update_Time"].ToString())) { model.Proj_Update_Time = DateTime.Parse(ds.Tables[0].Rows[0]["Proj_Update_Time"].ToString()); } } if (ds != null) ds.Dispose(); return model; }
public static List<Project> GetList(Paging paging, string order, string sort, int trimesterId, string queryWord) { List<Project> list = new List<Project>(); Project model = null; DataSet ds = SqlHelper.GetListByPage("PSS_Project","Proj_Trimester_Id",trimesterId, paging, order, sort); foreach (DataRow dr in ds.Tables["PSS_Project"].Rows) { model = new Project(); if (!string.IsNullOrEmpty(dr["Proj_Id"].ToString())) { model.Proj_Id = int.Parse(dr["Proj_Id"].ToString()); } if (!string.IsNullOrEmpty(dr["Proj_Trimester_Id"].ToString())) { model.Proj_Trimester_Id = int.Parse(dr["Proj_Trimester_Id"].ToString()); } model.Proj_Students_Num = dr["Proj_Students_Num"].ToString(); model.Proj_Title = dr["Proj_Title"].ToString(); model.Proj_Staff_Contact = dr["Proj_Staff_Contact"].ToString(); model.Proj_Client_Contact = dr["Proj_Client_Contact"].ToString(); model.Proj_Client_Company = dr["Proj_Client_Company"].ToString(); model.Proj_Continuation = (bool)dr["Proj_Continuation"]; model.Proj_Description = dr["Proj_Description"].ToString(); model.Proj_Skills_Required = dr["Proj_Skills_Required"].ToString(); model.Proj_Context = dr["Proj_Context"].ToString(); model.Proj_Goals = dr["Proj_Goals"].ToString(); model.Proj_Features = dr["Proj_Features"].ToString(); model.Proj_Challenges = dr["Proj_Challenges"].ToString(); model.Proj_Opportunities = dr["Proj_Opportunities"].ToString(); model.Proj_Presenter = dr["Proj_Presenter"].ToString(); model.Proj_Valid_Dates = dr["Proj_Valid_Dates"].ToString(); if (!string.IsNullOrEmpty(dr["Proj_Update_Time"].ToString())) { model.Proj_Update_Time = DateTime.Parse(dr["Proj_Update_Time"].ToString()); model.Update_Time = model.Proj_Update_Time.ToString("dd/MM/yyyy HH:mm:ss"); } list.Add(model); }; return list; }