Beispiel #1
0
        public string LoginUser情報更新実行(AllUser情報取得結果 lu)
        {
#if DEBUG
            string St = Settings.Default.DataSourceDEBUG;
#elif NAKAYAMA
            string St = Settings.Default.DataSourceNAKAYAMA;
#else
            string St = Settings.Default.DataSource;
#endif

            SqlConnection Cn = new SqlConnection();

            Cn.ConnectionString = St;

            var command = new SqlCommand();
            command.Connection  = new SqlConnection(St);
            command.CommandText = "dbo.PTログインユーザー情報更新";
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            command.Parameters.Add(new SqlParameter("@入力ユーザーID", SqlDbType.NVarChar, 50, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            command.Parameters.Add(new SqlParameter("@入力コンフィデンシャル", SqlDbType.NVarChar, 256, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));

            command.Parameters[1].Value = lu.UserID;
            command.Parameters[2].Value = lu.Password;


            SqlDataReader sdr;

            try
            {
                command.Connection.Open();

                using (sdr = command.ExecuteReader())
                {
                    while (sdr.Read())
                    {
                        if ((bool)sdr["ユーザー情報更新成功かどうか"])
                        {
                            return("更新しました。");
                        }
                        else
                        {
                            return("更新に失敗しました。");
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message + e.StackTrace);
            }
            finally
            {
                command.Connection.Close();
            }


            return("更新しました。");
        }
Beispiel #2
0
        public List <AllUser情報取得結果> AllUser情報取得実行()
        {
#if DEBUG
            string St = Settings.Default.DataSourceDEBUG;
#elif NAKAYAMA
            string St = Settings.Default.DataSourceNAKAYAMA;
#else
            string St = Settings.Default.DataSource;
#endif

            SqlConnection Cn = new SqlConnection();

            Cn.ConnectionString = St;

            var command = new SqlCommand();
            command.Connection  = new SqlConnection(St);
            command.CommandText = "dbo.PTユーザー全件取得";
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));


            SqlDataReader        sdr;
            List <AllUser情報取得結果> l結果 = new List <AllUser情報取得結果>();

            try
            {
                command.Connection.Open();

                using (sdr = command.ExecuteReader())
                {
                    while (sdr.Read())
                    {
                        AllUser情報取得結果 結果 = new AllUser情報取得結果();

                        結果.UserID = (string)sdr["ユーザーID"];
                        結果.アクセス権限 = (int)sdr["アクセス権限"];
                        結果.削除フラグ  = (bool)sdr["削除フラグ"];

                        l結果.Add(結果);
                    }

                    return(l結果);
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message + e.StackTrace);
            }
            finally
            {
                command.Connection.Close();
            }
        }