public bool Add(Desktop_Weblink model) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("insert into frame_Desktop_Weblink("); stringBuilder.Append("userCode,orderId,WebName,WebAddr,Remark)"); stringBuilder.Append(" values ("); stringBuilder.Append("@userCode,@orderId,@WebName,@WebAddr,@Remark)"); stringBuilder.Append(";select @@IDENTITY"); SqlParameter[] array = new SqlParameter[] { new SqlParameter("@userCode", SqlDbType.VarChar, 50), new SqlParameter("@orderId", SqlDbType.Int, 4), new SqlParameter("@WebName", SqlDbType.NVarChar, 50), new SqlParameter("@WebAddr", SqlDbType.NVarChar, 100), new SqlParameter("@Remark", SqlDbType.NVarChar, 50) }; array[0].Value = model.userCode; array[1].Value = model.orderId; array[2].Value = model.WebName; array[3].Value = model.WebAddr; array[4].Value = model.Remark; int num = publicDbOpClass.ExecuteNonQuery(CommandType.Text, stringBuilder.ToString(), array); return(num > 0); }
protected void BtnSave_Click(object sender, EventArgs e) { Desktop_Weblink desktop_Weblink = new Desktop_Weblink(); ClientScriptManager arg_11_0 = this.Page.ClientScript; desktop_Weblink.userCode = base.UserCode; string webName = this.txtWebName.Text.ToString(); string text = this.txtWebAddr.Text.ToString(); desktop_Weblink.orderId = 1; if (this.GirdColNum.SelectedItem.Text.ToString() == null) { return; } desktop_Weblink.orderId = Convert.ToInt32(this.GirdColNum.SelectedItem.Text.ToString()); if (!(this.txtWebName.Text.ToString() != "")) { return; } desktop_Weblink.WebName = this.txtWebName.Text.ToString(); if (!(this.txtWebAddr.Text.ToString() != "")) { return; } desktop_Weblink.WebAddr = this.txtWebAddr.Text.ToString(); if (this.txtRemark.Text.ToString() != "") { desktop_Weblink.Remark = this.txtRemark.Text.ToString(); } else { desktop_Weblink.Remark = ""; } if (!UserSet.IsEmail(text)) { base.RegisterScript("top.ui.alert('网址格式不正确!');"); return; } if (this.ExistsWebName(webName)) { base.RegisterScript("top.ui.alert('网站名称已存在!');"); return; } if (this.ExistsWebAddr(text)) { base.RegisterScript("top.ui.alert('网址已存在!');"); return; } if (!this.Add(desktop_Weblink)) { base.RegisterScript("top.ui.alert('操作失败!');"); } base.RegisterScript("top.ui.winSuccess();top.ui.reloadTab();"); }
protected void btnSave_Click(object sender, EventArgs e) { bool flag = true; for (int i = 0; i < this.gvwWebLineList.Rows.Count; i++) { this.gvwWebLineList.Rows[i].FindControl("chk"); Desktop_Weblink desktop_Weblink = new Desktop_Weblink(); ClientScriptManager arg_36_0 = this.Page.ClientScript; desktop_Weblink.userCode = base.UserCode; desktop_Weblink.LinkID = (int)this.gvwWebLineList.DataKeys[i].Value; this.gvwWebLineList.Rows[i].FindControl("txtOrderID"); desktop_Weblink.orderId = i + 1; HtmlInputText htmlInputText = this.gvwWebLineList.Rows[i].FindControl("txtWebName") as HtmlInputText; if (this.ExistsWebName(htmlInputText.Value, desktop_Weblink.LinkID)) { base.RegisterScript("top.ui.alert('网站名称已存在!'); \n"); flag = false; break; } desktop_Weblink.WebName = htmlInputText.Value.ToString(); HtmlInputText htmlInputText2 = this.gvwWebLineList.Rows[i].FindControl("txtWebAddr") as HtmlInputText; if (this.ExistsWebAddr(htmlInputText2.Value, desktop_Weblink.LinkID)) { base.RegisterScript("top.ui.alert('网址已存在!'); \n"); flag = false; break; } desktop_Weblink.WebAddr = htmlInputText2.Value.ToString(); if (!this.IsWebAddr(htmlInputText2.Value.ToString())) { base.RegisterScript("top.ui.alert('网址格式不正确!'); \n"); flag = false; break; } HtmlInputText htmlInputText3 = this.gvwWebLineList.Rows[i].FindControl("txtRemark") as HtmlInputText; desktop_Weblink.Remark = htmlInputText3.Value.ToString(); this.deskTop.UpdateWeblink(desktop_Weblink); } if (flag) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("top.ui.show( '保存成功!'); \n"); stringBuilder.Append("top.ui.closeTab(); \n"); base.RegisterScript(stringBuilder.ToString()); } }
public int UpdateWeblink(Desktop_Weblink model) { return(this.desktop.UpdateWeblink(model)); }