/// <summary>
        /// Computes relative path to root
        /// e.g. Root/SubDirectory/File.file would return "../"
        /// </summary>
        public static string ComputeRelativePathToRoot(string rootPath, string currentPath)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(rootPath, "rootPath");
            ArgumentChecker.ThrowIfNullOrEmpty(currentPath, "currentPath");

            if (rootPath.EndsWith("\\"))
            {
                rootPath = rootPath.Substring(0, rootPath.Length - 1);
            }

            if (currentPath.IndexOf(rootPath) < 0)
            {
                throw new ArgumentException(currentPath, "currentPath");
            }

            string relativePathToRoot = string.Empty;
            string temp = currentPath.Substring(rootPath.Length);

            foreach (char c in temp)
            {
                if (c == '\\')
                {
                    relativePathToRoot += "../";
                }
            }

            return(relativePathToRoot);
        }
        public CallbackParameter(string fieldName, int rowIndex)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(fieldName, "fieldName");
            ArgumentChecker.ThrowIfLessThanZero(rowIndex, "rowIndex");

            this.fieldName = fieldName;
            this.rowIndex  = rowIndex;
        }
        private NoteType(int id, string name)
        {
            ArgumentChecker.ThrowIfLessThanZero(id, "id");
            ArgumentChecker.ThrowIfNullOrEmpty(name, "name");

            this.id   = id;
            this.name = name;
        }
        public CffPrincipal(IPrincipal rolePrincipal, ICffUser cffUser)
        {
            ArgumentChecker.ThrowIfNull(rolePrincipal, "rolePrincipal");
            ArgumentChecker.ThrowIfNull(cffUser, "cffUser");

            this.rolePrincipal = rolePrincipal;
            this.cffUser       = cffUser;
        }
Ejemplo n.º 5
0
        private BatchType(int id, string name, bool isDateRangeDependant)
        {
            ArgumentChecker.ThrowIfLessThanZero(id, "id");
            ArgumentChecker.ThrowIfNullOrEmpty(name, "name");

            this.id   = id;
            this.name = name;
            this.isDateRangeDependant = isDateRangeDependant;
        }
Ejemplo n.º 6
0
        public CustomerNote(long noteId, Date created, ActivityType activityType, NoteType noteType, string comment,
                            int authorId, string createdByEmployeeName, int modifiedBy, string modifiedByEmployeeName,
                            Date modified)
            : base(noteId, created, comment, authorId, createdByEmployeeName, modifiedBy, modifiedByEmployeeName, modified)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(createdByEmployeeName, "createdByEmployeeName");

            this.activityType = activityType;
            this.noteType     = noteType;
        }
Ejemplo n.º 7
0
        public BankDetails(string bankName, string branch, string accountNumber)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(bankName, "bankName");
            ArgumentChecker.ThrowIfNullOrEmpty(branch, "branch");
            ArgumentChecker.ThrowIfNullOrEmpty(accountNumber, "accountNumber");

            this.bankName      = bankName;
            this.branch        = branch;
            this.accountNumber = accountNumber;
        }
Ejemplo n.º 8
0
        public CustomerTransactionReport(ICalendar calendar, string title, string customerName, IList <CustomerTransactionReportRecord> records, string name)
            : base(calendar, name, customerName)
        {
            ArgumentChecker.ThrowIfNull(calendar, "calendar");
            ArgumentChecker.ThrowIfNull(records, "records");
            ArgumentChecker.ThrowIfNullOrEmpty(title, "title");

            this.title   = title;
            this.records = records;
        }
Ejemplo n.º 9
0
        public PurchaserDetails(CffClient client, CffCustomer customer, Address customerAddress)
        {
            ArgumentChecker.ThrowIfNull(customer, "customer");
            ArgumentChecker.ThrowIfNull(client, "client");
            ArgumentChecker.ThrowIfNull(customerAddress, "customerAddress");

            this.customer        = customer;
            this.customerAddress = customerAddress;
            this.client          = client;
        }
        public static CallbackParameter Parse(string value)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(value, "value");
            string[] splitValue = value.Split(Separator);
            if (splitValue.Length != 2)
            {
                throw new ArgumentException("Unrecognized CallbackParameter format");
            }

            return(new CallbackParameter(splitValue[0], int.Parse(splitValue[1])));
        }
