Esempio n. 1
0
        public static bool CheckDate(Excel.Range range, int row)
        {
            int column = ColumnsInvoice.Date;

            if (!ErrorUtil.IsEmptyCell(range, row, column))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public static bool CheckSupplierNumber(Excel.Range range, int row)
        {
            //Check suppllier number not empty
            int column = ColumnsInvoice.SupplierNumber;

            if (!ErrorUtil.IsEmptyCell(range, row, column))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        public static bool CheckReceivedAmount(Excel.Range range, int row)
        {
            //Check Received Amount not empty
            Error error  = null;
            int   column = ColumnsOrder.RecivedAmount;
            bool  result = false;

            if (ErrorUtil.IsEmptyCell(range, row, column))
            {
                return(false);
            }
            //check is float
            try
            {
                if (range.Cells[row, column].Value2 is float)
                {
                    result = true;
                }
            }
            catch
            {
                error              = new Error();
                error.Issue        = "לא מספר עשרוני";
                error.CurrentValue = range.Cells[row, column].Value2.ToString();
                ErrorUtil.FinallizeErrorAndAdd(error, row, column, range);
                result = false;
            }

            //check is positive
            if (range.Cells[row, column].Value2 < 0)
            {
                if (!ErrorUtil.IsEmptyCell(range, row, column))
                {
                    error              = new Error();
                    error.Issue        = "שדה לא חיובי";
                    error.CurrentValue = range.Cells[row, column].Value2.ToString();
                }
                else
                {
                    error.Issue += Environment.NewLine + "שדה לא חיובי";
                }
                ErrorUtil.FinallizeErrorAndAdd(error, row, column, range);
                return(result);
            }

            return(false);
        }
Esempio n. 4
0
        public static bool CheckTaxAmount(Excel.Range range, int row)
        {
            //Check Tax Amount not empty
            Error error  = null;
            int   column = ColumnsInvoice.TaxAmount;

            if (ExcelUtil.GetStringValue(range, row, column) != "")
            {
                //check Tax Amount is positive
                if (range.Cells[row, column].Value2 < 0)
                {
                    error              = new Error();
                    error.Issue        = "שדה לא חיובי";
                    error.CurrentValue = range.Cells[row, column].Value2.ToString();
                    ErrorUtil.FinallizeErrorAndAdd(error, row, column, range);
                    return(false);
                }
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
        public static bool CheckRecordType(Excel.Range range, int row, string type)
        {
            Error error  = null;
            int   column = 1; //recordType always on column 1

            if (!ErrorUtil.IsEmptyCell(range, row, column))
            {
                string value = ExcelUtil.GetStringValue(range, row, column);
                if (value != type)
                {
                    error              = new Error();
                    error.Issue        = $"ערך הרשומה לא {type}";
                    error.CurrentValue = value;

                    FinallizeErrorAndAdd(error, row, column, range);
                    return(false);
                }
                return(true);
            }
            return(false);
        }
Esempio n. 6
0
        public static bool CheckOrderNumber(Excel.Range range, int row)
        {
            //Check order not empty
            Error error  = null;
            int   column = ColumnsOrder.OrderNumber;

            if (!ErrorUtil.IsEmptyCell(range, row, column))
            {
                //if orderNum length is not 8
                if (range.Cells[row, column].Value2.ToString().Length != 8)
                {
                    error              = new Error();
                    error.Issue        = "שדה לא מכיל 8 תווים";
                    error.CurrentValue = range.Cells[row, column].Value2.ToString();
                    ErrorUtil.FinallizeErrorAndAdd(error, row, column, range);
                    return(false);
                }
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
        public static bool CheckOrderDesc(Excel.Range range, int row)
        {
            //Check orderDesc not empty
            Error error  = null;
            int   column = ColumnsOrder.OrderDesc;
            bool  result = false;

            if (!ErrorUtil.IsEmptyCell(range, row, column))
            {
                if (!checkIfContainsExactDigitNumber(range.Cells[row, column].Value2.ToString(), 3))
                {
                    error              = new Error();
                    error.Issue        = "לא מכיל קוד נק' מכירה";
                    error.CurrentValue = range.Cells[row, column].Value2.ToString();
                    ErrorUtil.FinallizeErrorAndAdd(error, row, column, range);
                    result = false;
                }

                if (!checkIfContainsExactDigitNumber(range.Cells[row, column].Value2.ToString(), 9))
                {
                    if (error == null)
                    {
                        error              = new Error();
                        error.Issue        = "לא מכיל מס' הזמנה";
                        error.CurrentValue = range.Cells[row, column].Value2.ToString();
                    }
                    else
                    {
                        error.Issue += Environment.NewLine + "לא מכיל מס' הזמנה";
                    }

                    ErrorUtil.FinallizeErrorAndAdd(error, row, column, range);
                    return(result);
                }
                return(true);
            }
            return(false);
        }