Exemple #1
0
        public OAVotingInfo GetModel(int RecordID)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select * from OA_Voting_Info ");
            builder.Append(" where RecordID=" + RecordID);
            OAVotingInfo info = new OAVotingInfo();
            DataSet      set  = publicDbOpClass.DataSetQuary(builder.ToString());

            info.RecordID = RecordID;
            if (set.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }
            info.UserCode = set.Tables[0].Rows[0]["UserCode"].ToString();
            if (set.Tables[0].Rows[0]["RecordDate"].ToString() != "")
            {
                info.RecordDate = DateTime.Parse(set.Tables[0].Rows[0]["RecordDate"].ToString());
            }
            info.Title    = set.Tables[0].Rows[0]["Title"].ToString();
            info.Range    = set.Tables[0].Rows[0]["Range"].ToString();
            info.VoteType = set.Tables[0].Rows[0]["VoteType"].ToString();
            info.Content  = set.Tables[0].Rows[0]["Content"].ToString();
            info.IsValid  = set.Tables[0].Rows[0]["IsValid"].ToString();
            info.State    = set.Tables[0].Rows[0]["State"].ToString();
            return(info);
        }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        OAVotingInfo oVI = this.getOVI();

        if (this.State == "add")
        {
            int num = this.via.Add(oVI);
            if (num > 0)
            {
                this.JS.Text = "alert('添加成功!');";
                JavaScriptControl expr_42 = this.JS;
                expr_42.Text += "returnValue=true;window.close();";
            }
        }
        if (this.State == "edit")
        {
            int num = this.via.Update(oVI);
            if (num > 0)
            {
                this.JS.Text = "alert('修改成功');";
                JavaScriptControl expr_90 = this.JS;
                expr_90.Text += "returnValue=true;window.close();";
                return;
            }
            this.JS.Text = "alert('修改失败!');";
        }
    }
Exemple #3
0
        public int Update(OAVotingInfo model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update OA_Voting_Info set ");
            builder.Append("Title='" + model.Title + "',");
            builder.Append("Range='" + model.Range + "',");
            builder.Append("VoteType='" + model.VoteType + "',");
            builder.Append("Content='" + model.Content + "'");
            builder.Append(" where RecordID=" + model.RecordID);
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }
Exemple #4
0
        public int Add(OAVotingInfo model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into OA_Voting_Info(");
            builder.Append("UserCode,RecordDate,Title,Range,VoteType,Content,IsValid,State");
            builder.Append(")");
            builder.Append(" values (");
            builder.Append("'" + model.UserCode + "',");
            builder.Append("'" + model.RecordDate + "',");
            builder.Append("'" + model.Title + "',");
            builder.Append("'" + model.Range + "',");
            builder.Append("'" + model.VoteType + "',");
            builder.Append("'" + model.Content + "',");
            builder.Append("'" + model.IsValid + "',");
            builder.Append("'" + model.State + "'");
            builder.Append(")");
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }