protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { lab_Error.Text = ""; try { BindType(); if (Request.QueryString["Recruitment"] != null) { if (Request.QueryString["Recruitment"].ToString() == "yes") { Web_Module model = new Web_Module(); string recruitment = "Recruitment"; Web_Module temp = Web_Module.LoadByModuleCode(recruitment); if (temp == null) { model.Module_Code = "Recruitment"; model.Module_Name = "招聘信息"; model.Module_IsParent = 0; model.Save(); } BindType(); ddl_module.SelectedValue = "Recruitment"; ddl_module.Enabled = false; } } } catch (Exception ex) { lab_Error.Text = "错误信息:"+ex.Message; } } }
/// <summary> /// 添加新闻类型 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Add_Click(object sender, EventArgs e) { lab_Error.Text = ""; Web_Module model = new Web_Module(); model.Module_Code =txt_ModuleCode.Text.Trim(); model.Module_Name = txt_ModuleName.Text.Trim(); model.Module_IsParent = 0; Web_Module temp = Web_Module.LoadByModuleCode(txt_ModuleCode.Text.Trim()); if (temp != null) { lab_Error.Text = "新闻类别编号已存在"; return; } try { model.Save(); } catch (Exception ex) { lab_Error.Text = "错误信息:"+ex.Message; } lab_Error.Text = "添加新闻类型成功"; BindData(); txt_ModuleCode.Text = string.Empty; txt_ModuleName.Text = string.Empty; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List<CY.GeneralPrivilege.Core.Business.Permission> plist = Session["User_Privilege"] as List<CY.GeneralPrivilege.Core.Business.Permission>; if (plist != null) { foreach (CY.GeneralPrivilege.Core.Business.Permission p in plist) { if (p.PermissionName == "招聘信息管理") { isManage = true; break; } } } BindGridviewRowState(isManage); BindType(); BindData(); if (Request.QueryString["Recruitment"] != null) { try { if (Request.QueryString["Recruitment"].ToString() == "yes") { Web_Module model = new Web_Module(); string recruitment = "Recruitment"; Web_Module temp = Web_Module.LoadByModuleCode(recruitment); if (temp == null) { model.Module_Code = "Recruitment"; model.Module_Name = "招聘信息"; model.Module_IsParent = 0; model.Save(); } BindType(); ddl_module.SelectedValue = "Recruitment"; hid_Info.Value = "yes"; ddl_module.Enabled = false; } } catch(Exception ex) { lab_Error.Text = "错误提示"+ex.Message; } } } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Update_Click(object sender, EventArgs e) { lab_Error.Text = ""; Web_Module model = new Web_Module(); try { if (hid_typeId.Value != null) { model = Web_Module.Load(Convert.ToInt32(hid_typeId.Value)); } model.Module_Code = txt_ModuleCode.Text.Trim(); model.Module_Name = txt_ModuleName.Text.Trim(); Web_Module temp = Web_Module.LoadByModuleCodeandID(model.Id,model.Module_Code); if (temp!=null) { lab_Error.Text = "补助类别编号已存在"; return; } model.Save(); hid_typeId.Value = ""; Page.ClientScript.RegisterStartupScript(typeof(string), "", "alert('修改成功');", true); BindData(); btn_Add.Visible = true; btn_Update.Visible = false; btn_AddModule.Text = "添加新闻类别"; btn_Cancel_Click(sender, e); } catch (Exception ex) { hid_typeId.Value = ""; lab_Error.Text = "错误信息:" + ex.Message; } }