public ActionResult <List <string> > AddHelpFiles(string exerciseId, [FromBody] List <SubmitFile> files) { DBCode code = _access.CheckExercisePermission(exerciseId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } (string path, DBCode code2) = _access.GetExerciseDirectory(exerciseId); if (code2 != DBCode.OK) { return(HandleDatabaseOutput(code2)); } path = Path.Combine(path, "Help"); try { return(FileUtils.StoreFiles(files, path, false, false)); } catch (SecurityException) { return(BadRequest()); } catch { return(ServerError()); } }
public static string getManpower() { string dtresult = string.Empty; DataTable dt = new DataTable(); StringBuilder query = new StringBuilder(); query.Append("SELECT ALL GP_ID, GP_SORT_ORDER, sum(CASE When sex = 'Male' then 1 end ) Gendar_M, sum(CASE When sex = 'Female' then 1 end ) Gendar_F,"); query.Append("count(*) tot, round(avg(cis5.EMP_AGE_FOR_DATE('31-jul-16',cis_emp_emp_code,null)),2) avg_age, round(avg((last_day('01-jul-16')-EMP_JOIN_DT)/365),2) avg_exp,"); query.Append("sum(CASE When catg = 'ENG' then 1 end ) CATG_engg, sum(CASE When catg = 'MOD' then 1 end ) CATG_DESGN, sum(CASE When catg = 'OTH' then 1 end ) CATG_OTH,"); query.Append("Round(cis5.hr_manpower.gp_att('31-dec-16',GP_ID),2) Attrition,Round(cis5.hr_manpower.gp_att('31-dec-16','%'),2) Attrition_All, 100 Percent "); query.Append("FROM CIS5.CS_MANPOWER_VW group by GP_ID, GP_TYPE, GP_SORT_ORDER ORDER BY GP_SORT_ORDER"); try { DBCode dbcode = new DBCode(); dt = dbcode.getDataTable(query.ToString()); dtresult = DataTableToJSONWithJavaScriptSerializer(dt); } catch (Exception ex) { string s = ex.Message; // throw; } return(dtresult); }
public ActionResult DeleteHelpFile(string exerciseId, string file) { DBCode code = _access.CheckExercisePermission(exerciseId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } (string path, DBCode code2) = _access.GetExerciseDirectory(exerciseId); path = Path.Combine(path, "Help"); try { path = FileUtils.PathSafeCombine(path, file); System.IO.File.Delete(path); } catch (SecurityException) { return(BadRequest()); } catch (Exception) { return(ServerError()); } return(Ok()); }
public ActionResult DeleteRunFile(int testId, string file) { DBCode code = _access.CheckTestPerm(testId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } (string path, DBCode code2) = _access.GetTestDir(testId); if (code2 != DBCode.OK) { return(HandleDatabaseOutput(code2)); } try { path = FileUtils.PathSafeCombine(path, file); System.IO.File.Delete(path); } catch (SecurityException) { return(BadRequest()); } catch (Exception) { return(ServerError()); } return(Ok()); }
public ActionResult <Submission> CheckerBeginCheck(string submissionId) { DBCode code = _access.CheckSubmissionPerm(submissionId, Role.Checker); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.BeginChecking(submissionId))); }
public ActionResult <Submission> GetSubmissionToCheck(string submissionId) { DBCode code = _access.CheckSubmissionPerm(submissionId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.GetSubmission(submissionId))); }
public ActionResult <Dictionary <string, List <SubmissionLabel> > > GetSubmissionsToCheck(string exerciseId) { DBCode res = _access.CheckExercisePermission(exerciseId, Role.Teacher); if (res != DBCode.OK) { return(HandleDatabaseOutput(res)); } return(HandleDatabaseOutput(_access.GetSubmissionLabels(exerciseId))); }
public ActionResult <List <UserLabel> > GetCourseCheckers(string courseid) { DBCode code = _access.CheckCoursePermission(courseid, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.GetCourseCheckers(courseid))); }
public ActionResult <Submission> TeacherEndCheck([FromBody] Submission submission) { DBCode code = _access.CheckSubmissionPerm(submission.ID, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.EndChecking(submission))); }
public ActionResult <string> AddTeacher(string courseid, string teacherid) { DBCode code = _access.CheckCoursePermission(courseid, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.AddTeacherToCourse(courseid, teacherid))); }
public ActionResult DeleteDate(int dateId) { DBCode code = _access.CheckTeacherDatePerm(dateId); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.DeleteDate(dateId))); }
public ActionResult <List <TeacherDateDisplay> > GetDates(string exerciseId) { DBCode code = _access.CheckExercisePermission(exerciseId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.GetExerciseDates(exerciseId))); }
public ActionResult <TestOutput> DeleteTest(int testId) { DBCode code = _access.CheckTestPerm(testId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.DeleteTest(testId))); }
public ActionResult <List <RequestLabel> > Extensions(string exerciseId) { DBCode code = _access.CheckExercisePermission(exerciseId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.GetRequests(exerciseId, ChatType.Extension))); }
public ActionResult <List <ExerciseLabel> > ExerciseList(string courseId) { DBCode code = _access.CheckCoursePermission(courseId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.GetCourseExercises(courseId))); }
public ActionResult DeleteChecker(string courseid, string checkerid) { DBCode code = _access.CheckCoursePermission(courseid, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.DeleteCheckerFromCourse(courseid, checkerid))); }
public ActionResult RemoveChecker(string exerciseId, string checkerid) { DBCode code = _access.CheckExercisePermission(exerciseId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.DeleteCheckerFromExercise(exerciseId, checkerid))); }
public ActionResult UpdateExercise([FromBody] Exercise exercise) { DBCode code = _access.CheckExercisePermission(exercise.ID, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.UpdateExercise(exercise))); }
public ActionResult <SortedDictionary <string, List <ExerciseLabel> > > GetAllExercises(string courseid) { DBCode code = _access.CheckCoursePermission(courseid, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.GetAllExercises(courseid))); }
public ActionResult <string> RunExercise(string submitId) { DBCode res = _access.CheckSubmissionPerm(submitId, Role.Student); if (res != DBCode.OK) { return(HandleDatabaseOutput(res)); } return("Exercise Submitted successfully."); }
public ActionResult UpDate([FromBody] SubmitDate date) { DBCode code = _access.CheckExercisePermission(date.ExerciseID, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.UpdateDate(date))); }
public ActionResult <TestOutput> UpdateTest([FromBody] Test test) { DBCode code = _access.CheckTestPerm(test.ID, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } return(HandleDatabaseOutput(_access.UpdateTest(test))); }
protected void gvCustomer_RowUpdating(object sender, System.Web.UI.WebControls.GridViewUpdateEventArgs e) { int userId = 0; //Finding the controls from Gridview for the row which is going to update Label id = gvCustomer.Rows[e.RowIndex].FindControl("lbl_ID") as Label; TextBox name = gvCustomer.Rows[e.RowIndex].FindControl("txt_name") as TextBox; TextBox address = gvCustomer.Rows[e.RowIndex].FindControl("txt_address") as TextBox; TextBox mobile = gvCustomer.Rows[e.RowIndex].FindControl("txt_mobile") as TextBox; DropDownList dl = gvCustomer.Rows[e.RowIndex].FindControl("ddlDistributorGrid") as DropDownList; string constr = DBCode.getSqlConnectionstring(); using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand("Insert_Customer")) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@name", name.Text.Trim()); cmd.Parameters.AddWithValue("@address", address.Text.Trim()); cmd.Parameters.AddWithValue("@mobile", mobile.Text.Trim()); cmd.Parameters.AddWithValue("@distributorid", dl.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@id", id.Text.Trim()); cmd.Parameters.AddWithValue("@flag", "UPDATE"); cmd.Connection = con; con.Open(); userId = Convert.ToInt32(cmd.ExecuteScalar()); con.Close(); } } if (userId > 0) { lblmsg.Text = "Customer updated successfully."; lblmsg.ForeColor = System.Drawing.Color.Green; FillGrid(); } else if (userId == -1) { lblmsg.Text = "Customer already exist."; lblmsg.ForeColor = System.Drawing.Color.Red; } else { lblmsg.Text = "System Error."; lblmsg.ForeColor = System.Drawing.Color.Red; } //Setting the EditIndex property to -1 to cancel the Edit mode in Gridview gvCustomer.EditIndex = -1; //Call ShowData method for displaying updated data FillGrid(); } }
public ActionResult <int> PostTeacherMessage(string chatId, [FromBody] MessageInput msg) { msg.ChatID = chatId; DBCode res = _access.CheckSubmissionPerm(msg.ChatID, Role.Teacher); if (res != DBCode.OK) { return(HandleDatabaseOutput(res)); } return(PostMessage(msg)); }
public ActionResult <int> AddDate(string exerciseId, [FromBody] SubmitDate date) { DBCode code = _access.CheckExercisePermission(exerciseId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } date.ExerciseID = exerciseId; return(HandleDatabaseOutput(_access.AddDate(date))); }
public ActionResult <List <Message> > GetMessages(string chatId) { DBCode res = _access.CheckChatPerm(chatId, Role.Student); if (res != DBCode.OK) { return(HandleDatabaseOutput(res)); } var a = _access.GetMesssages(chatId); return(HandleDatabaseOutput(a)); }
private ActionResult GetHelpFile(string exerciseId, string filename, Role role) { DBCode code = _access.CheckExercisePermission(exerciseId, role); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } (string path, DBCode code2) = _access.GetExerciseDirectory(exerciseId); path = Path.Combine(path, "Help"); return(FileDownload(path, filename)); }
public ActionResult <Exercise> GetExerciseDetails(string exerciseId) { DBCode code = _access.CheckExercisePermission(exerciseId, Role.Teacher); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } var a = _access.GetExercise(exerciseId); return(HandleDatabaseOutput(a)); }
private ActionResult DownloadHelpFiles(string exerciseId, Role role) { DBCode code = _access.CheckExercisePermission(exerciseId, role); if (code != DBCode.OK) { return(HandleDatabaseOutput(code)); } (string path, DBCode code2) = _access.GetExerciseDirectory(exerciseId); path = Path.Combine(path, "Help"); return(HandleArchiveSending(path, "help.zip")); }
public ActionResult MarkCopy([FromBody] CopyForm copy) { DBCode res = _access.CheckExercisePermission(copy.ExerciseID, Role.Teacher); if (res != DBCode.OK) { return(HandleDatabaseOutput(res)); } if (IsAnyNull(copy?.user1, copy?.user2, copy?.ExerciseID)) { return(BadRequest("fields are null")); } return(HandleDatabaseOutput(_access.MarkCopy(copy))); }