protected void btnSave_Click(object sender, EventArgs e) { if (clientcode.Text.Trim() != null && clientcode.Text.Trim() != "") { HP_Client model = new HP_Client(); HPClientDAL dal = new HPClientDAL(); if (clientcode.Text.Trim() != null && clientcode.Text.Trim() != "") { model.ClientCode = clientcode.Text; } model.ID = strID; model.IsDel = 0; if (dal.IsExist(clientcode.Text)) { MessageBox.Show(this, "该信息已经存在,请不要重复添加!"); return; } if (dal.UpdateHPClient(model)) { MessageBox.Show(this, "操作成功!"); } else { MessageBox.Show(this, "操作失败!"); } } else { MessageBox.Show(this, "名称不能为空!"); return; } }
protected void Page_Load(object sender, EventArgs e) { if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } HPClientDAL dal = new HPClientDAL(); switch (strAction) { case "del": if (dal.UpHpClientState(strID)) { strMessage = "操作成功!"; } else { strMessage = "操作失败!"; } break; default: break; } Response.Write(strMessage); Response.End(); }
protected void btnSave_Click(object sender, EventArgs e) { if (clientcode.Text.Trim() != null && clientcode.Text.Trim() != "") { HP_Client model = new HP_Client(); HPClientDAL dal = new HPClientDAL(); if (clientcode.Text.Trim() != null && clientcode.Text.Trim() != "") { model.ClientCode = clientcode.Text; } model.ID = Guid.NewGuid().ToString("N").ToUpper(); model.IsDel = 0; model.SiteCode = Session["strSiteCode"].ToString(); if (dal.IsExist(clientcode.Text)) { MessageBox.Show(this, "该信息已经存在,请不要重复添加!"); return; } if (dal.AddHPClient(model)) { MessageBox.Show(this, "操作成功!"); } else { MessageBox.Show(this, "操作失败!"); } } else { MessageBox.Show(this, "名称不能为空!"); return; } }
void ShowInfo() { HPClientDAL dal = new HPClientDAL(); DataSet ds = dal.GetHpClientDetail(strID); HP_Client model = DataConvert.DataRowToModel <HP_Client>(ds.Tables[0].Rows[0]); clientcode.Text = model.ClientCode; if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; } }
/// <summary> /// 加载数据 /// </summary> /// <param name="strWhere">条件</param> void LoadData(string strWhere) { txtTitle.Text = ""; HPClientDAL dal = new HPClientDAL(); DataSet ds = dal.GetPrintClientList(strWhere); DataView dv = ds.Tables[0].DefaultView; AspNetPager1.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; Repeater1.DataSource = pds; Repeater1.DataBind(); }