Exemplo n.º 1
0
        protected void btnSaveVendorChanges_Click(object sender, EventArgs e)
        {
            foreach (GridDataItem vendorItem in rdVendorService.Items)
            {
                Hashtable typeValues = new Hashtable();
                vendorItem.ExtractValues(typeValues);
                int serviceId = Convert.ToInt32(typeValues["RecycleVendorServiceId"].ToString());
                RecycleVendorServiceEntity recycleVendor = new RecycleVendorServiceEntity(serviceId);

                RadDatePicker rdpDate               = vendorItem.FindControl("rdpDate") as RadDatePicker;
                TextBox       txtWeight             = vendorItem.FindControl("txtWeight") as TextBox;
                DropDownList  ddlRecycleType        = vendorItem.FindControl("ddlType") as DropDownList;
                DropDownList  ddlVendor             = vendorItem.FindControl("ddlVendor") as DropDownList;
                DropDownList  ddlAccount            = vendorItem.FindControl("ddlAccount") as DropDownList;
                TextBox       txtTotalMonthlyPulls  = vendorItem.FindControl("txtTotalMonthlyPulls") as TextBox;
                TextBox       txtTotalMonthlyWeight = vendorItem.FindControl("txtTotalMonthlyWeight") as TextBox;

                var weight             = 0M;
                var totalMonthlyWeight = 0M;
                Decimal.TryParse(txtWeight.Text, out weight);
                Decimal.TryParse(txtTotalMonthlyWeight.Text, out totalMonthlyWeight);
                recycleVendor.Weight             = weight;
                recycleVendor.RecycleTypeId      = Convert.ToInt32(ddlRecycleType.SelectedValue);
                recycleVendor.RecycleVendorId    = Convert.ToInt32(ddlRecycleVendor.SelectedValue);
                recycleVendor.ServiceDate        = rdpDate.SelectedDate.GetValueOrDefault(DateTime.Today);
                recycleVendor.AccountId          = Convert.ToInt32(ddlAccount.SelectedValue);
                recycleVendor.TotalMonthlyPulls  = Convert.ToInt32(txtTotalMonthlyPulls.Text);
                recycleVendor.TotalMonthlyWeight = totalMonthlyWeight;
                recycleVendor.Save();
            }
        }
Exemplo n.º 2
0
        protected void btnSaveVendorService_Click(object sender, EventArgs e)
        {
            var weight             = 0M;
            var totalMonthlyWeight = 0M;

            if (decimal.TryParse(txtWeight.Text, out weight) &&
                decimal.TryParse(txtTotalMonthlyWeight.Text, out totalMonthlyWeight))
            {
                RecycleVendorServiceEntity v = new RecycleVendorServiceEntity();
                v.Weight             = weight;
                v.RecycleVendorId    = Convert.ToInt32(ddlRecycleVendor.SelectedValue);
                v.RecycleTypeId      = Convert.ToInt32(ddlRecycleType.SelectedValue);
                v.TotalMonthlyPulls  = Convert.ToInt32(txtTotalMonthlyPulls.Text);
                v.TotalMonthlyWeight = totalMonthlyWeight;
                v.AccountId          = Convert.ToInt32(ddlRecycleAccount.SelectedValue);
                v.Save();

                txtWeight.Text = "";

                txtWeight.Focus();
                rdVendorService.Rebind();
            }
        }