コード例 #1
0
        private int GetBatchCount(string batchID )
        {
            ReturnStatus returnStatus = new ReturnStatus();
            int count = 0;

            try
            {
                using (IDbConnection db = new SqlConnection(connection))
                {
                    const string query = "select count(*) from Batches"
                        + " where BatchName = @BatchName";
                    count = db.Query<int>(query, new {@BatchName = batchID }).Single();
                    return count;
                }
            }
            catch (Exception er)
            {
                return count;
            }
        }
コード例 #2
0
		private int GetBatchCount(string batchID)
		{
			int num;
			ReturnStatus returnStatu = new ReturnStatus();
			int num1 = 0;
			try
			{
				using (IDbConnection sqlConnection = new SqlConnection(this.connection))
				{
					int? nullable = null;
					CommandType? nullable1 = null;
					num1 = SqlMapper.Query<int>(sqlConnection, "select count(*) from Batches where BatchName = @BatchName", new { BatchName = batchID }, null, true, nullable, nullable1).Single<int>();
					num = num1;
				}
			}
			catch (Exception exception)
			{
				num = num1;
			}
			return num;
		}
コード例 #3
0
        private ReturnStatus AddBatch(string batchID, string batchPath, string batchFile)
        {
            ReturnStatus returnStatus = new ReturnStatus();

            using (IDbConnection dbInsert = new SqlConnection(connection))
            {
                try
                {
                    string query = "INSERT INTO [Batches]([BatchName],[BatchPath],[BatchFileName])VALUES("
                        + "@BatchName, @BatchPath,@BatchFileName)";

                    int rowsAffectd = dbInsert.Execute(query, new
                    {
                        @BatchName = batchID,
                        @BatchPath = batchPath,
                        @BatchFileName = batchFile

                    }, commandTimeout: 270);

                    returnStatus.Status = true;
                    returnStatus.ErrorMessage = "None";
                    return returnStatus;
                }
                catch (Exception er)
                {
                    returnStatus.Status = false;
                    returnStatus.ErrorMessage = er.ToString();
                    return returnStatus;
                }
            }
        }
コード例 #4
0
		private ReturnStatus AddBatch(string batchID, string batchPath, string batchFile)
		{
			ReturnStatus returnStatu;
			ReturnStatus str = new ReturnStatus();
			using (IDbConnection sqlConnection = new SqlConnection(this.connection))
			{
				try
				{
					string str1 = "INSERT INTO [Batches]([BatchName],[BatchPath],[BatchFileName])VALUES(@BatchName, @BatchPath,@BatchFileName)";
					CommandType? nullable = null;
					SqlMapper.Execute(sqlConnection, str1, new { BatchName = batchID, BatchPath = batchPath, BatchFileName = batchFile }, null, new int?(270), nullable);
					str.Status = true;
					str.ErrorMessage = "None";
					returnStatu = str;
				}
				catch (Exception exception1)
				{
					Exception exception = exception1;
					str.Status = false;
					str.ErrorMessage = exception.ToString();
					returnStatu = str;
				}
			}
			return returnStatu;
		}