public OAVotingOption GetModel(int RecordID) { StringBuilder builder = new StringBuilder(); builder.Append("select * from OA_Voting_Option "); builder.Append(" where RecordID=" + RecordID); OAVotingOption option = new OAVotingOption(); DataSet set = publicDbOpClass.DataSetQuary(builder.ToString()); option.RecordID = RecordID; if (set.Tables[0].Rows.Count <= 0) { return(null); } if (set.Tables[0].Rows[0]["VotingInfoID"].ToString() != "") { option.VotingInfoID = int.Parse(set.Tables[0].Rows[0]["VotingInfoID"].ToString()); } option.Option = set.Tables[0].Rows[0]["Option"].ToString(); if (set.Tables[0].Rows[0]["Poll"].ToString() != "") { option.Poll = int.Parse(set.Tables[0].Rows[0]["Poll"].ToString()); } return(option); }
public int Update(OAVotingOption model) { StringBuilder builder = new StringBuilder(); builder.Append("update OA_Voting_Option set "); builder.Append("Options='" + model.Option + "',"); builder.Append("Remark='" + model.Remark + "'"); builder.Append(" where RecordID=" + model.RecordID); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
public int Add(OAVotingOption model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into OA_Voting_Option("); builder.Append("VotingInfoID,Options,Poll,Remark"); builder.Append(")"); builder.Append(" values ("); builder.Append(model.VotingInfoID + ","); builder.Append("'" + model.Option + "',"); builder.Append(model.Poll + ","); builder.Append("'" + model.Remark + "'"); builder.Append(")"); return(publicDbOpClass.ExecSqlString(builder.ToString())); }
protected void btnAdd_Click(object sender, EventArgs e) { OAVotingOption votingOption = this.GetVotingOption(); if (this.OP == "add" && this.ooa.Add(votingOption) > 0) { this.JS.Text = "alert('添加成功!');"; JavaScriptControl expr_3E = this.JS; expr_3E.Text += "returnValue=true;window.close();"; } if (this.OP == "edit" && this.ooa.Update(votingOption) > 0) { this.JS.Text = "alert('更新成功!');"; JavaScriptControl expr_8A = this.JS; expr_8A.Text += "returnValue=true;window.close();"; } }