private bool postTask(int stu)
{
try
{
TasksClass tasksClass = new TasksClass();
int num1 = tasksClass.PostTask(this._curTask.ID, stu);
int num2 = 0;
while (num1 < 0 && num2 < 5)
{
num1 = tasksClass.PostTask(this._curTask.ID, stu);
if (num1 >= 0)
num2 = 100;
else
Thread.Sleep(1000);
}
if (num1 < 0)
{
this.strLog = string.Format("{0} 提交失败,20秒后重试.", (object)DateTime.Now.ToString());
this.BeginInvoke(showdelegate, (object)this.strLog);
return false;
}
TaskLogTBSturct data = new TaskLogTBSturct();
data.taskId = this._curTask.ID;
data.ww = this._curTask.ww;
data.ip = this.lab_IP.Text.Trim().Split(' ')[0].Trim();
data.uId = sys.LoginUser.ID;
if (stu == 2)
{
double p = this._curTask.price * this.getMyHydj(1) / 100.0;
usersClass usersClass = new usersClass();
double syPrice = 0.0;
bool flag = usersClass.changePrice_2(sys.LoginUser.ID, p, ref syPrice);
UsersTBSturct loginUser = sys.LoginUser;
loginUser.Price = syPrice;
sys.LoginUser = loginUser;
data.price = p;
data.stu = 2;
data.optTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
if (!flag)
return false;
this.strLog = string.Format("{0} 恭喜完成任务:{1} 获得流量币:{2} 余额:{3}.", (object)DateTime.Now.ToString(), (object)this._curTask.ID, (object)p.ToString("f2"), (object)sys.LoginUser.Price.ToString("f2"));
this.BeginInvoke(showdelegate, (object)this.strLog);
//this.addPostLog(data);
return true;
}
if (stu != 1)
return true;
double p1 = this._curTask.price / 2.0 * this.getMyHydj(1) / 100.0;
usersClass usersClass1 = new usersClass();
double syPrice1 = 0.0;
bool flag1 = usersClass1.changePrice_2(sys.LoginUser.ID, p1, ref syPrice1);
UsersTBSturct loginUser1 = sys.LoginUser;
loginUser1.Price = syPrice1;
sys.LoginUser = loginUser1;
if (!flag1)
return false;
usersClass1.changePrice_2(this._curTask.userId, this._curTask.price / 2.0, ref syPrice1);
this.strLog = string.Format("{0} 恭喜完成任务:{1} 获得流量币:{2} 余额:{3}.", (object)DateTime.Now.ToString(), (object)this._curTask.ID, (object)p1.ToString("f2"), (object)sys.LoginUser.Price.ToString("f2"));
this.BeginInvoke(showdelegate, (object)this.strLog);
data.price = p1;
data.stu = 1;
data.optTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// this.addPostLog(data);
return true;
}
catch
{
return false;
}
}
//private bool postTask(int stu)