Ejemplo n.º 11
0
        public RetentionInfo(decimal retentionHeld, Percentage factoredInvoicesPercentage, decimal factoredInvoices)
        {
            ArgumentChecker.ThrowIfNull(factoredInvoicesPercentage, "factoredInvoicesPercentage");

            this.retentionHeld = retentionHeld;
            this.factoredInvoicesPercentage = factoredInvoicesPercentage;
            this.factoredInvoices           = factoredInvoices;

            factoredRetention = factoredInvoicesPercentage.Of(factoredInvoices);
            surplus           = retentionHeld - factoredRetention;
        }
Ejemplo n.º 12
0
        public Charge(int id, ChargeType type, decimal amount, string description, Date modifiedDate, string modifiedBy)
        {
            ArgumentChecker.ThrowIfNull(type, "type");

            this.id           = id;
            this.type         = type;
            this.amount       = amount;
            this.description  = description;
            this.modifiedDate = modifiedDate;
            this.modifiedBy   = modifiedBy;
        }
Ejemplo n.º 13
0
        public EmployeeAdministratorUser(Guid userId, string userName, int employeeId, string displayName, long clientId)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(userName, "userName");
            ArgumentChecker.ThrowIfNullOrEmpty(displayName, "displayName");

            this.userId      = userId;
            this.clientId    = clientId;
            this.userName    = userName;
            this.employeeId  = employeeId;
            this.displayName = displayName;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Parses year month string in yyyy MM format and returns a IDate
        /// for the start of the specified month
        /// </summary>
        public static Date Parse(string yearMonthString)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(yearMonthString, "yearMonthString");
            if (!new Regex(@"^[0-9]{4}\s[0-9]{2}$").IsMatch(yearMonthString))
            {
                throw new ArgumentException("Year Month string is in an incorrect format");
            }

            string[] yearMonthComponents = yearMonthString.Split(' ');
            int      yearComponent       = Convert.ToInt32(yearMonthComponents[0]);
            int      monthComponent      = Convert.ToInt32(yearMonthComponents[1]);

            return(new Date(new DateTime(yearComponent, monthComponent, 1)));
        }
Ejemplo n.º 15
0
        public ClientStaffUser(Guid userId, string userName, int employeeId, string displayName, long clientId, long clientNumber, string clientName)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(userName, "userName");
            ArgumentChecker.ThrowIfNullOrEmpty(displayName, "displayName");
            ArgumentChecker.ThrowIfNullOrEmpty(clientName, "clientName");

            this.userId       = userId;
            this.userName     = userName;
            this.employeeId   = employeeId;
            this.displayName  = displayName;
            this.clientId     = clientId;
            this.clientNumber = clientNumber;
            this.clientName   = clientName;
        }
        public LikelyRepurchasesLine(int custid, int custNum, string custName, string theTitle, int theAge,
                                     decimal amt, decimal bal, decimal sum, Date thedate, Date procdate, string trans, string trxref)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(customerName, "customerName");

            this.customerid     = custid;
            this.customerNumber = custNum;
            this.customerName   = custName;
            this.title          = theTitle;
            this.age            = theAge;
            this.amount         = amt;
            this.balance        = bal;
            this.sum            = sum;
            this.dated          = thedate;
            this.processed      = procdate;
            this.transaction    = trans;
            this.reference      = trxref;
        }
Ejemplo n.º 17
0
        public RepurchasesLine(int transactionId, int customerId, int customerNumber, string customerName, string transactionNumber, Date dated, decimal amount, decimal sum, int batchId, Date created, Date modified, string modifiedBy)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(customerName, "customerName");
            ArgumentChecker.ThrowIfNullOrEmpty(modifiedBy, "modifiedBy");

            this.transactionId     = transactionId;
            this.customerId        = customerId;
            this.customerNumber    = customerNumber;
            this.customerName      = customerName;
            this.transactionNumber = transactionNumber;
            this.dated             = dated;
            this.amount            = Math.Abs(amount);
            this.sum        = sum;
            this.batchId    = batchId;
            this.created    = created;
            this.modified   = modified;
            this.modifiedBy = modifiedBy;
        }
