Happy NET Auxiliary Program development notes (iv): Tape function + logical parking + simple interface

Source: Internet
Author: User

First, as a result of the development of the patch function has not encountered any technical problems, here only paste the relevant code:

<summary>
Labeling designated parking spaces
</summary>
<param name= "Parkinginfo" > will carry out the parking information of the stickers </param>
Public Postresult Postonecar (Parkinginfo parkinginfo)
{
No parking on the parking lot
if (ParkingInfo.CarId.Equals ("0"))
{
return null;
}
Parking margin not enough to stick
if (!string. IsNullOrEmpty (Parkinginfo.carprofit) && Convert.ToInt32 (parkinginfo.carprofit) <= 150)
{
return null;
}
String posturl = "http://www.kaixin001.com/parking/post.php";
String postparams = String. Format ("_=&acc={0}&parkid={1}&verify={2}", ACC, Parkinginfo.parkid, verify);
String Postresultjson = new Httphelper (). Gethtml (PostURL, Postparams, True, utility.cookies);
if (string. IsNullOrEmpty (Postresultjson))
{
return null;
}
Object o = Newtonsoft.Json.JavaScriptConvert.DeserializeObject (Postresultjson.replace ("\\/", "/"). Replace ("\\u", "\\\\u"));
return new Postresult (O);
}

Here is the test code:

<summary>
Postonecar Test (for the first n parking spaces for the patch operation)
</summary>
[TestMethod ()]
public void Postonecartest ()
{
string loginemail = Unittesthelper.loginemail;
string loginpassword = Unittesthelper.loginpassword;
Utility.login (Loginemail, Loginpassword);
Parkinghelper helper = new Parkinghelper ();
Helper. Getparkerdetails ();
Postresult result = Helper. Postonecar (helper. PARKINGLIST[3]); Make a patch operation on the nth parking space
Assert.areequal<string> ("0", result. ErrNo);
Console.WriteLine (Result. ERROR);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.