public ProjectEntity GetProject(long id) { if (id < 0) { return(null); } var result = _mainobj.GetById(id); if (result != null) { if (result.mrowtype == StaticData.ManageType.Project.ToString()) { var single = new ProjectEntity(); single = JsonConvert.DeserializeObject <ProjectEntity>(result.mcontent); single.managerid = result.mid; return(single); } } return(null); }
public ActionResult Save(TaskEntity input) { bool status = false; if (ModelState.IsValid) { if (input.managerid > 0) { var model = _mainobj.GetById(input.managerid); var oldsingle = new TaskEntity(); oldsingle = JsonConvert.DeserializeObject <TaskEntity>(model.mcontent); oldsingle.AmtPaid = input.AmtPaid; oldsingle.AssignedTo = input.AssignedTo; oldsingle.Cost = input.Cost; oldsingle.LastUpdatedate = DateTime.Now; oldsingle.taskdescription = input.taskdescription; oldsingle.taskname = input.taskname; oldsingle.CurrentStatus = input.CurrentStatus; string json = JsonConvert.SerializeObject(oldsingle); model.mcontent = json; var result = _mainobj.Update(input.managerid, model); status = true; } else { var projectid = Convert.ToInt32(Session["projectid"]); if (projectid > 0) { input.projectid = projectid; input.createdate = DateTime.Now; input.createdBy = 1; ///////////////////////// Temporary data input.isPublished = true; input.LastUpdatedate = DateTime.Now; input.publisheddate = DateTime.Now; var model = new DbManagerEntity(); string json = JsonConvert.SerializeObject(input); model.mcontent = json; model.mrowtype = StaticData.ManageType.Task.ToString(); var result = _mainobj.Create(model); status = true; } } } return(new JsonResult { Data = new { status = status } }); }
public ActionResult Save(CommentEntity input) { bool status = false; if (ModelState.IsValid) { if (input.managerid > 0) { var model = _mainobj.GetById(input.managerid); var oldsingle = new CommentEntity(); oldsingle = JsonConvert.DeserializeObject <CommentEntity>(model.mcontent); oldsingle.commentdetail = input.commentdetail; oldsingle.LastUpdatedate = DateTime.Now; string json = JsonConvert.SerializeObject(oldsingle); model.mcontent = json; var result = _mainobj.Update(input.managerid, model); status = true; } else { var taskid = Convert.ToInt32(Session["taskid"]); if (taskid > 0) { input.taskid = taskid; input.createdate = DateTime.Now; input.createdBy = 1; ///////////////////////// Temporary data input.isPublished = true; input.LastUpdatedate = DateTime.Now; input.publisheddate = DateTime.Now; var model = new DbManagerEntity(); string json = JsonConvert.SerializeObject(input); model.mcontent = json; model.mrowtype = StaticData.ManageType.Comment.ToString(); var result = _mainobj.Create(model); status = true; } } } return(new JsonResult { Data = new { status = status } }); }
public ActionResult Save(ProjectEntity input) { bool status = false; if (ModelState.IsValid) { if (input.managerid > 0) { var model = _mainobj.GetById(input.managerid); //var oldsingle = Manager.GetProject(input.managerid); var oldsingle = new ProjectEntity(); oldsingle = JsonConvert.DeserializeObject <ProjectEntity>(model.mcontent); oldsingle.projectname = input.projectname; oldsingle.projectdescription = input.projectdescription; oldsingle.LastUpdatedate = DateTime.Now; string json = JsonConvert.SerializeObject(oldsingle); model.mcontent = json; var result = _mainobj.Update(input.managerid, model); } else { input.createdate = DateTime.Now; input.createdBy = 1; ///////////////////////// Temporary data input.isPublished = true; input.LastUpdatedate = DateTime.Now; input.publisheddate = DateTime.Now; var model = new DbManagerEntity(); string json = JsonConvert.SerializeObject(input); model.mcontent = json; model.mrowtype = StaticData.ManageType.Project.ToString(); var result = _mainobj.Create(model); } status = true; } return(new JsonResult { Data = new { status = status } }); }