protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataPager1.PageSize = 10; DataPager2.PageSize = 10; DBLL.clsJob clsjob = new DBLL.clsJob(); DBLL.DBcommon dbcon = new DBLL.DBcommon(); DataTable dt = dbcon.selectNormalTableofAll(false, "tb_Jobs"); DataTablejob = dt; lvJobs.DataSource = DataTablejob; lvJobs.DataBind(); PgeInfo(); Panel1.Visible = true; Panel2.Visible = false; if (DataTablejob == null || DataTablejob.Rows.Count < 1) { Label14.Visible = true; } else { Label14.Visible = false; } } OnSetLanguage(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DBLL.clsJob clsjob = new DBLL.clsJob(); DBLL.DBcommon dbcon = new DBLL.DBcommon(); BindData(); lblcur.Text = (lvNews.PageIndex + 1).ToString(); lbltotal.Text = lvNews.PageCount.ToString(); int nNewsID = 0; if (Request.QueryString["nNewsID"] != null && int.TryParse(Request.QueryString["nNewsID"].ToString(), out nNewsID) && nNewsID > 0) { DBLL.clsNews clsnews = new DBLL.clsNews(); DataTable dtnewsone = clsnews.Select_tb_NewsBynNewsID(nNewsID); if (dtnewsone != null && dtnewsone.Rows.Count > 0) { Panel1.Visible = false; Panel2.Visible = true; Label1.Text = dtnewsone.Rows[0]["sTitle"].ToString(); lblsAuthor.Text = dtnewsone.Rows[0]["sAuthor"].ToString(); lblsCreatedBy.Text = dtnewsone.Rows[0]["dCreatedTime"].ToString(); Image1.ImageUrl = dtnewsone.Rows[0]["sImagePath"].ToString(); if (Image1.ImageUrl == "") { Image1.Visible = false; } divNewsdetail.InnerHtml = dtnewsone.Rows[0]["sContent"].ToString(); } } else { Panel1.Visible = true; Panel2.Visible = false; } if (DataTableNews == null || DataTableNews.Rows.Count < 1) { Label14.Visible = true; } else { Label14.Visible = false; } } OnSetLanguage(); }
protected void btnUpdate_Click(object sender, EventArgs e) { //判断session if (Session["User"] == null || Session["User"].ToString().Length < 1) { Response.Redirect(Request.RawUrl); } try { int nID = 0; if (int.TryParse(hfID.Value.ToString(), out nID) && nID > 0) { //更新 if (ValiAdd()) { DBLL.clsJob clJob = new DBLL.clsJob(); DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL(); bool _Result = clJob.update_tb_JobBynJobID(nID, txtsJobPosition.Text, txtsJobAdr.Text, txtsJobYear.Text, txtsJobSalary.Text, txtsJobEducation.Text, txtnJobCount.Text, DateTime.Now, CKEditorControl1.Text, Session["user"].ToString(), DateTime.Now, true, 1, txtsJobPositionEN.Text, txtsJobAdrEN.Text, txtsJobYearEN.Text, txtsJobSalaryEN.Text, txtsJobEducationEN.Text, txtnJobCountEN.Text, CKEditorControl2.Text); if (_Result == true) { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess"); ShowMsg1.Show(); } else { //失败就一条 ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail"); ShowMsg1.Show(); } } else { ShowMsg1.Show(); } } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int nID = 0; if (Request.QueryString["nID"] != null && int.TryParse(Request.QueryString["nID"].ToString(), out nID) && nID > 0) { lblBigtitle.Text = "编辑数据"; BtnAdd.Visible = false; btnUpdate.Visible = true; DBLL.clsJob clJob = new DBLL.clsJob(); DataTable dt = clJob.Select_tb_JobBynJobID(nID); if (dt != null && dt.Rows.Count > 0) { hfID.Value = dt.Rows[0]["nJobID"].ToString(); txtsJobPosition.Text = dt.Rows[0]["sJobPosition"].ToString(); txtsJobAdr.Text = dt.Rows[0]["sJobAdr"].ToString(); txtnJobCount.Text = dt.Rows[0]["nJobCount"].ToString(); CKEditorControl1.Text = dt.Rows[0]["sDetails"].ToString(); txtsJobYear.Text = dt.Rows[0]["sJobYear"].ToString(); txtsJobSalary.Text = dt.Rows[0]["sJobSalary"].ToString(); txtsJobEducation.Text = dt.Rows[0]["sJobEducation"].ToString(); txtsJobPositionEN.Text = dt.Rows[0]["sJobPositionEN"].ToString(); txtsJobAdrEN.Text = dt.Rows[0]["sJobAdrEN"].ToString(); txtnJobCountEN.Text = dt.Rows[0]["nJobCountEN"].ToString(); CKEditorControl2.Text = dt.Rows[0]["sDetailsEN"].ToString(); txtsJobYearEN.Text = dt.Rows[0]["sJobYearEN"].ToString(); txtsJobSalaryEN.Text = dt.Rows[0]["sJobSalaryEN"].ToString(); txtsJobEducationEN.Text = dt.Rows[0]["sJobEducationEN"].ToString(); //绑定数据 } } else { lblBigtitle.Text = "添加数据"; btnUpdate.Visible = false; BtnAdd.Visible = true; } } }
protected void lvJobs_ItemEditing(object sender, ListViewEditEventArgs e) { Label lblnID = (Label)lvJobs.Items[e.NewEditIndex].FindControl("lblnID"); int nID = 0; if (int.TryParse(lblnID.Text.Trim(), out nID) && nID > 0) { DBLL.clsJob dbjob = new DBLL.clsJob(); DataTable dtjob = dbjob.Select_tb_JobBynJobID(nID); if (dtjob != null && dtjob.Rows.Count > 0) { Panel1.Visible = false; Panel2.Visible = true; if (Session["languageGlobal"] == "en") { lblsJobPosition.Text = dtjob.Rows[0]["sJobPositionEN"].ToString(); lblssJobAdr.Text = dtjob.Rows[0]["sJobAdrEN"].ToString(); lblnJobCount.Text = dtjob.Rows[0]["nJobCountEN"].ToString(); lblsJobYear.Text = dtjob.Rows[0]["sJobYearEN"].ToString(); lblsJobSalary.Text = dtjob.Rows[0]["sJobSalaryEN"].ToString(); lblsJobEducation.Text = dtjob.Rows[0]["sJobEducationEN"].ToString(); lblsJobTime.Text = dtjob.Rows[0]["sJobYearEN"].ToString(); divjobdetail.InnerHtml = dtjob.Rows[0]["sDetailsEN"].ToString(); } else { lblsJobPosition.Text = dtjob.Rows[0]["sJobPosition"].ToString(); lblssJobAdr.Text = dtjob.Rows[0]["sJobAdr"].ToString(); lblnJobCount.Text = dtjob.Rows[0]["nJobCount"].ToString(); lblsJobYear.Text = dtjob.Rows[0]["sJobYear"].ToString(); lblsJobSalary.Text = dtjob.Rows[0]["sJobSalary"].ToString(); lblsJobEducation.Text = dtjob.Rows[0]["sJobEducation"].ToString(); lblsJobTime.Text = dtjob.Rows[0]["sJobYear"].ToString(); divjobdetail.InnerHtml = dtjob.Rows[0]["sDetails"].ToString(); } } } }
protected void BtnAdd_Click(object sender, EventArgs e) { try { //判断session if (Session["User"] == null || Session["User"].ToString().Length < 1) { Response.Redirect(Request.RawUrl); } if (ValiAdd()) { DBLL.clsJob clJob = new DBLL.clsJob(); DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL(); int _Result = clJob.insert_tb_Job(txtsJobPosition.Text, txtsJobAdr.Text, txtsJobYear.Text, txtsJobSalary.Text, txtsJobEducation.Text, txtnJobCount.Text, DateTime.Now, CKEditorControl1.Text, Session["User"].ToString(), DateTime.Now, Session["User"].ToString(), DateTime.Now, true, 1, txtsJobPositionEN.Text, txtsJobAdrEN.Text, txtsJobYearEN.Text, txtsJobSalaryEN.Text, txtsJobEducationEN.Text, txtnJobCountEN.Text, CKEditorControl2.Text); if (_Result > 0) { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertSuccess"); ShowMsg1.Show(); Clear(); } else { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertFail"); ShowMsg1.Show(); } } else { ShowMsg1.Show(); } } catch (Exception) { throw; } }