runs.cs

来自「学术会议在线投稿系统 fghgfhgfhgfhfgh」· CS 代码 · 共 138 行

CS
138
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace WebDB
{
    public class Runs : DataAccess
    {
        public int newrun(String uid,
                          int lid,
                          int pid,
                          int cid,
                          ref int ret,
                          ref int rid,
                          ref String ccl,
                          ref String ecl,
                          ref String se,
                          ref String pip,
                          ref String pap,
                          ref int tl,
                          ref int ml,
                          ref int ol,
                          ref String error_string
                          )
        {
            SqlCommand comm = new SqlCommand();

            conn.Open();
            comm.CommandType = CommandType.StoredProcedure;
            comm.CommandText = "opr_runs_new";
            comm.Connection = conn;
            comm.Parameters.Add("@rid", SqlDbType.Int).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@ccl", SqlDbType.NVarChar,260).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@ecl", SqlDbType.NVarChar,260).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@se", SqlDbType.NVarChar,8).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@pip", SqlDbType.NVarChar,255).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@pap", SqlDbType.NVarChar,255).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@tl", SqlDbType.Int).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@ml", SqlDbType.Int).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@ol", SqlDbType.Int).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@ret", SqlDbType.Int).Direction = ParameterDirection.ReturnValue;
            comm.Parameters.Add("@uid", SqlDbType.NVarChar).Value = uid;
            comm.Parameters.Add("@lid", SqlDbType.Int).Value = lid;
            comm.Parameters.Add("@pid", SqlDbType.Int).Value = pid;
            comm.Parameters.Add("@cid", SqlDbType.Int).Value = cid;
            try
            {
                comm.ExecuteNonQuery();
            }
            catch (SqlException e)
            {
                error_string = e.ToString();
                conn.Close();
                return 1;
            }

            ret = Convert.ToInt32(comm.Parameters["@ret"].Value);

            if (ret == 0)
            {
                rid = Convert.ToInt32(comm.Parameters["@rid"].Value);
                ccl = Convert.ToString(comm.Parameters["@ccl"].Value);
                ecl = Convert.ToString(comm.Parameters["@ecl"].Value);
                se = Convert.ToString(comm.Parameters["@se"].Value);
                pip = Convert.ToString(comm.Parameters["@pip"].Value);
                pap = Convert.ToString(comm.Parameters["@pap"].Value);
                tl = Convert.ToInt32(comm.Parameters["@tl"].Value);
                ml = Convert.ToInt32(comm.Parameters["@ml"].Value);
                ol = Convert.ToInt32(comm.Parameters["@ol"].Value);
            }
            
            conn.Close();
            return 0;

        }
        public int getstatus(String uid, ref int stat, ref String dsp, ref String dspname, ref String error_string)
        {
            SqlCommand comm = new SqlCommand();

            conn.Open();
            comm.CommandType = CommandType.StoredProcedure;
            comm.CommandText = "web_runs_get_status";
            comm.Connection = conn;
            comm.Parameters.Add("@uid", SqlDbType.NVarChar).Value = uid;
            comm.Parameters.Add("@dsp", SqlDbType.NVarChar, 50).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@dspname", SqlDbType.NVarChar, 50).Direction = ParameterDirection.Output;
            comm.Parameters.Add("@s", SqlDbType.Int).Direction = ParameterDirection.Output;

            try
            {
                comm.ExecuteNonQuery();
            }
            catch (SqlException e)
            {
                error_string = e.ToString();
                conn.Close();
                return 1;
            }

            dsp = Convert.ToString(comm.Parameters["@dsp"].Value);
            dspname = Convert.ToString(comm.Parameters["@dspname"].Value);
            stat = Convert.ToInt32(comm.Parameters["@s"].Value);

            conn.Close();
            return 0;
        }
        public int setstatus(int rid,int status,String dsp, ref String error_string)
        {
            SqlCommand comm = new SqlCommand();

            conn.Open();
            comm.CommandType = CommandType.StoredProcedure;
            comm.CommandText = "jud_runs_update_status";
            comm.Connection = conn;
            comm.Parameters.Add("@rid", SqlDbType.Int).Value = rid;
            comm.Parameters.Add("@status", SqlDbType.Int).Value = status;
            comm.Parameters.Add("@dsp", SqlDbType.NVarChar).Value = dsp;

            try
            {
                comm.ExecuteNonQuery();
            }
            catch (SqlException e)
            {
                error_string = e.ToString();
                conn.Close();
                return 1;
            }

            conn.Close();
            return 0;
        }

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?