Exemple #1
0
        public OAVotingRecord GetModel(int ID)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select * from OA_Voting_Record ");
            builder.Append(" where VotingRecordID=" + ID);
            OAVotingRecord record = new OAVotingRecord();
            DataSet        set    = publicDbOpClass.DataSetQuary(builder.ToString());

            record.VotingRecordID = ID;
            if (set.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }
            if (set.Tables[0].Rows[0]["VotingRecordID"].ToString() != "")
            {
                record.VotingRecordID = int.Parse(set.Tables[0].Rows[0]["VotingRecordID"].ToString());
            }
            record.Voter = set.Tables[0].Rows[0]["Voter"].ToString();
            if (set.Tables[0].Rows[0]["VoteDate"].ToString() != "")
            {
                record.VoteDate = DateTime.Parse(set.Tables[0].Rows[0]["VoteDate"].ToString());
            }
            record.SelectOptions = set.Tables[0].Rows[0]["SelectOptions"].ToString();
            return(record);
        }
Exemple #2
0
    protected OAVotingRecord GetOAVotingRecord()
    {
        OAVotingRecord oAVotingRecord = new OAVotingRecord();

        oAVotingRecord.VotingRecordID = this.RecordCode;
        oAVotingRecord.Voter          = this.Session["yhdm"].ToString();
        oAVotingRecord.VoteDate       = DateTime.Now;
        OAVotingInfoAction oAVotingInfoAction = new OAVotingInfoAction();
        DataTable          list = oAVotingInfoAction.GetList(" RecordID=" + this.RecordCode);

        if (list.Rows.Count > 0)
        {
            this.votetype = list.Rows[0]["VoteType"].ToString();
            if (this.votetype == "0")
            {
                oAVotingRecord.SelectOptions = this.rbl.SelectedValue;
            }
            if (this.votetype == "1")
            {
                for (int i = 0; i < this.cbl.Items.Count; i++)
                {
                    if (this.cbl.Items[i].Selected)
                    {
                        OAVotingRecord expr_DE = oAVotingRecord;
                        expr_DE.SelectOptions = expr_DE.SelectOptions + this.cbl.Items[i].Value + ",";
                    }
                }
            }
        }
        return(oAVotingRecord);
    }
Exemple #3
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        OAVotingRecord     oAVotingRecord     = this.GetOAVotingRecord();
        OAVotingInfoAction oAVotingInfoAction = new OAVotingInfoAction();
        DataTable          list = oAVotingInfoAction.GetList(" RecordID=" + this.RecordCode);

        if (this.ora.Add(oAVotingRecord) > 0)
        {
            this.votetype = list.Rows[0]["VoteType"].ToString();
            if (this.votetype == "0")
            {
                this.rid += this.rbl.SelectedValue;
                this.ooa.UpdatePoll(" RecordID =" + Convert.ToInt32(this.rid));
            }
            if (this.votetype == "1")
            {
                for (int i = 0; i < this.cbl.Items.Count; i++)
                {
                    if (this.cbl.Items[i].Selected)
                    {
                        this.rid = this.rid + this.cbl.Items[i].Value + ",";
                    }
                }
                this.ooa.UpdatePoll(" RecordID in(" + this.rid.Substring(0, this.rid.Length - 1) + ")");
            }
            this.JS.Text = "alert('提交成功!');";
            JavaScriptControl expr_16E = this.JS;
            expr_16E.Text += "returnValue=true;window.close();";
        }
    }
Exemple #4
0
        public int Update(OAVotingRecord model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update OA_Voting_Record set ");
            builder.Append("VotingRecordID=" + model.VotingRecordID + ",");
            builder.Append("Voter='" + model.Voter + "',");
            builder.Append("VoteDate='" + model.VoteDate + "',");
            builder.Append("SelectOptions='" + model.SelectOptions + "'");
            builder.Append(" where VotingRecordID=" + model.VotingRecordID);
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }
Exemple #5
0
        public int Add(OAVotingRecord model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into OA_Voting_Record(");
            builder.Append("VotingRecordID,Voter,VoteDate,SelectOptions");
            builder.Append(")");
            builder.Append(" values (");
            builder.Append(model.VotingRecordID + ",");
            builder.Append("'" + model.Voter + "',");
            builder.Append("'" + model.VoteDate + "',");
            builder.Append("'" + model.SelectOptions + "'");
            builder.Append(")");
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }