protected override void AjaxProcess() { BellCardModel model = new BellCardModel(); string noticeJson = null; DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(Request.Form["BellNo"])) { model.BellNo = Request.Form["BellNo"]; dt = bll.GetBellCard(model, pager.CurrentPageIndex, pager.PageSize, out totalCount); if (dt != null) { noticeJson = dt.Rows.Count.ToString(); } Response.Clear(); Response.Write(noticeJson); Response.End(); } }
/// <summary> /// 卡鐘下拉列表綁定數據 /// </summary> protected void ddlBellNoDataBind() { DataTable bellCardInfo = new DataTable(); BellCardModel bellCardModel = new BellCardModel(); bellCardModel.BellType = "KQM"; bellCardModel.EffectFlag = "Y"; bellCardInfo = BellCardBll.GetKQMBellCard(bellCardModel); this.ddlBellNo.DataSource = bellCardInfo.DefaultView; this.ddlBellNo.DataTextField = "BELLNO"; this.ddlBellNo.DataValueField = "BELLNO"; this.ddlBellNo.DataBind(); }
/// <summary> /// 綁定數據 /// </summary> private void DataBind() { txtBellNo.Attributes.Add("readonly", "true"); txtPortIP.Attributes.Add("readonly", "true"); txtProduceID.Attributes.Add("readonly", "true"); txtManufacturer.Attributes.Add("readonly", "true"); txtAddress.Attributes.Add("readonly", "true"); txtBellSize.Attributes.Add("readonly", "true"); txtPickDataIP.Attributes.Add("readonly", "true"); txtPickComputeUser.Attributes.Add("readonly", "true"); txtPickComputePW.Attributes.Add("readonly", "true"); txtContactMan.Attributes.Add("readonly", "true"); txtContactTel.Attributes.Add("readonly", "true"); txtUseDept.Attributes.Add("readonly", "true"); txtUserYM.Attributes.Add("readonly", "true"); txtRemark.Attributes.Add("readonly", "true"); ddlBellType.Attributes.Add("disabled", "true"); btnSave.Attributes.Add("disabled", "true"); btnCancel.Attributes.Add("disabled", "true"); ddlBellType.DataSource = bll.GetBellType(); ddlBellType.DataValueField = "datacode"; ddlBellType.DataTextField = "datavalue"; ddlBellType.DataBind(); this.ddlBellType.Items.Insert(0, new ListItem("", "")); this.ddlBellType.SelectedValue = ""; BellCardModel model = new BellCardModel(); DataTable dt = bll.GetBellCard(model, pager.CurrentPageIndex, pager.PageSize, out totalCount); pager.RecordCount = totalCount; dt_global = dt; this.UltraWebGridBellCard.DataSource = dt; this.UltraWebGridBellCard.DataBind(); pager.TextAfterPageIndexBox = "/" + pager.PageCount.ToString(); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { BellCardModel model = PageHelper.GetModel<BellCardModel>(pnlContent.Controls); bool succeed; if (hidOperate.Value == "modify") { logmodel.ProcessFlag = "update"; succeed = bll.UpdateBellCardByKey(model, logmodel); if (succeed) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.UpdateSuccess + "');", true); DataBind(); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.UpdateFailed + "');", true); } } if (hidOperate.Value == "add") { logmodel.ProcessFlag = "insert"; BellCardModel model1 = new BellCardModel(); model1.BellNo = txtBellNo.Text.ToUpper(); if (bll.GetBellCard(model1, pager.CurrentPageIndex, pager.PageSize, out totalCount).Rows.Count == 0) { succeed = bll.AddBellCard(model, logmodel); if (succeed) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.AddSuccess + "');", true); DataBind(); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.AddFailed + "');", true); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "isnumber", "alert('" + Message.NotOnlyOne + "');", true); } } }