mathieu_cupryk
asked on
loading indicator when a try fails.
I need to implement a loading indicator.
try
{
cellPriceValue = ((Excel.Range)(inputRange. Cells[rowC ount, pricesColumn]));
bool CheckNumeric = IsNumeric(cellPriceValue.V alue2.ToSt ring());
if (cellPriceValue.Value2.ToS tring().Le ngth > 0 || cellPriceValue.Value2 != null)
{
if (cellPriceValue.Value2.ToS tring() == "Stones" || cellPriceValue.Value2.ToSt ring() == "Tough")
{
currRow = rowCount + 1; // skip a row to where the discounts are
break;
}
cellGradeValue = ((Excel.Range)(inputRange. Cells[rowC ount, 15]));
gradeName = cellGradeValue.Value2.ToSt ring();
InitialPrices.InitialPrice ReportingS erviceWS.I nitialPric eReporting Service WS = new InitialPrices.InitialPrice ReportingS erviceWS.I nitialPric eReporting Service();
int GradeCodeDetailID = 0;
string Status = null;
WS.GetGradeCodeDetailID(gr adeName, ref GradeCodeDetailID, ref Status);
if (CheckNumeric)
{
Price = (decimal)cellPriceValue.Va lue2;
sum_prices += Price;
}
else
{
InsertPriceListLoadError(P LHO.price_ list_hdr_i d.ToString (),
GradeCodeDetailID, rowCount + 1, gradeName, null, 'E',
"Price contains a non-numeric value.");
}
count_rows += 1;
// Look at errors 'E'
if (GradeCodeDetailID == -1)
{
InsertPriceListLoadError(P LHO.price_ list_hdr_i d.ToString (), GradeCodeDetailID, rowCount + 1, gradeName, Price, 'E',
"Grade Code not found in Grade Code Details table.");
}
if ((Price) < 0.00M)
{
InsertPriceListLoadError(P LHO.price_ list_hdr_i d.ToString (), GradeCodeDetailID, rowCount + 1, gradeName, Price, 'E',
"Price cannot be negative.");
}
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 3; j++)
{
if ((double)(discounts[i, j]) >= 0.00)
{
if ((i == 2) && (j == 2)) break;
InsertPriceListLoadError(P LHO.price_ list_hdr_i d.ToString (), GradeCodeDetailID, rowCount + 1, discountnames[i, j],
discounts[i, j], 'E', "Discount cannot be positive.");
}
}
}
///////////////////////
// Look at warnings 'W'
if ((Price) > 1000.00M)
{
InsertPriceListLoadError(P LHO.price_ list_hdr_i d, GradeCodeDetailID, rowCount + 1, gradeName,
Price, 'W', "Price is over $1000.00. Please confirm with SP&P.");
}
if ((Price) == 0.00M)
{
InsertPriceListLoadError(P LHO.price_ list_hdr_i d, GradeCodeDetailID, rowCount + 1, gradeName,
(decimal)(0.00), 'W', "Grade has no price. Please confirm with SP&P.");
}
}
}
catch
{
Console.WriteLine("Blank Price encountered. Likely a blank row.");
}
}
In the catch this takes alot of time.
Can I put a loading thing.
try
{
cellPriceValue = ((Excel.Range)(inputRange.
bool CheckNumeric = IsNumeric(cellPriceValue.V
if (cellPriceValue.Value2.ToS
{
if (cellPriceValue.Value2.ToS
{
currRow = rowCount + 1; // skip a row to where the discounts are
break;
}
cellGradeValue = ((Excel.Range)(inputRange.
gradeName = cellGradeValue.Value2.ToSt
InitialPrices.InitialPrice
int GradeCodeDetailID = 0;
string Status = null;
WS.GetGradeCodeDetailID(gr
if (CheckNumeric)
{
Price = (decimal)cellPriceValue.Va
sum_prices += Price;
}
else
{
InsertPriceListLoadError(P
GradeCodeDetailID, rowCount + 1, gradeName, null, 'E',
"Price contains a non-numeric value.");
}
count_rows += 1;
// Look at errors 'E'
if (GradeCodeDetailID == -1)
{
InsertPriceListLoadError(P
"Grade Code not found in Grade Code Details table.");
}
if ((Price) < 0.00M)
{
InsertPriceListLoadError(P
"Price cannot be negative.");
}
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 3; j++)
{
if ((double)(discounts[i, j]) >= 0.00)
{
if ((i == 2) && (j == 2)) break;
InsertPriceListLoadError(P
discounts[i, j], 'E', "Discount cannot be positive.");
}
}
}
///////////////////////
// Look at warnings 'W'
if ((Price) > 1000.00M)
{
InsertPriceListLoadError(P
Price, 'W', "Price is over $1000.00. Please confirm with SP&P.");
}
if ((Price) == 0.00M)
{
InsertPriceListLoadError(P
(decimal)(0.00), 'W', "Grade has no price. Please confirm with SP&P.");
}
}
}
catch
{
Console.WriteLine("Blank Price encountered. Likely a blank row.");
}
}
In the catch this takes alot of time.
Can I put a loading thing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Again, not sure what you mean saying "this is not good enough."
My answer is not good enough? Checking if values are numbers not good enough? Your code is not good enough?
Try to understand: most people here are quite busy people. If you want to get fast reply with a solution to your problem try to be more clear and more precise. If experts ask you to clarify your question, like I did, - probably it worth to do so (not just replying that answer is not good enough).
Your code is lacking comments , really, no comments at all. It is pretty hard to understand what you are doing. You are not giving any hints. How can we solve the problem?
My answer is not good enough? Checking if values are numbers not good enough? Your code is not good enough?
Try to understand: most people here are quite busy people. If you want to get fast reply with a solution to your problem try to be more clear and more precise. If experts ask you to clarify your question, like I did, - probably it worth to do so (not just replying that answer is not good enough).
Your code is lacking comments , really, no comments at all. It is pretty hard to understand what you are doing. You are not giving any hints. How can we solve the problem?
ASKER