protected void BtnUpdate_Click(object sender, EventArgs e) { //判断session if (Session["User"] == null || Session["User"].ToString().Length < 1) { Response.Redirect(Request.RawUrl); } try { if (ValiEdit()) { DBLL.clsLink Link = new DBLL.clsLink(); DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL(); string sThumbPath = ""; if (int.Parse(ddlnType.SelectedValue) == 1) { sThumbPath = "~/style/images/thumb/Msn.png"; } else if (int.Parse(ddlnType.SelectedValue) == 2) { sThumbPath = "~/style/images/thumb/Email.png"; } else if (int.Parse(ddlnType.SelectedValue) == 3) { sThumbPath = "~/style/images/thumb/Skype.png"; } else if (int.Parse(ddlnType.SelectedValue) == 4) { sThumbPath = "~/style/images/thumb/QQ.png"; } bool _Result = Link.update_tb_LinkBynLinkID(int.Parse(hfLinkUpdateID.Value), ddlnType.Text, sThumbPath, txtsLink.Text, Session["user"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue)); if (_Result == true) { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess"); ShowMsg1.Show(); MultiView1.ActiveViewIndex = 0; ReBindPageList(); } else { //失败就一条 ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail"); ShowMsg1.Show(); } } } catch (Exception) { throw; } }
protected void lvLinkList_SelectedIndexChanging(object sender, ListViewSelectEventArgs e) { Label lblnID = (Label)lvLinkList.Items[e.NewSelectedIndex].FindControl("lblnLinkID"); int _nID = 0; DBLL.clsLink Link = new DBLL.clsLink(); if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0) { MultiView1.ActiveViewIndex = 1; DataTable dt = Link.Select_tb_LinkBynLinkID(_nID); ddlnType.Text = dt.Rows[0]["nType"].ToString(); txtsLink.Text = dt.Rows[0]["sLink"].ToString(); ddlnSorting.SelectedValue = dt.Rows[0]["nSorting"].ToString(); hfLinkUpdateID.Value = _nID.ToString(); } }
protected void BtnAdd_Click(object sender, EventArgs e) { //判断session if (Session["User"] == null || Session["User"].ToString().Length < 1) { Response.Redirect(Request.RawUrl); } if (ValiAdd()) { DBLL.clsLink Link = new DBLL.clsLink(); DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL(); string sThumbPath = ""; if (int.Parse(ddlnType.SelectedValue) == 1) { sThumbPath = "~/style/images/thumb/Msn.png"; } else if (int.Parse(ddlnType.SelectedValue) == 2) { sThumbPath = "~/style/images/thumb/Email.png"; } else if (int.Parse(ddlnType.SelectedValue) == 3) { sThumbPath = "~/style/images/thumb/Skype.png"; } else if (int.Parse(ddlnType.SelectedValue) == 4) { sThumbPath = "~/style/images/thumb/QQ.png"; } int _Result = Link.insert_tb_Link(ddlnType.Text, sThumbPath, txtsLink.Text, Session["User"].ToString(), DateTime.Now, Session["User"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue)); 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(); } }
public void ReBindPageList() { DBLL.clsLink Link = new DBLL.clsLink(); DataTable dt = new DataTable(); dt = Link.sp_selectNormalTableOfAllByLink(false); if (dt != null) { LinkList.Merge(dt); lvLinkList.DataSource = LinkList; lvLinkList.DataBind(); } else { lvLinkList.DataSource = null; lvLinkList.DataBind(); } }