Ejemplo n.º 18
0
        public CreditLine(int transactionId, int customerId, int customerNumber, string customerName, string transactionNumber, IDate dated, decimal amount, decimal sum, int batch, IDate created, IDate modified, string modifiedBy)
            : base(TransactionType.Credit.Type, batch)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(customerName, "customerName");
            ArgumentChecker.ThrowIfNullOrEmpty(transactionNumber, "transactionNumber");
            ArgumentChecker.ThrowIfNullOrEmpty(modifiedBy, "modifiedBy");

            this.transactionId     = transactionId;
            this.customerId        = customerId;
            this.customerNumber    = customerNumber;
            this.customerName      = customerName;
            this.transactionNumber = transactionNumber;
            this.dated             = dated;
            this.amount            = amount;
            this.sum        = sum;
            this.created    = created;
            this.modified   = modified;
            this.modifiedBy = modifiedBy;
        }
Ejemplo n.º 19
0
        public CustomerNote(long noteId, Date created, ActivityType activityType, NoteType noteType, string comment,
                            int authorId, string createdByEmployeeName, int modifiedBy, string modifiedByEmployeeName,
                            Date modified, string custName, int customerid, string authorRole, int clientID = 0)
            : base(noteId, created, comment, authorId, createdByEmployeeName, modifiedBy, modifiedByEmployeeName, modified)
        {
            ArgumentChecker.ThrowIfNullOrEmpty(createdByEmployeeName, "createdByEmployeeName");

            this.activityType = activityType;
            this.noteType     = noteType;
            this.customerId   = customerid;
            this.customerName = custName;
            this.authorRole   = authorRole;
            if (clientID == 0 && SessionWrapper.Instance.Get != null)
            {
                this._clientID = SessionWrapper.Instance.Get.ClientFromQueryString.Id;
            }
            else
            {
                this._clientID = clientID;
            }
        }
Ejemplo n.º 20
0
        public ManagementDetails(string name, string legalEntityOne, string legalEntityTwo, string phone, string fax, string email,
                                 string website, Address address, BankDetails bankDetails, string gstCode)
        {
            ArgumentChecker.ThrowIfNull(address, "address");
            ArgumentChecker.ThrowIfNullOrEmpty(gstCode, "gstCode");

            this.address        = address;
            this.bankDetails    = bankDetails;
            this.gstCode        = gstCode;
            this.name           = name;
            this.legalEntityOne = legalEntityOne;
            this.legalEntityTwo = legalEntityTwo;
            this.phone          = phone;
            this.fax            = fax;
            this.email          = email;
            this.website        = website;

            if (!string.IsNullOrEmpty(email))
            {
                emailLink = "mailto:" + email;
            }
        }
Ejemplo n.º 21
0
 public Date YearsAgo(int numberOfYears)
 {
     ArgumentChecker.ThrowIfLessThanZero(numberOfYears, "numberOfYears");
     return(new Date(dateTime.AddYears(-numberOfYears)));
 }
Ejemplo n.º 22
0
 public Date MonthsAfter(int numberOfMonths)
 {
     ArgumentChecker.ThrowIfLessThanZero(numberOfMonths, "numberOfMonths");
     return(new Date(dateTime.AddMonths(numberOfMonths)));
 }
Ejemplo n.º 23
0
 // Reads nicely but is only used in tests :(
 public bool IsWithin(DateRange dateRange)
 {
     ArgumentChecker.ThrowIfNull(dateRange, "dateRange");
     return(this >= dateRange.StartDate && this <= dateRange.EndDate);
 }
Ejemplo n.º 24
0
 public static IList <T> ReturnMaximumRecords <T>(IList <T> records)
 {
     ArgumentChecker.ThrowIfNull(records, "records");
     return(records.Take(1000).ToList());
 }
 public void LogError(string message, Exception e)
 {
     ArgumentChecker.ThrowIfNullOrEmpty(message, "message");
     log4NetLogger.Error(message, e);
     eventLog.WriteEntry(GenerateExceptionMessage(e).ToString(), EventLogEntryType.Error);
 }
 public void Debug(string message)
 {
     ArgumentChecker.ThrowIfNullOrEmpty(message, "message");
     log4NetLogger.Debug(message);
     eventLog.WriteEntry(message, EventLogEntryType.Information);
 }