public void BindChildAgency(Model.CCOM.Agency model, int level) { string tag = ""; DataRow dr = dt.NewRow(); if (model != null) { for (int i = 0; i < level; i++) { tag += " "; } tag += "┠"; dr["Agency_name"] = tag + model.Agency_name; dr["Agency_id"] = model.Agency_id; dt.Rows.Add(dr); } BLL.CCOM.Agency bll = new BLL.CCOM.Agency(); List <Model.CCOM.Agency> listAgency = bll.GetModelList(" Agency_father=" + (model == null ? 0 : model.Agency_id)); if (level <= 2) { foreach (Model.CCOM.Agency agencyModel in listAgency) { BindChildAgency(agencyModel, level + 1); } } }
public void BindChildAgency(DataTable dt, Model.CCOM.Agency model, int level) { string tag = ""; DataRow dr = dt.NewRow(); if (model == null) { dr["Agency_name"] = "--请选择机构--"; dr["Agency_id"] = "#"; } else { for (int i = 0; i < level; i++) { tag += " "; } tag += "┠"; dr["Agency_name"] = tag + model.Agency_name; dr["Agency_id"] = model.Agency_id; } dt.Rows.Add(dr); BLL.CCOM.Agency bll = new BLL.CCOM.Agency(); List <Model.CCOM.Agency> listAgency = bll.GetModelList(" Agency_father=" + (model == null ? 0 : model.Agency_id)); foreach (Model.CCOM.Agency agencyModel in listAgency) { BindChildAgency(dt, agencyModel, level + 1); } }
protected void btnAddSubmit_Click(object sender, EventArgs e) { //BLL.admin.Universities_Organization bll = new BLL.admin.Universities_Organization(); //Model.admin.Universities_Organization modelfather = new Model.admin.Universities_Organization(); //TYPE_ID = Utils.StrToInt(this.DropDownList1.SelectedValue, 0); BLL.CCOM.Agency bll = new BLL.CCOM.Agency(); Model.CCOM.Agency modelfather = new Model.CCOM.Agency(); int UO_ID = 0; try { //UO_ID = Utils.StrToInt(this.ddlAddParentID.SelectedValue, 0); modelfather = bll.GetModel(UO_ID); } catch { modelfather = null; } if (modelfather != null) { Model.CCOM.Agency model = new Model.CCOM.Agency(); //string[] names = this.txtAddName.Text.Split('|'); int result = 0; int i = 0; //foreach (string name in names) //{ // if (name == "") continue; // if (Tools.CheckParams(name)) // { // result = 0; // break; // } // model.Agency_name = name; // model.Agency_father = UO_ID; // model.Agency_type = TYPE_ID; // model.Agency_status = true; // result = bll.Add(model); // if (result == 0) // break; //} if (result == 0) { JscriptMsg("添加失败,输入异常!", "back", "Error"); } else { //bll.ddlBind(this.ddlAddParentID, Utils.StrToInt(this.hiduo_id.Value, -11)); //绑定父级部门 JscriptMsg("添加成功!", "OrgAdd.aspx?fun_id=" + DESEncrypt.Encrypt(this.fun_id), "Success"); } } else { JscriptMsg("添加失败,请选择自己可以管理的机构!", "back", "Error"); } }
public void ShowOtherInfo() { BLL.CCOM.User_information user_bll = new BLL.CCOM.User_information(); Model.CCOM.User_information user_model = user_bll.GetModel(UserID); if (user_model == null) { InnerRedirect(MyEnums.RediirectErrorEnum.ParameterError); } //真实姓名 if (user_model.User_realname == null) { txt_User_realname.Text = "请填写真实姓名"; } else { this.txt_User_realname.Text = user_model.User_realname; } int agency_id = 0; agency_id = user_model.Agency_id; BLL.CCOM.Agency user_agency_bll = new BLL.CCOM.Agency(); Model.CCOM.Agency user_agency_model = user_agency_bll.GetModel(agency_id); if (user_agency_model.Agency_id != 0) { txt_Agency.Text = user_agency_model.Agency_name; } else { div_user_agency.Visible = false; } //移动电话 this.txt_User_number.Text = user_model.User_number; //性别 if ((Boolean)user_model.User_gender) { this.rbl_User_gender.SelectedIndex = 1; } //出生日期 if (user_model.User_birthday == null) { txt_User_birthday.Text = "请填写出生日期"; } else { this.txt_User_birthday.Text = Convert.ToDateTime(user_model.User_birthday).ToString("yyyy-MM-dd"); } //添加日期 this.txt_User_addtime.Text = Convert.ToDateTime(user_model.User_addtime).ToString("yyyy-MM-dd"); }
protected void btnEditSubmit_Click(object sender, EventArgs e) { BLL.CCOM.Agency bll = new BLL.CCOM.Agency(); int UO_ID = 0; try { UO_ID = Utils.StrToInt(MyRequest.GetQueryString("selectid"), 0); } catch { } if (UO_ID == 0 || UO_ID == -1) { JscriptMsg("添加失败,输入异常!", "back", "Error"); return; } Model.CCOM.Agency model = bll.GetModel(UO_ID); String orgName = txtEditName.Text.Trim(); if (Tools.CheckParams(orgName)) { JscriptMsg("添加失败,输入异常!", "back", "Error"); return; } else { model.Agency_name = orgName; } if (rbEditStatus.SelectedItem.Text.Equals("启用")) { model.Agency_status = true; } else if (rbEditStatus.SelectedItem.Text.Equals("停用")) { model.Agency_status = false; } try { model.Agency_type = int.Parse(this.ddlType.SelectedValue); } catch { JscriptMsg("添加失败,输入异常!", "back", "Error"); return; } bool result = bll.Update(model); if (result == false) { JscriptMsg("添加失败,输入异常!", "back", "Error"); } else { JscriptMsg("编辑成功!", "OrgList.aspx?fun_id=" + DESEncrypt.Encrypt(fun_id) + "&selectid=" + DESEncrypt.Encrypt(UO_ID.ToString()), "Success"); } }
protected void bindall() { Model.CCOM.Agency model = new BLL.CCOM.Agency().GetModel(1); if (model == null) { InnerRedirect(MyEnums.RediirectErrorEnum.NotAdmin); } else { this.hiduoid.Value = model.Agency_id.ToString(); BLL.CCOM.Agency bll = new BLL.CCOM.Agency(); this.ddlEditSelect.DataSource = GetOrgList_DataSet(true); this.ddlEditSelect.DataTextField = "Agency_name"; this.ddlEditSelect.DataValueField = "Agency_id"; this.ddlEditSelect.DataBind(); int UO_ID = 0; try { UO_ID = Utils.StrToInt(MyRequest.GetQueryString("selectid"), 0); } catch { } if (UO_ID == 0 || UO_ID == -1 || UO_ID == 1) { this.txtEditName.Enabled = false; this.rbEditStatus.Enabled = false; this.btnEditSubmit.Enabled = false; this.ddlType.Enabled = false; } else { this.txtEditName.Enabled = true; this.rbEditStatus.Enabled = true; this.btnEditSubmit.Enabled = true; this.ddlType.Enabled = true; Model.CCOM.Agency uo = bll.GetModel(UO_ID); this.ddlEditSelect.SelectedValue = MyRequest.GetString("selectid"); this.txtEditName.Text = uo.Agency_name; this.ddlType.SelectedValue = uo.Agency_type.ToString(); if (uo.Agency_status) { this.rbEditStatus.SelectedValue = "1"; } else { this.rbEditStatus.SelectedValue = "0"; } } } }
public void TreeAddChildNoCheck_UOAndUser(TreeNode tn, Model.CCOM.Agency ud) { var bll = new BLL.CCOM.Agency(); var uds = bll.GetModelList(" Agency_father=" + ud.Agency_id.ToString()); if (uds != null) { foreach (var cud in uds) { var ctn = new TreeNode(cud.Agency_name, 'O' + cud.Agency_id.ToString()); ctn.Expanded = false; ctn.ImageUrl = "/images/folder.png"; tn.ChildNodes.Add(ctn); TreeAddChildNoCheck_UOAndUser(ctn, cud); } } }
//递归更改部门状态 public void UpdateDepartmentState(int UO_ID, bool Activity) { var bll = new BLL.CCOM.Agency(); Model.CCOM.Agency modeluo = bll.GetModel(UO_ID); if (modeluo != null) { modeluo.Agency_status = Activity; bll.Update(modeluo); } List <Model.CCOM.Agency> uds = bll.GetModelList(" Agency_father=" + UO_ID); foreach (Model.CCOM.Agency ud in uds) { UpdateDepartmentState(ud.Agency_id, Activity); } }
private void AddOtherOrg(DataTable dt, int ID, int level, bool activity) { BLL.CCOM.Agency bll = new BLL.CCOM.Agency(); Model.CCOM.Agency model = bll.GetModel(" Agency_id=" + ID); DataRow dr = dt.NewRow(); string tag = ""; for (int i = 0; i < level; i++) { tag += " "; } tag += "┠"; dr["Agency_name"] = tag + model.Agency_name; if (!model.Agency_status) { dr["Agency_name"] += "(已禁用)"; } dr["Agency_id"] = model.Agency_id; //if (!activity) //{ // if (model.Agency_status) // { // dt.Rows.Add(dr); // } // else // { // return; // } //} //else //{ // dt.Rows.Add(dr); //} dt.Rows.Add(dr); List <Model.CCOM.Agency> listOrganization = bll.GetModelList(" Agency_father=" + ID); foreach (Model.CCOM.Agency org in listOrganization) { AddOtherOrg(dt, org.Agency_id, level + 1, activity); } }
protected string ImportDataItem(DataSet ds, ref int success, ref int error)//基础数据 { string result = ""; BLL.CCOM.User_information bll = new BLL.CCOM.User_information(); Model.CCOM.User_information model = new Model.CCOM.User_information(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string checkmsg = null; //姓名 string name = ds.Tables[0].Rows[i]["姓名"].ToString().Trim(); if (!ValidDFValue(name, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,姓名" + checkmsg + "<br/>"; error++; continue; } else if (name != "") { model.User_realname = name; } //学号/工号 string mobile = ds.Tables[0].Rows[i]["学号/工号"].ToString().Trim(); if (!Validator.IsMobile(mobile)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,学号/工号要为整数<br/>"; error++; continue; } if (!ValidDFValue(mobile, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,学号/工号" + checkmsg + "<br/>"; error++; continue; } else if (bll.GetRecordCount(" User_number='" + mobile + "'") > 0) { result += "×第" + (i + 1).ToString() + "行数据更新失败,该学号/工号已被添加<br/>"; error++; continue; } else if (mobile != "") { model.User_number = mobile; } //性别 string gender = ds.Tables[0].Rows[i]["性别"].ToString().Trim(); if (!ValidDFValue(gender, true, "男|女", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,性别" + checkmsg + "<br/>"; error++; continue; } else if (gender == "男") { model.User_gender = false; } else if (gender == "女") { model.User_gender = true; } //机构 string angency = ds.Tables[0].Rows[i]["机构/班号"].ToString().Trim(); if (!ValidDFValue(angency, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,所在机构/班号" + checkmsg + "<br/>"; error++; continue; } BLL.CCOM.Agency agency_bll = new BLL.CCOM.Agency(); Model.CCOM.Agency agency_model = new Model.CCOM.Agency(); agency_model = agency_bll.GetModel(" Agency_name='" + angency + "'"); if (agency_model == null) { result += "×第" + (i + 1).ToString() + "行数据更新失败,所在机构/班号不存在<br/>"; error++; continue; } model.Agency_id = agency_model.Agency_id; //角色 string role = ds.Tables[0].Rows[i]["角色"].ToString().Trim(); if (!ValidDFValue(role, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,角色<br/>"; error++; continue; } BLL.CCOM.Role role_bll = new BLL.CCOM.Role(); Model.CCOM.Role role_model = new Model.CCOM.Role(); role_model = role_bll.GetModel(" Role_name='" + role + "'"); if (role_model == null) { result += "×第" + (i + 1).ToString() + "行数据更新失败,用户角色不存在<br/>"; error++; continue; } model.Role_id = role_model.Role_id; //生日 //string birthday = ds.Tables[0].Rows[i]["生日"].ToString().Trim(); //if (!ValidDFValue(birthday, false, "", ref checkmsg)) //{ // result += "×第" + (i + 1).ToString() + "行数据更新失败,生日" + checkmsg + "<br/>"; // error++; // continue; //} //else if (birthday != "") //{ // if (!Validator.IsBirthday(birthday)) // { // result += "×第" + (i + 1).ToString() + "行数据更新失败,生日格式不对<br/>"; // error++; // continue; // } // model.User_birthday = Convert.ToDateTime(birthday); //} //model.User_password = mobile; ////教师职称 //string title = ds.Tables[0].Rows[i]["教师职称"].ToString().Trim(); //BLL.CCOM.Title title_bll = new BLL.CCOM.Title(); //Model.CCOM.Title title_model = new Model.CCOM.Title(); //title_model = title_bll.GetModel(" Title_name='" + title + "'"); //if (title_model == null) //{ // result += "×第" + (i + 1).ToString() + "行数据更新失败,该教师职称不存在<br/>"; // error++; // continue; //} //else if (!ValidDFValue(title, true, "", ref checkmsg)) //{ // result += "×第" + (i + 1).ToString() + "行数据更新失败,教师职称<br/>"; // error++; // continue; //} model.User_password = DESEncrypt.MD5Encrypt(mobile); if (bll.Add(model) == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { success++; BLL.CCOM.User_information user_bll = new BLL.CCOM.User_information(); Model.CCOM.User_information user_model = user_bll.GetModel("User_number='" + mobile + "'"); if (model.Role_id == 2) //如果为指导教师,插入Tutor表 { BLL.CCOM.Tutor tutor_bll = new BLL.CCOM.Tutor(); Model.CCOM.Tutor tutor_model = new Model.CCOM.Tutor(); tutor_model.User_id = user_model.User_id; tutor_model.Title_id = 1; tutor_bll.Add(tutor_model); } if (model.Role_id == 3)//如果为学生,插入Student表 { BLL.CCOM.Student student_bll = new BLL.CCOM.Student(); Model.CCOM.Student student_model = new Model.CCOM.Student(); student_model.User_id = user_model.User_id; student_model.Period_id = 4; student_bll.Add(student_model); } } } return(result); }
protected string ImportDataItem(DataSet ds, ref int success, ref int error)//基础数据 { string result = ""; BLL.CCOM.User_information stu_bll = new BLL.CCOM.User_information(); Model.CCOM.User_information stu_model = new Model.CCOM.User_information(); BLL.CCOM.Topic topic_bll = new BLL.CCOM.Topic(); Model.CCOM.Topic topic_model = new Model.CCOM.Topic(); BLL.CCOM.Topic_relation rela_bll = new BLL.CCOM.Topic_relation(); Model.CCOM.Topic_relation rela_model = new Model.CCOM.Topic_relation(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string checkmsg = null; #region 添加学生信息========================== //学号 string number = ds.Tables[0].Rows[i]["学号"].ToString().Trim(); if (!ValidDFValue(number, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,学号" + checkmsg + "<br/>"; error++; continue; } else if (stu_bll.GetModel(" User_number='" + number + "'") != null) { stu_model = stu_bll.GetModel(" User_number='" + number + "'"); } else if (number != "") { stu_model.User_number = number; } //姓名 string name = ds.Tables[0].Rows[i]["姓名"].ToString().Trim(); if (!ValidDFValue(name, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,姓名" + checkmsg + "<br/>"; error++; continue; } else if (name != "") { stu_model.User_realname = name; } //性别 //string gender = ds.Tables[0].Rows[i]["性别"].ToString().Trim(); //if (!ValidDFValue(gender, true, "男|女", ref checkmsg)) //{ // result += "×第" + (i + 1).ToString() + "行数据更新失败,性别" + checkmsg + "<br/>"; // error++; // continue; //} //else if (gender == "男") //{ // stu_model.User_gender = false; //} //else if (gender == "女") //{ // stu_model.User_gender = true; //} //机构 stu_model.User_gender = false; string angency = ds.Tables[0].Rows[i]["行政班"].ToString().Trim(); if (!ValidDFValue(angency, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,所在班号" + checkmsg + "<br/>"; error++; continue; } BLL.CCOM.Agency agency_bll = new BLL.CCOM.Agency(); Model.CCOM.Agency agency_model = new Model.CCOM.Agency(); agency_model = agency_bll.GetModel(" Agency_name='" + angency + "'"); if (agency_model == null) { result += "×第" + (i + 1).ToString() + "行数据更新失败,所在班号不存在<br/>"; error++; continue; } stu_model.Agency_id = agency_model.Agency_id; stu_model.Role_id = 3; stu_model.User_password = DESEncrypt.MD5Encrypt(number); if (stu_bll.GetModel(" User_number='" + number + "'") == null) { stu_model.User_id = stu_bll.Add(stu_model); if (stu_model.User_id == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { BLL.CCOM.User_information user_bll = new BLL.CCOM.User_information(); Model.CCOM.User_information user_model = user_bll.GetModel("User_number='" + number + "'"); BLL.CCOM.Student student_bll = new BLL.CCOM.Student(); Model.CCOM.Student student_model = new Model.CCOM.Student(); student_model.User_id = user_model.User_id; student_model.Period_id = 4; student_bll.Add(student_model); } } else { if (!stu_bll.Update(stu_model)) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } } #endregion #region 更新导师信息========================== var tea_model = new Model.CCOM.Tutor(); //姓名 string tea_name = ds.Tables[0].Rows[i]["指导教师"].ToString().Trim(); if (!ValidDFValue(tea_name, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,指导教师" + checkmsg + "<br/>"; error++; continue; } else if (tea_name != "") { var tea_user_model = new BLL.CCOM.User_information().GetModel(" User_realname='" + tea_name + "'"); if (tea_user_model == null) { result += "×第" + (i + 1).ToString() + "行数据更新失败,指导教师" + tea_name + "不存在<br/>"; error++; continue; } tea_model = new BLL.CCOM.Tutor().GetModel(" User_id=" + tea_user_model.User_id); string title_name = ds.Tables[0].Rows[i]["职称"].ToString().Trim(); if (!ValidDFValue(title_name, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,职称" + checkmsg + "<br/>"; error++; continue; } else if (title_name != "") { var title_model = new BLL.CCOM.Title().GetModel(" Title_name='" + title_name + "'"); if (title_model == null) { result += "×第" + (i + 1).ToString() + "行数据更新失败,职称" + title_name + "不存在<br/>"; error++; continue; } tea_model.Title_id = title_model.Title_id; if (!new BLL.CCOM.Tutor().Update(tea_model)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,更新导师信息失败<br/>"; error++; continue; } } } #endregion #region 导入选题信息========================== string topic_name = ds.Tables[0].Rows[i]["毕业设计题目"].ToString().Trim(); if (!ValidDFValue(topic_name, true, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,题目名称" + checkmsg + "<br/>"; error++; continue; } else if (topic_name != "") { topic_model.Topic_name = topic_name; } string Topic_nature = ds.Tables[0].Rows[i]["题目性质"].ToString().Trim(); if (!ValidDFValue(Topic_nature, false, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,题目性质" + checkmsg + "<br/>"; error++; continue; } else if (Topic_nature != "") { topic_model.Topic_nature = Topic_nature; } string Topic_source = ds.Tables[0].Rows[i]["题目来源"].ToString().Trim(); if (!ValidDFValue(Topic_source, false, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,题目来源" + checkmsg + "<br/>"; error++; continue; } else if (Topic_source != "") { topic_model.Topic_source = Topic_source; } string Topic_content = ds.Tables[0].Rows[i]["题目详情"].ToString().Trim(); if (!ValidDFValue(Topic_content, false, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,题目详情" + checkmsg + "<br/>"; error++; continue; } else if (Topic_content != "") { topic_model.Topic_content = Topic_content; } string Topic_task = ds.Tables[0].Rows[i]["任务书"].ToString().Trim(); if (!ValidDFValue(Topic_task, false, "", ref checkmsg)) { result += "×第" + (i + 1).ToString() + "行数据更新失败,任务书" + checkmsg + "<br/>"; error++; continue; } else if (Topic_task != "") { topic_model.Topic_task = Topic_task; } topic_model.Selected_state = true; topic_model.Check_state = 1; topic_model.Teacher_id = tea_model.User_id; topic_model.Company = "软件学院"; topic_model.Topic_id = topic_bll.Add(topic_model); if (topic_model.Topic_id == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } #endregion #region 题对应关系信息========================== if (rela_bll.GetModel(" Student_id=" + stu_model.User_id) != null && rela_bll.GetModel(" Student_id=" + stu_model.User_id).Accept_state != 2) { result += "×第" + (i + 1).ToString() + "行学生选题对应关系更新异常,该学生已经在系统有选题记录!<br/>"; error++; continue; } rela_model.Student_id = stu_model.User_id; rela_model.Teacher_id = tea_model.User_id; rela_model.Topic_id = topic_model.Topic_id; rela_model.Accept_state = 1; rela_model.Apply_time = DateTime.Now; rela_model.Topic_relation_id = rela_bll.Add(rela_model); if (rela_model.Topic_relation_id == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { success++; } #endregion } return(result); }