public HttpResponseMessage InsertScore([FromBody] JObject Data) { try { var header = ServiceContainer.GetService <PesWeb.Service.Modules.EvaManage>(); tblScore sc = new tblScore(); tblEvaluation eva = new tblEvaluation(); // tblProjectMember proj = header.getProjectMember().Where(a => a.ProjectID == Data["ProjectNO"].ToString()).Where(a => a.StaffID == Data["EmployeeNO"].ToString()).FirstOrDefault(); Period p = header.GetPeriod().Where(a => a.Period_Id == Convert.ToInt32(Data["PeriodID"].ToString())).FirstOrDefault(); sc.Eva_ID = Convert.ToInt32(Data["Eva_ID"].ToString()); sc.H3_ID = Convert.ToInt32(Data["H_ID"].ToString()); sc.point = Convert.ToInt32(Data["point"].ToString()); if (string.IsNullOrEmpty(Data["Comment"].ToString())) { sc.Comment = Data["Comment"].ToString(); } header.InsertEvaData(eva); return(Request.CreateResponse(HttpStatusCode.OK)); } catch { return(Request.CreateResponse(HttpStatusCode.ExpectationFailed)); } }
public string createForm([FromBody] JObject Data) { tblEvaluation Eva = new tblEvaluation(); Eva.EmployeeNO = Data["EmployeeNO"].ToString(); Eva.EvaluatorNO = Data["EvaluatorNO"].ToString(); Eva.Job_ID = Convert.ToInt32(Data["JobID"].ToString()); Eva.ProjectNO = Data["ProjectNO"].ToString(); var svc = ServiceContainer.GetService <PesWeb.Service.Modules.FormManage>(); PSESEntities db = new PSESEntities(); List <SP_GetAllHeaderByJobID_Result> AllHeader = db.SP_GetAllHeaderByJobID().Where(a => a.JobID == Convert.ToInt32(Data["JobID"].ToString())).ToList(); int EvaID = svc.createForm(Eva); tblScore score = new tblScore(); foreach (SP_GetAllHeaderByJobID_Result temp in AllHeader) { score.Eva_ID = EvaID; score.H3_ID = temp.H3_ID; svc.InsertScore(score); } return("Success"); }
public void InsertScore(tblScore score) { PSESEntities db = new PSESEntities(); db.SP_InsertScore(score.Eva_ID, score.H3_ID); }