Пример #1
0
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        string Id = ((LinkButton)sender).CommandArgument;

        try
        {
            TheTransportPriceListDetailMgr.DeleteTransportPriceListDetail(Convert.ToInt32(Id));
            ShowSuccessMessage("Transportation.TransportPriceListDetail.DeleteOperation.Successfully");
            UpdateView();
        }
        catch (Castle.Facilities.NHibernateIntegration.DataException ex)
        {
            ShowErrorMessage("Transportation.TransportPriceListDetail.DeleteOperation.Fail");
        }
    }
Пример #2
0
    protected void CV_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        switch (cv.ID)
        {
        case "cvItem":

            if (TheItemMgr.LoadItem(args.Value.Trim()) == null)
            {
                ShowWarningMessage("MasterData.Item.Code.NotExist");
                args.IsValid = false;
            }
            else
            {
                Controls_TextBox tbUom = ((Controls_TextBox)(this.FV_Operation.FindControl("tbUom")));
                if (tbUom.Text.Trim() == "")
                {
                    ShowWarningMessage("Transportation.TransportPriceListDetail.Uom.Empty");
                    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 "cvServiceCharge":
            try
            {
                Convert.ToDecimal(args.Value);
            }
            catch (Exception)
            {
                ShowWarningMessage("Transportation.TransportPriceListDetail.ServiceCharge.Error");
                args.IsValid = false;
            }
            break;

        case "cvEndDate":
            try
            {
                if (args.Value.Trim() != "")
                {
                    DateTime startDate = Convert.ToDateTime(((TextBox)(this.FV_Operation.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;

        case "cvBillingMethod":
            TextBox          tbStartDate = ((TextBox)(this.FV_Operation.FindControl("tbStartDate")));
            TextBox          tbEndDate   = ((TextBox)(this.FV_Operation.FindControl("tbEndDate")));
            Controls_TextBox tbItem      = ((Controls_TextBox)(this.FV_Operation.FindControl("tbItem")));
            com.Sconit.Control.CodeMstrDropDownList ddlBillingMethod = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_Operation.FindControl("ddlBillingMethod")));

            IList <TransportPriceListDetail> transportPriceListDetailList = TheTransportPriceListDetailMgr.CheckOperation(this.TransportPriceListCode, tbStartDate.Text.Trim(), tbEndDate.Text.Trim(), tbItem.Text.Trim(), ddlBillingMethod.SelectedValue);
            if (transportPriceListDetailList != null && transportPriceListDetailList.Count > 0)
            {
                if (transportPriceListDetailList.Count > 1 || transportPriceListDetailList[0].Id.ToString() != this.TransportPriceListDetailId)
                {
                    ShowWarningMessage("Transportation.TransportPriceListDetail.ExistOperation");
                    args.IsValid = false;
                }
            }
            break;

        default:
            break;
        }
    }
Пример #3
0
    protected void createTBill()
    {
        TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(OrderNo);

        if (to.Status == "In-Process")
        {
            TransportationActBill tb = new TransportationActBill();
            tb.BillAddress           = TheBillAddressMgr.LoadBillAddress(((Controls_TextBox)(this.FV_Order.FindControl("tbCarrierBillAddress"))).Text);
            tb.Currency              = TheCurrencyMgr.LoadCurrency("RMB");
            tb.Status                = "Create";
            tb.IsIncludeTax          = false;
            tb.OrderNo               = this.OrderNo;
            tb.TransType             = "Transportation";
            tb.EffectiveDate         = DateTime.Now;
            tb.CreateDate            = DateTime.Now;
            tb.CreateUser            = CurrentUser;
            tb.LastModifyUser        = CurrentUser;
            tb.LastModifyDate        = DateTime.Now;
            tb.IsProvisionalEstimate = false;
            string carrier = string.Empty;
            tb.PricingMethod = ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_Order.FindControl("ddlPricingMethod"))).SelectedValue;
            carrier          = ((Controls_TextBox)(this.FV_Order.FindControl("tbCarrier"))).Text + "WL";
            string  vchtype  = ((DropDownList)(this.FV_Order.FindControl("ddlType"))).SelectedValue;
            int     shipto   = (TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo)).TransportationRoute.ShipTo.Id;
            int     shipfrom = (TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo)).TransportationRoute.ShipFrom.Id;
            DataSet ds       = SqlHelper.ExecuteDataset(connstring, CommandType.Text, "select id from TPriceListDet where Tpricelist='" + carrier + "' and startdate<'" + to.CreateDate.ToShortDateString() + "' and enddate >'" + to.CreateDate.ToShortDateString() + "' and currency='RMB' and pricingmethod='" + tb.PricingMethod + "' and vehicletype='" + vchtype + "' and shipto='" + shipto + "' and shipfrom='" + shipfrom + "' ");
            if (ds.Tables[0].Rows.Count == 0)
            {
                throw new BusinessErrorException("没有找到该类型的价格单");
            }
            int _id = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            tb.PriceListDetail = TheTransportPriceListDetailMgr.LoadTransportPriceListDetail(_id);
            tb.PriceList       = TheTransportPriceListMgr.LoadTransportPriceList(carrier);
            tb.UnitPrice       = tb.PriceListDetail.UnitPrice;
            tb.ShipFrom        = tb.PriceListDetail.ShipFrom;
            tb.ShipTo          = tb.PriceListDetail.ShipTo;
            tb.VehicleType     = tb.PriceListDetail.VehicleType;
            if (tb.PricingMethod != "SHIPT")
            {
                decimal qty = 0;
                foreach (DataRow dr in ds_ip.Tables[0].Rows)
                {
                    qty += Convert.ToDecimal((TheInProcessLocationMgr.LoadInProcessLocation(dr["ipno"].ToString())).CompleteLatency);
                }
                tb.BillQty   = qty;
                tb.BilledQty = 0;
                if (qty < tb.PriceListDetail.MinVolume)
                {
                    tb.BillAmount = tb.PriceListDetail.MinVolume * tb.UnitPrice;
                }
                else
                {
                    tb.BillAmount = qty * tb.UnitPrice;
                }
                tb.BilledAmount = 0;
            }
            else
            {
                tb.BillQty      = 1;
                tb.BilledQty    = 0;
                tb.BillAmount   = tb.PriceListDetail.UnitPrice;
                tb.BilledAmount = 0;
            }
            TheTransportationActBillMgr.CreateTransportationActBill(tb);
        }
        else
        {
            return;
        }
    }