public HttpResponseMessage GetBySuperior(Guid schoolSuperiorId) { try { var result = SchoolBusiness.Get(claimData.UserId, claimData.GroupId, schoolSuperiorId); return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception exc) { var logId = LogBusiness.Error(exc); return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId))); } }
public HttpResponseMessage GetByClassification([ModelBinder(typeof(Guids))] IEnumerable <Guid> schoolSuperiorId = null, [ModelBinder(typeof(Ints))] IEnumerable <int> schoolClassificationId = null) { try { var result = SchoolBusiness.Get(claimData.UserId, claimData.GroupId, schoolSuperiorId, schoolClassificationId); return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception exc) { var logId = LogBusiness.Error(exc); return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId))); } }
public object DeleteSchool([FromBody] UpdateSchool PR) { try { SchoolBusiness Objdelete = new SchoolBusiness(); var result = Objdelete.Delete(PR); return(result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object SchoolInformation(ActiveParam obj) { try { SchoolBusiness getinfo = new SchoolBusiness(); var result = getinfo.GetSchool(obj); return(result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object GetSingleSchool(GetSchool obj) { try { SchoolBusiness getinfo = new SchoolBusiness(); var result = getinfo.GetSchoolInfo(obj); return(result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object AddSchool([FromBody] School obj) { try { SchoolBusiness save = new SchoolBusiness(); var result = save.SaveSchool(obj); return(result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object DeleteLanguage([FromBody] LanguageParam PM) { try { SchoolBusiness b = new SchoolBusiness(); var Result = b.DeleteLanguage(PM); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object UpdateSchool(UpdateSchool obj) { try { SchoolBusiness update = new SchoolBusiness(); var result = update.UpdateSchoolInfo(obj); return(result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object ExamTemplateInformation() { try { SchoolBusiness template = new SchoolBusiness(); var Result = template.GetExamTemplate(); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object UpdateLanguage(LanguageParam b) { try { SchoolBusiness board = new SchoolBusiness(); var Result = board.LanguageUpdate(b); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object GetSingleLanuageInfo(LanguageParam b) { try { SchoolBusiness language = new SchoolBusiness(); var Result = language.GetSingleLanguage(b); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object GetLanguageInfo(UserCredential uc) { try { SchoolBusiness language = new SchoolBusiness(); var Result = language.GetLanguage(uc); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object GetSingleBoardInfo(BoardParam b) { try { SchoolBusiness board = new SchoolBusiness(); var Result = board.GetSingleBoard(b); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object GetBoardInfo(UserCredential uc) { try { SchoolBusiness board = new SchoolBusiness(); var Result = board.GetBoard(uc); return(Result); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
private DataTable GetDataTable() { try { DataTable dt = SchoolBusiness.GetAllData(); string sex = ddl_sex.SelectedValue; string startYear = input_start.Value; string endYear = input_end.Value; DataTable dt_student = StudentBusiness.GetAllData("", "", sex, startYear, endYear); if (dt != null) { dt.Columns["SchoolName"].ColumnName = "ItemName"; dt.Columns.Add("Count"); // 总人数 dt.Columns.Add("Percent"); //百分比 int itemCount = dt.Rows.Count; //总项数 int totals = dt_student.Rows.Count; //总人数 foreach (DataRow dr in dt.Rows) { int count = dt_student.Select("School = '" + dr["ItemName"] + "'").Length; double percent = totals == 0 ? 0.0000 : Math.Round(count * 1.0 / totals, 4); dr["Percent"] = percent * 100 + "%"; dr["Count"] = count.ToString(); } DataRow dr_total = dt.NewRow();//添加一条 总计 dr_total["ItemName"] = "总计"; dr_total["Count"] = totals; dr_total["Percent"] = totals == 0 ? "0.00%" : "100%"; dt.Rows.Add(dr_total); return(dt); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "layer.alert('数据加载错误!')", true); return(new DataTable()); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "layer.alert('数据加载错误!')", true); return(new DataTable()); } }
protected void btn_AddUser_Click(object sender, EventArgs e) { try { string schoolname = tb_account.Text.Trim(); string schoolcode = tb_password.Text.Trim(); string addresult = "0"; if (request_id != 0)//修改 { addresult = SchoolBusiness.UpdateSchool(request_id, schoolname, schoolcode); if (addresult == "0") { Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "parent.layer.msg('修改失败', 1, -1);", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "parent.layer.msg('修改成功', 2, -1);close();", true); } } else//新增 { addresult = SchoolBusiness.AddSchool(schoolname, schoolcode); if (addresult == "0") { Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "parent.layer.msg('添加失败', 1, -1);", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "parent.layer.msg('添加成功', 2, -1);close();", true); } } } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alter", "parent.layer.msg(''数据加载失败,请重新再试!', 1, -1);", true); } }
private void Bind_statistic() { try { DataTable dt = SchoolBusiness.GetAllData(); string sex = ddl_sex.SelectedValue; string startYear = input_start.Value; string endYear = input_end.Value; string label = ""; if (!startYear.IsNullOrEmpty()) { label += "【出生年份>=" + startYear + "年】"; } if (!endYear.IsNullOrEmpty()) { label += "【出生年份<=" + endYear + "年】"; } if (!sex.Equals("99")) { label += "【" + ddl_sex.SelectedItem.Text + "性】"; } if (label == "") { label = "【全体】"; } label += "在校本科生学院分布统计"; label_head.Text = label; DataTable dt_student = StudentBusiness.GetAllData("", "", sex, startYear, endYear); if (dt != null) { dt.Columns["SchoolName"].ColumnName = "ItemName"; dt.Columns.Add("Count"); // 总人数 dt.Columns.Add("Percent"); //百分比 int itemCount = dt.Rows.Count; //总项数 int totals = dt_student.Rows.Count; //总人数 foreach (DataRow dr in dt.Rows) { int count = dt_student.Select("School = '" + dr["ItemName"] + "'").Length; double percent = totals == 0 ? 0.0000 : Math.Round(count * 1.0 / totals, 4); dr["Percent"] = percent * 100 + "%"; dr["Count"] = count.ToString(); if (PercentString.Equals("")) { PercentString = "['" + dr["ItemName"] + "'," + percent + "]"; } else { PercentString += ",['" + dr["ItemName"] + "'," + percent + "]"; } } DataRow dr_total = dt.NewRow();//添加一条 总计 dr_total["ItemName"] = "总计"; dr_total["Count"] = totals; dr_total["Percent"] = totals == 0 ? "0.00%" : "100%"; dt.Rows.Add(dr_total); gv_result.DataSource = dt; gv_result.DataBind(); Label_Result.Text = itemCount.ToString(); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "layer.alert('数据加载错误!')", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "alter", "layer.alert('数据加载错误!')", true); } }
/// <summary> /// Envia a notificação para os usuários baseados nos filtros e nas permissões do usuário logado /// </summary> /// <param name="userId">Id do usuário logado</param> /// <param name="groupId">Id do gruopo logado</param> /// <param name="entity"></param> /// <returns></returns> public static Guid Save(Guid userId, Guid groupId, Notification.Entity.API.Notification entity) { if (entity.Recipient == null) { throw new NotificationRecipientIsEmptyException(); } if ((entity.Recipient.SystemRecipient == null || !entity.Recipient.SystemRecipient.Any()) && (entity.Recipient.ContributorRecipient == null || !entity.Recipient.ContributorRecipient.Any()) && (entity.Recipient.TeacherRecipient == null || !entity.Recipient.TeacherRecipient.Any())) { throw new NotificationRecipientIsEmptyException(); } var groupRep = new GroupRepository(); var userRep = new UserRepository(); var userSGPRep = new UserSGPRepository(); var groupUser = groupRep.GetById(groupId); var ltUser = new List <Guid>(); if (entity.Recipient.SystemRecipient != null && entity.Recipient.SystemRecipient.Any()) { foreach (var item in entity.Recipient.SystemRecipient) { //pendente de testes if (groupUser.VisionId > 1) { //se não passar Escola, buscar todas as escolas das DRE's selecionadas, e/ou todas que o usuário logado tenha permissão (mesmo se a listagem vier nula) if (!item.AdministrativeUnit.Any()) { item.AdministrativeUnit = SchoolBusiness.GetAUByPermission(userId, groupId, item.AdministrativeUnitSuperior); } //Mesmo se a lista de unidades administrativas vier com valores, dentro do método é preciso garantir que o usuário tenha permissão nelas, por isso executo a verificação novamente dentro dele. ltUser.AddRange(userRep.GetByVisionAll(userId, groupId, item.SystemId, item.GroupId, item.AdministrativeUnitSuperior, item.AdministrativeUnit).Select(u => u.Id)); } else if ((item.AdministrativeUnit != null && item.AdministrativeUnit.Any()) || (item.AdministrativeUnitSuperior != null && item.AdministrativeUnitSuperior.Any())) { if (groupUser.VisionId == 1) { if ((item.AdministrativeUnit != null && item.AdministrativeUnit.Any()) || (item.AdministrativeUnitSuperior != null && item.AdministrativeUnitSuperior.Any())) { ltUser.AddRange(userSGPRep.GetByVisionAdministrator(userId, item.SystemId.First(), item.GroupId, item.AdministrativeUnitSuperior, item.AdministrativeUnit).Select(u => u.Id)); } } //else if(item.AdministrativeUnitSuperior != null && item.AdministrativeUnitSuperior.Any()) // ltUser.AddRange(userRep.GetByVisionAdministrator(userId, item.SystemId.First(), item.GroupId, item.AdministrativeUnitSuperior).Select(u => u.Id)); } else if (item.GroupId != null && item.GroupId.Any()) { if (groupUser.VisionId == 1) { ltUser.AddRange(userRep.GetByVisionAdministrator(userId, item.SystemId.First(), item.GroupId).Select(u => u.Id)); } } else { if (groupUser.VisionId == 1) { ltUser.AddRange(userRep.GetByVisionAdministrator(userId, item.SystemId).Select(u => u.Id)); } } } } if (entity.Recipient.ContributorRecipient != null && entity.Recipient.ContributorRecipient.Any()) { foreach (var item in entity.Recipient.ContributorRecipient) { ltUser.AddRange(ContributorBusiness.Get(userId, groupId, item.Calendar.Name, item.SchoolSuperior, item.SchoolClassification, item.School, item.Position).Select(u => u.Id)); } } if (entity.Recipient.TeacherRecipient != null && entity.Recipient.TeacherRecipient.Any()) { foreach (var item in entity.Recipient.TeacherRecipient) { ltUser.AddRange(TeacherBusiness.Get(userId, groupId, item.Calendar.Name, item.SchoolSuperior, item.SchoolClassification, item.School, item.Position, item.Course, item.CoursePeriod, item.Discipline, item.Team).Select(u => u.Id)); } } if (ltUser != null && ltUser.Any()) { ltUser = ltUser.Distinct().ToList(); return(Save(entity, ltUser, userId)); } else { throw new NotificationWithoutRecipientException(); } }