Вроде так
string snum1 = project.Variables["num1"].Value;
string snum2 = project.Variables["num2"].Value;
string up_down;
double num1, num2, sum, res;
double.TryParse(snum1.Replace(",", ""), out num1);
double.TryParse(snum2.Replace(",", ""), out num2);
sum = num1-num2;
if(sum < 0)
{...