示例#1
0
    protected void CV_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        switch (cv.ID)
        {
        case "cvShipFrom":
            if (TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(args.Value)) == null)
            {
                ShowWarningMessage("Transportation.TransportationRoute.ShipFrom.NotExist", args.Value);
                args.IsValid = false;
            }
            break;

        case "cvShipTo":
            if (TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(args.Value)) == null)
            {
                ShowWarningMessage("Transportation.TransportationRoute.ShipTo.NotExist", args.Value);
                args.IsValid = false;
            }
            break;

        default:
            break;
        }
    }
示例#2
0
    protected void ODS_TransportationRouteDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        Controls_TextBox tbTAddress = ((Controls_TextBox)(this.FV_TransportationRouteDetail.FindControl("tbTAddress")));

        transportationRouteDetail = (TransportationRouteDetail)e.InputParameters[0];
        transportationRouteDetail.TransportationAddress = TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(tbTAddress.Text.Trim()));
        transportationRouteDetail.TransportationRoute   = TheTransportationRouteMgr.LoadTransportationRoute(this.TransportationRouteCode);
    }
示例#3
0
    protected void ODS_TransportationRoute_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        Controls_TextBox tbShipFrom = ((Controls_TextBox)(this.FV_TransportationRoute.FindControl("tbShipFrom")));
        Controls_TextBox tbShipTo   = ((Controls_TextBox)(this.FV_TransportationRoute.FindControl("tbShipTo")));

        transportationRoute             = (TransportationRoute)e.InputParameters[0];
        transportationRoute.Code        = transportationRoute.Code.Trim();
        transportationRoute.Description = transportationRoute.Description.Trim();
        transportationRoute.ShipFrom    = TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(tbShipFrom.Text.Trim()));
        transportationRoute.ShipTo      = TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(tbShipTo.Text.Trim()));
    }
示例#4
0
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(((LinkButton)sender).CommandArgument);

        try
        {
            TheTransportationAddressMgr.DeleteTransportationAddress(id);
            ShowSuccessMessage("Transportation.TransportationAddress.DeleteTransportationAddress.Successfully");
            UpdateView();
        }
        catch
        {
            ShowErrorMessage("Transportation.TransportationAddress.DeleteTransportationAddress.Fail");
        }
    }
示例#5
0
    protected void ODS_TransportPriceListDetail_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        Controls_TextBox tbShipFrom = ((Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbShipFrom")));
        Controls_TextBox tbShipTo   = ((Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbShipTo")));

        com.Sconit.Control.CodeMstrDropDownList ddlPricingMethod = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_TransportPriceListDetail.FindControl("ddlPricingMethod")));
        DropDownList     ddlVehicleType        = ((DropDownList)(this.FV_TransportPriceListDetail.FindControl("ddlVehicleType")));
        Controls_TextBox tbCurrency            = ((Controls_TextBox)(this.FV_TransportPriceListDetail.FindControl("tbCurrency")));
        TextBox          tbEndDate             = ((TextBox)(this.FV_TransportPriceListDetail.FindControl("tbEndDate")));
        DropDownList     transportMethodSelect = ((DropDownList)(this.FV_TransportPriceListDetail.FindControl("ddlTransportMethod")));

        transportPriceListDetail = (TransportPriceListDetail)e.InputParameters[0];
        transportPriceListDetail.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(this.TransportPriceListCode);
        transportPriceListDetail.ShipFrom           = TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(tbShipFrom.Text.Trim()));
        transportPriceListDetail.ShipTo             = TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(tbShipTo.Text.Trim()));
        transportPriceListDetail.PricingMethod      = ddlPricingMethod.SelectedValue;
        transportPriceListDetail.VehicleType        = ddlVehicleType.SelectedValue;
        transportPriceListDetail.Currency           = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim());
        transportPriceListDetail.TaxCode            = transportPriceListDetail.TaxCode.Trim();
        transportPriceListDetail.EndDate            = tbEndDate.Text.Trim() == "" ? null : transportPriceListDetail.EndDate;
        transportPriceListDetail.Type            = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION;
        transportPriceListDetail.TransportMethod = transportMethodSelect.SelectedValue;
    }
示例#6
0
    protected void CV_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        switch (cv.ID)
        {
        case "cvShipFrom":
            if (TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(args.Value)) == null)
            {
                ShowWarningMessage("Transportation.TransportPriceListDetail.ShipFrom.NotExist", args.Value);
                args.IsValid = false;
            }
            break;

        case "cvShipTo":
            if (TheTransportationAddressMgr.LoadTransportationAddress(GetTransportationAddressId(args.Value)) == null)
            {
                ShowWarningMessage("Transportation.TransportPriceListDetail.ShipTo.NotExist", args.Value);
                args.IsValid = false;
            }
            break;

        case "cvUnitPrice":
            try
            {
                Convert.ToDecimal(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("Transportation.TransportPriceListDetail.UnitPrice.Error");
                args.IsValid = false;
            }
            break;

        case "cvCurrency":
            if (TheCurrencyMgr.LoadCurrency(args.Value) == null)
            {
                ShowWarningMessage("MasterData.Currency.Code.NotExist", args.Value);
                args.IsValid = false;
            }
            break;

        case "cvMinVolume":
            try
            {
                Convert.ToDecimal(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("Transportation.TransportPriceListDetail.MinVolume.Error");
                args.IsValid = false;
            }
            break;

        case "cvMinPrice":
            try
            {
                Convert.ToDecimal(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("Transportation.TransportPriceListDetail.MinPrice.Error");
                args.IsValid = false;
            }
            break;

        case "cvEndDate":
            try
            {
                if (args.Value.Trim() != "")
                {
                    DateTime startDate = Convert.ToDateTime(((TextBox)(this.FV_TransportPriceListDetail.FindControl("tbStartDate"))).Text.Trim());
                    if (DateTime.Compare(startDate, Convert.ToDateTime(args.Value)) > 0)
                    {
                        ShowErrorMessage("Transportation.TransportPriceListDetail.TimeCompare");
                        args.IsValid = false;
                    }
                }
            }
            catch (Exception)
            {
                ShowWarningMessage("Common.Date.Error");
                args.IsValid = false;
            }
            break;

        default:
            break;
        }
    }