Пример #1
0
    protected void AddRequest_Click(object sender, EventArgs e)
    {
        ProductWrapper newProd = new ProductWrapper();

        newProd.Name        = ProductName.Text;
        newProd.Category    = Enum.GetName(typeof(EnumCategory), CategoryList.SelectedIndex);
        newProd.Description = ProductDesc.Text;
        newProd.Price       = Price.Text;

        newProd.Save();

        RequestWrapper newReq = new RequestWrapper();

        newReq.Title     = RequestTitle.Text;
        newReq.UserID    = ((UserAccount)Session["loggedUser"]).UserID;
        newReq.ProductID = newProd.ID;
        newReq.StartDate = DateTime.Now;
        newReq.EndDate   = datePickerDeadline.Now; //new DateTime(hiddenFieldDate.value);
        newReq.Latitude  = ((UserAccount)Session["loggedUser"]).Latitude;
        newReq.Longitude = ((UserAccount)Session["loggedUser"]).Longitude;
        int radius;

        Int32.TryParse((Request.Cookies["Radius"]).Value, out radius);
        newReq.Radius = radius;

        int minVal, maxVal;

        Int32.TryParse(MinFollow.Text, out minVal);
        Int32.TryParse(MaxFollow.Text, out maxVal);
        newReq.MinUsers = minVal;
        newReq.MaxUsers = maxVal;
        newReq.Status   = EnumRequestStatus.InProgress.ToString();

        newReq.Save();

        Server.Transfer("/Pages/MyRequests.aspx");
    }