protected String GetName(int id) { switch (this.selectid) { case "1": bll_province = new BLL.CCOM.Province(); return(bll_province.GetModel(" " + selectIndex + "=" + id).Province_name); case "2": bll_politics = new BLL.CCOM.Politics(); return(bll_politics.GetModel(" " + selectIndex + "=" + id).Politics_name); case "3": bll_nationality = new BLL.CCOM.Nationality(); return(bll_nationality.GetModel(" " + selectIndex + "=" + id).Nationality_name); case "4": bll_nation = new BLL.CCOM.Nation(); return(bll_nation.GetModel(" " + selectIndex + "=" + id).Nation_name); case "5": bll_musical_instrument = new BLL.CCOM.Musical_instrument(); return(bll_musical_instrument.GetModel(" " + selectIndex + "=" + id).Mi_name); case "6": bll_degree = new BLL.CCOM.Degree(); return(bll_degree.GetModel(" " + selectIndex + "=" + id).Degree_name); case "7": bll_certivicate_type = new BLL.CCOM.Certificate_type(); return(bll_certivicate_type.GetModel(" " + selectIndex + "=" + id).Ct_name); default: return(""); } }
//tab1=================== #region 数据绑定================================= private void RptBind(string _strWhere, string _order) { int pageSize = GetPageSize(15); //每页数量 int page = MyRequest.GetQueryInt("page", 1); //string keywords = MyRequest.GetQueryString("keywords"); string keywords = this.keywordTab0; int start_index = pageSize * (page - 1) + 1; int end_index = pageSize * page; this.txtKeywords.Text = keywords; int totalCount = 0; switch (this.ddlResourceType.SelectedValue) { case "1": bll_province = new BLL.CCOM.Province(); totalCount = bll_province.GetRecordCount(_strWhere); this.rptList.DataSource = bll_province.GetListByPage(_strWhere, _order, start_index, end_index); break; case "2": bll_politics = new BLL.CCOM.Politics(); totalCount = bll_politics.GetRecordCount(_strWhere); this.rptList.DataSource = bll_politics.GetListByPage(_strWhere, _order, start_index, end_index); break; case "3": bll_nationality = new BLL.CCOM.Nationality(); totalCount = bll_nationality.GetRecordCount(_strWhere); this.rptList.DataSource = bll_nationality.GetListByPage(_strWhere, _order, start_index, end_index); break; case "4": bll_nation = new BLL.CCOM.Nation(); totalCount = bll_nation.GetRecordCount(_strWhere); this.rptList.DataSource = bll_nation.GetListByPage(_strWhere, _order, start_index, end_index); break; case "5": bll_musical_instrument = new BLL.CCOM.Musical_instrument(); totalCount = bll_musical_instrument.GetRecordCount(_strWhere); this.rptList.DataSource = bll_musical_instrument.GetListByPage(_strWhere, _order, start_index, end_index); break; case "6": bll_degree = new BLL.CCOM.Degree(); totalCount = bll_degree.GetRecordCount(_strWhere); this.rptList.DataSource = bll_degree.GetListByPage(_strWhere, _order, start_index, end_index); break; case "7": bll_certivicate_type = new BLL.CCOM.Certificate_type(); totalCount = bll_certivicate_type.GetRecordCount(_strWhere); this.rptList.DataSource = bll_certivicate_type.GetListByPage(_strWhere, _order, start_index, end_index); break; default: break; } this.rptList.DataBind(); //绑定页码 txtPageNum.Text = pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("ResourceList.aspx", "fun_id={0}&keywords={1}&page={2}&selectid={3}", DESEncrypt.Encrypt(this.fun_id), keywords, "__id__", this.ddlResourceType.SelectedValue); this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true); }
public String GetResourseName(String signId) { switch (this.ddlResourceType.SelectedValue) { case "1": Model.CCOM.Province model_province = new BLL.CCOM.Province().GetModel(" Province_id=" + signId); if (model_province != null) { return(model_province.Province_name); } return(""); case "2": Model.CCOM.Politics model_politics = new BLL.CCOM.Politics().GetModel(" Politics_id=" + signId); if (model_politics != null) { return(model_politics.Politics_name); } return(""); case "3": Model.CCOM.Nationality model_nationality = new BLL.CCOM.Nationality().GetModel(" Nationality_id=" + signId); if (model_nationality != null) { return(model_nationality.Nationality_name); } return(""); case "4": Model.CCOM.Nation model_nation = new BLL.CCOM.Nation().GetModel(" Nation_id=" + signId); if (model_nation != null) { return(model_nation.Nation_name); } return(""); case "5": Model.CCOM.Musical_instrument model_musical_instrument = new BLL.CCOM.Musical_instrument().GetModel(" Mi_id=" + signId); if (model_musical_instrument != null) { return(model_musical_instrument.Mi_name); } return(""); case "6": Model.CCOM.Degree model_degree = new BLL.CCOM.Degree().GetModel(" Degree_id=" + signId); if (model_degree != null) { return(model_degree.Degree_name); } return(""); case "7": Model.CCOM.Certificate_type model_certificate_type = new BLL.CCOM.Certificate_type().GetModel(" Ct_id=" + signId); if (model_certificate_type != null) { return(model_certificate_type.Ct_name); } return(""); default: return(""); } }
//删除 protected void lbtSingleDelete_Click(object sender, EventArgs e) { var lbtn = sender as LinkButton; if (lbtn != null) { var id = Int32.Parse(DESEncrypt.Decrypt(lbtn.ToolTip.ToString())); bool result = true; try { switch (this.ddlResourceType.SelectedValue) { case "1": bll_province = new BLL.CCOM.Province(); result = bll_province.Delete(id); break; case "2": bll_politics = new BLL.CCOM.Politics(); result = bll_politics.Delete(id); break; case "3": bll_nationality = new BLL.CCOM.Nationality(); result = bll_nationality.Delete(id); break; case "4": bll_nation = new BLL.CCOM.Nation(); result = bll_nation.Delete(id); break; case "5": bll_musical_instrument = new BLL.CCOM.Musical_instrument(); result = bll_musical_instrument.Delete(id); break; case "6": bll_degree = new BLL.CCOM.Degree(); result = bll_degree.Delete(id); break; case "7": bll_certivicate_type = new BLL.CCOM.Certificate_type(); result = bll_certivicate_type.Delete(id); break; default: break; } } catch { result = false; } string keywords = this.keywordTab0; int page = MyRequest.GetQueryInt("page", 1); if (result == true) { JscriptMsg("删除成功!", Utils.CombUrlTxt("ResourceList.aspx", "fun_id={0}&keywords={1}&page={2}&selectid={3}", DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString(), this.ddlResourceType.SelectedValue), "Success"); } else { JscriptMsg("删除失败!", Utils.CombUrlTxt("ResourceList.aspx", "fun_id={0}&keywords={1}&page={2}&selectid={3}", DESEncrypt.Encrypt(this.fun_id), keywords, page.ToString(), this.ddlResourceType.SelectedValue), "Error"); } } }
protected string ImportDataItem(DataSet ds, ref int success, ref int error)//基础数据 { string result = ""; BLL.CCOM.Province bll_Province = new BLL.CCOM.Province(); Model.CCOM.Province model_Province = new Model.CCOM.Province(); BLL.CCOM.Politics bll_Politics = new BLL.CCOM.Politics(); Model.CCOM.Politics model_Politics = new Model.CCOM.Politics(); BLL.CCOM.Nationality bll_Nationality = new BLL.CCOM.Nationality(); Model.CCOM.Nationality model_Nationality = new Model.CCOM.Nationality(); BLL.CCOM.Nation bll_Nation = new BLL.CCOM.Nation(); Model.CCOM.Nation model_Nation = new Model.CCOM.Nation(); BLL.CCOM.Musical_instrument bll_Musical_instrument = new BLL.CCOM.Musical_instrument(); Model.CCOM.Musical_instrument model_Musical_instrument = new Model.CCOM.Musical_instrument(); BLL.CCOM.Degree bll_Degree = new BLL.CCOM.Degree(); Model.CCOM.Degree model_Degree = new Model.CCOM.Degree(); BLL.CCOM.Certificate_type bll_Certificate_type = new BLL.CCOM.Certificate_type(); Model.CCOM.Certificate_type model_Certificate_type = new Model.CCOM.Certificate_type(); 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; } switch (this.ddlResourceType.SelectedValue) { case "1": if (name != "") { model_Province.Province_name = name; } if (bll_Province.GetModel(" Province_name='" + name + "'") != null) { result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>"; error++; continue; } else if (bll_Province.Add(model_Province) == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { success++; } break; case "2": if (name != "") { model_Politics.Politics_name = name; } if (bll_Politics.GetModel(" Politics_name='" + name + "'") != null) { result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>"; error++; continue; } else if (bll_Politics.Add(model_Politics) == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { success++; } break; case "3": if (name != "") { model_Nationality.Nationality_name = name; } if (bll_Nationality.GetModel(" Nationality_name='" + name + "'") != null) { result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>"; error++; continue; } else if (bll_Nationality.Add(model_Nationality) == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { success++; } break; case "4": if (name != "") { model_Nation.Nation_name = name; } if (bll_Nation.GetModel(" Nation_name='" + name + "'") != null) { result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>"; error++; continue; } else if (bll_Nation.Add(model_Nation) == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { success++; } break; case "5": if (name != "") { model_Musical_instrument.Mi_name = name; } if (bll_Musical_instrument.GetModel(" Mi_name='" + name + "'") != null) { result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>"; error++; continue; } else if (bll_Musical_instrument.Add(model_Musical_instrument) == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { success++; } break; case "6": if (name != "") { model_Degree.Degree_name = name; } if (bll_Degree.GetModel(" Degree_name='" + name + "'") != null) { result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>"; error++; continue; } else if (bll_Degree.Add(model_Degree) == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { success++; } break; case "7": if (name != "") { model_Certificate_type.Ct_name = name; } if (bll_Certificate_type.GetModel(" Ct_name='" + name + "'") != null) { result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>"; error++; continue; } else if (bll_Certificate_type.Add(model_Certificate_type) == 0) { result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>"; error++; continue; } else { success++; } break; default: break; } } return(result); }
protected void BindSignInfo(long signId) { this.ddlResourceType.SelectedValue = selectid; switch (this.selectid) { case "1": Model.CCOM.Province model_province = new BLL.CCOM.Province().GetModel(" Province_id=" + signId); if (model_province != null) { this.nameText.Text = model_province.Province_name; } else { JscriptMsg("传输参数不正确!", "back", "Error"); } break; case "2": Model.CCOM.Politics model_politics = new BLL.CCOM.Politics().GetModel(" Politics_id=" + signId); if (model_politics != null) { this.nameText.Text = model_politics.Politics_name; } else { JscriptMsg("传输参数不正确!", "back", "Error"); } break; case "3": Model.CCOM.Nationality model_nationality = new BLL.CCOM.Nationality().GetModel(" Nationality_id=" + signId); if (model_nationality != null) { this.nameText.Text = model_nationality.Nationality_name; } else { JscriptMsg("传输参数不正确!", "back", "Error"); } break; case "4": Model.CCOM.Nation model_nation = new BLL.CCOM.Nation().GetModel(" Nation_id=" + signId); if (model_nation != null) { this.nameText.Text = model_nation.Nation_name; } else { JscriptMsg("传输参数不正确!", "back", "Error"); } break; case "5": Model.CCOM.Musical_instrument model_musical_instrument = new BLL.CCOM.Musical_instrument().GetModel(" Mi_id=" + signId); if (model_musical_instrument != null) { this.nameText.Text = model_musical_instrument.Mi_name; } else { JscriptMsg("传输参数不正确!", "back", "Error"); } break; case "6": Model.CCOM.Degree model_degree = new BLL.CCOM.Degree().GetModel(" Degree_id=" + signId); if (model_degree != null) { this.nameText.Text = model_degree.Degree_name; } else { JscriptMsg("传输参数不正确!", "back", "Error"); } break; case "7": Model.CCOM.Certificate_type model_certificate_type = new BLL.CCOM.Certificate_type().GetModel(" Ct_id=" + signId); if (model_certificate_type != null) { this.nameText.Text = model_certificate_type.Ct_name; } else { JscriptMsg("传输参数不正确!", "back", "Error"); } break; default: break; } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { String select = this.ddlResourceType.SelectedValue; String name = this.nameText.Text; if (name == "") { JscriptMsg("资源名称不能为空!", "", "Error"); return; } if (select == "") { JscriptMsg("资源类型不能为空!", "", "Error"); return; } if (Tools.CheckParams(name + select)) { JscriptMsg("输入参数不合法!", "", "Error"); return; } if (action == MyEnums.ActionEnum.Edit.ToString()) //修改 { if (signId != 0) { string pageUrl = Utils.CombUrlTxt("ResourceList.aspx", "fun_id={0}&selectid={1}", DESEncrypt.Encrypt(this.fun_id), selectid); switch (select) { case "1": Model.CCOM.Province model_province = new BLL.CCOM.Province().GetModel(" Province_id=" + signId); if (model_province != null) { model_province.Province_name = name; if (new BLL.CCOM.Province().GetModel(" Province_name='" + name + "'") != null) { JscriptMsg("系统中已有该资源!", "", "Error"); } else if (new BLL.CCOM.Province().Update(model_province)) { JscriptMsg("生源地编辑成功!^_^", pageUrl, "Success"); } else { JscriptMsg("出现异常,生源地编辑失败!", "", "Error"); } } break; case "2": Model.CCOM.Politics model_politics = new BLL.CCOM.Politics().GetModel(" Politics_id=" + signId); if (model_politics != null) { model_politics.Politics_name = name; if (new BLL.CCOM.Politics().GetModel(" Politics_name='" + name + "'") != null) { JscriptMsg("系统中已有该资源!", "", "Error"); } else if (new BLL.CCOM.Politics().Update(model_politics)) { JscriptMsg("政治面貌编辑成功!^_^", pageUrl, "Success"); } else { JscriptMsg("出现异常,政治面貌编辑失败!", "", "Error"); } } break; case "3": Model.CCOM.Nationality model_nationality = new BLL.CCOM.Nationality().GetModel(" Nationality_id=" + signId); if (model_nationality != null) { model_nationality.Nationality_name = name; if (new BLL.CCOM.Nationality().GetModel(" Nationality_name='" + name + "'") != null) { JscriptMsg("系统中已有该资源!", "", "Error"); } else if (new BLL.CCOM.Nationality().Update(model_nationality)) { JscriptMsg("民族编辑成功!^_^", pageUrl, "Success"); } else { JscriptMsg("出现异常,民族编辑失败!", "", "Error"); } } break; case "4": Model.CCOM.Nation model_nation = new BLL.CCOM.Nation().GetModel(" Nation_id=" + signId); if (model_nation != null) { model_nation.Nation_name = name; if (new BLL.CCOM.Nation().GetModel(" Nation_name='" + name + "'") != null) { JscriptMsg("系统中已有该资源!", "", "Error"); } else if (new BLL.CCOM.Nation().Update(model_nation)) { JscriptMsg("国籍编辑成功!^_^", pageUrl, "Success"); } else { JscriptMsg("出现异常,国籍编辑失败!", "", "Error"); } } break; case "5": Model.CCOM.Musical_instrument model_musical_instrument = new BLL.CCOM.Musical_instrument().GetModel(" Mi_id=" + signId); if (model_musical_instrument != null) { model_musical_instrument.Mi_name = name; if (new BLL.CCOM.Musical_instrument().GetModel(" Mi_name='" + name + "'") != null) { JscriptMsg("系统中已有该资源!", "", "Error"); } else if (new BLL.CCOM.Musical_instrument().Update(model_musical_instrument)) { JscriptMsg("乐器编辑成功!^_^", pageUrl, "Success"); } else { JscriptMsg("出现异常,乐器编辑失败!", "", "Error"); } } break; case "6": Model.CCOM.Degree model_degree = new BLL.CCOM.Degree().GetModel(" Degree_id=" + signId); if (model_degree != null) { model_degree.Degree_name = name; if (new BLL.CCOM.Degree().GetModel(" Degree_name='" + name + "'") != null) { JscriptMsg("系统中已有该资源!", "", "Error"); } else if (new BLL.CCOM.Degree().Update(model_degree)) { JscriptMsg("教育程度编辑成功!^_^", pageUrl, "Success"); } else { JscriptMsg("出现异常,教育程度编辑失败!", "", "Error"); } } break; case "7": Model.CCOM.Certificate_type model_certificate_type = new BLL.CCOM.Certificate_type().GetModel(" Ct_id=" + signId); if (model_certificate_type != null) { model_certificate_type.Ct_name = name; if (new BLL.CCOM.Certificate_type().GetModel(" Ct_name='" + name + "'") != null) { JscriptMsg("系统中已有该资源!", "", "Error"); } else if (new BLL.CCOM.Certificate_type().Update(model_certificate_type)) { JscriptMsg("证件类型编辑成功!^_^", pageUrl, "Success"); } else { JscriptMsg("出现异常,证件类型编辑失败!", "", "Error"); } } break; default: break; } } } else { //add string pageUrl = Utils.CombUrlTxt("ResourceList.aspx", "fun_id={0}&selectid={1}", DESEncrypt.Encrypt(this.fun_id), select); int id = 0; switch (select) { case "1": Model.CCOM.Province model_province = new Model.CCOM.Province(); model_province.Province_name = name; if (new BLL.CCOM.Province().GetModel(" Province_name='" + name + "'") != null) { id = -100; } else { id = new BLL.CCOM.Province().Add(model_province); } break; case "2": Model.CCOM.Politics model_politics = new Model.CCOM.Politics(); model_politics.Politics_name = name; if (new BLL.CCOM.Politics().GetModel(" Politics_name='" + name + "'") != null) { id = -100; } else { id = new BLL.CCOM.Politics().Add(model_politics); } break; case "3": Model.CCOM.Nationality model_nationality = new Model.CCOM.Nationality(); model_nationality.Nationality_name = name; if (new BLL.CCOM.Nationality().GetModel(" Nationality_name='" + name + "'") != null) { id = -100; } else { id = new BLL.CCOM.Nationality().Add(model_nationality); } break; case "4": Model.CCOM.Nation model_nation = new Model.CCOM.Nation(); model_nation.Nation_name = name; if (new BLL.CCOM.Nation().GetModel(" Nation_name='" + name + "'") != null) { id = -100; } else { id = new BLL.CCOM.Nation().Add(model_nation); } break; case "5": Model.CCOM.Musical_instrument model_musical_instrument = new Model.CCOM.Musical_instrument(); model_musical_instrument.Mi_name = name; if (new BLL.CCOM.Musical_instrument().GetModel(" Mi_name='" + name + "'") != null) { id = -100; } else { id = new BLL.CCOM.Musical_instrument().Add(model_musical_instrument); } break; case "6": Model.CCOM.Degree model_degree = new Model.CCOM.Degree(); model_degree.Degree_name = name; if (new BLL.CCOM.Degree().GetModel(" Degree_name='" + name + "'") != null) { id = -100; } else { id = new BLL.CCOM.Degree().Add(model_degree); } break; case "7": Model.CCOM.Certificate_type model_certificate_type = new Model.CCOM.Certificate_type(); model_certificate_type.Ct_name = name; if (new BLL.CCOM.Certificate_type().GetModel(" Ct_name='" + name + "'") != null) { id = -100; } else { id = new BLL.CCOM.Certificate_type().Add(model_certificate_type); } break; default: break; } if (id > 0) { JscriptMsg("添加资源成功!^_^", pageUrl, "Success"); } else if (id == -100) { JscriptMsg("系统中已有该资源!", "", "Error"); } else { JscriptMsg("出现异常,添加资源失败!", "", "Error"); } } }