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.GetRowId(base.UserCode); for (int i = 0; i < this.gvwModelList.Rows.Count; i++) { CheckBox checkBox = (CheckBox)this.gvwModelList.Rows[i].FindControl("chk"); if (checkBox.Checked) { DeskTopDalModel deskTopDalModel = new DeskTopDalModel(); deskTopDalModel.userCode = base.UserCode; deskTopDalModel.ModelId = this.gvwModelList.DataKeys[i].Value.ToString(); deskTopDalModel.MNewName = this.gvwModelList.Rows[i].Cells[2].Text.ToString(); deskTopDalModel.orderId = new int?(num + 1); this.deskTop.Add(deskTopDalModel, sqlTransaction); num++; } } sqlTransaction.Commit(); } base.RegisterScript("successed();"); }
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"); DeskTopDalModel deskTopDalModel = new DeskTopDalModel(); deskTopDalModel.userCode = base.UserCode; deskTopDalModel.ModelId = this.gvwModelList.DataKeys[i].Value.ToString(); if (textBox.Text.ToString() != "") { deskTopDalModel.MNewName = textBox.Text.ToString(); } else { deskTopDalModel.MNewName = this.gvwModelList.Rows[i].Cells[3].Text.ToString(); } string value = this.hfldtrorder.Value; string[] array = value.Split(new char[] { '|' }); Dictionary <string, string> dictionary = new Dictionary <string, string>(); string[] array2 = array; for (int j = 0; j < array2.Length; j++) { string text = array2[j]; if (!string.IsNullOrEmpty(text)) { string[] array3 = text.Split(new char[] { ':' }); dictionary.Add(array3[1], array3[0]); } } deskTopDalModel.orderId = new int?(int.Parse(dictionary[deskTopDalModel.ModelId.ToString()])); this.deskTop.Update(deskTopDalModel, sqlTransaction); } sqlTransaction.Commit(); base.RegisterScript(" top.ui.generateDeskTop(); \n top.ui.show('保存成功');\n top.ui.closeTab(); \n"); } }
public int Update(DeskTopDalModel model, SqlTransaction trans) { return(this.desktop.Update(model, trans)); }
public int Add(DeskTopDalModel model, SqlTransaction trans) { return(this.desktop.Add(model, trans)); }