protected void btnSave_Click(object sender, EventArgs e) { using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString)) { sqlConnection.Open(); SqlTransaction sqlTransaction = sqlConnection.BeginTransaction(); int num = this.deskTop.GetRowMenuId(base.UserCode, base.Request["op"].ToString()); for (int i = 0; i < this.gvwModelList.Rows.Count; i++) { CheckBox checkBox = (CheckBox)this.gvwModelList.Rows[i].FindControl("chk"); if (checkBox.Checked) { menuModel menuModel = new menuModel(); menuModel.userCode = base.UserCode; menuModel.ModelId = this.gvwModelList.DataKeys[i].Value.ToString(); menuModel.MNewName = this.gvwModelList.Rows[i].Cells[2].Text.ToString(); menuModel.orderId = new int?(num + 1); menuModel.AddTime = DateTime.Now; menuModel.Sequence = base.Request["op"].ToString(); this.deskTop.AddMenu(menuModel, sqlTransaction); num++; } } sqlTransaction.Commit(); } base.RegisterScript("top.ui.winSuccess();top.ui.reloadTab();"); }
protected void btnSave_Click(object sender, EventArgs e) { using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString)) { sqlConnection.Open(); SqlTransaction sqlTransaction = sqlConnection.BeginTransaction(); for (int i = 0; i < this.gvwModelList.Rows.Count; i++) { TextBox textBox = (TextBox)this.gvwModelList.Rows[i].FindControl("txtModelName"); TextBox textBox2 = (TextBox)this.gvwModelList.Rows[i].FindControl("txtOrderID"); menuModel menuModel = new menuModel(); menuModel.userCode = base.UserCode; menuModel.ModelId = this.gvwModelList.DataKeys[i].Value.ToString(); if (textBox.Text.ToString() != "") { menuModel.MNewName = textBox.Text.ToString(); } else { menuModel.MNewName = this.gvwModelList.Rows[i].Cells[3].Text.ToString(); } if (textBox2.Text != "") { menuModel.orderId = new int?(Convert.ToInt32(textBox2.Text.ToString())); } else { menuModel.orderId = new int?(i + 1); } menuModel.Sequence = base.Request["op"].ToString(); this.deskTop.UpdMenu(menuModel, sqlTransaction); } sqlTransaction.Commit(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("top.ui.show( '保存成功!'); \n"); stringBuilder.Append("top.ui.closeTab() \n;"); base.RegisterScript(stringBuilder.ToString()); this.Bind(); } }
public int UpdMenu(menuModel model, SqlTransaction trans) { return(this.desktop.UpdMenu(model, trans)); }