Exemplo n.º 1
0
    protected void grid_bkg_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxPageControl pageControl = this.grid_ref.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
        ASPxTextBox     refNo       = pageControl.FindControl("txt_RefN") as ASPxTextBox;

        e.NewValues["JobNo"] = C2Setup.GetSubNo(refNo.Text, "SE");
        e.NewValues["RefNo"] = refNo.Text;

        e.NewValues["CreateBy"]       = EzshipHelper.GetUserName();
        e.NewValues["CreateDateTime"] = DateTime.Now;
        e.NewValues["UpdateBy"]       = EzshipHelper.GetUserName();
        e.NewValues["UpdateDateTime"] = DateTime.Now;
        e.NewValues["StatusCode"]     = "USE";

        string sql_pod = string.Format("select Pod from SeaExportRef where RefNo='{0}'", refNo.Text);
        string pod1    = SafeValue.SafeString(Manager.ORManager.ExecuteScalar(sql_pod), "SGSIN");
        string expN    = C2Setup.GetNextNo("ExportBooking");
        string bkgN    = SafeValue.SafeString(System.Configuration.ConfigurationManager.AppSettings["BookingPrefix"]);

        //if (pol.Length == 5)
        //    bkgN += pol.Substring(2);
        if (pod1.Length == 5)
        {
            bkgN += pod1.Substring(2);
        }
        e.NewValues["BkgRefNo"] = bkgN + expN;

        string bkgN1 = SafeValue.SafeString(System.Configuration.ConfigurationManager.AppSettings["BookingPrefix"]);

        if (pod1.Length == 5)
        {
            bkgN1 += "/" + pod1.Substring(2);
        }
        e.NewValues["HblNo"] = bkgN1 + "/" + expN;
    }
Exemplo n.º 2
0
    private void SaveJob()
    {
        try
        {
            string          userId      = HttpContext.Current.User.Identity.Name;
            ASPxPageControl pageControl = this.grid_Export.FindEditFormTemplateControl("pageControl_Hbl") as ASPxPageControl;
            //ASPxTextBox houseId = pageControl.FindControl("txtHouseId") as ASPxTextBox;
            ASPxTextBox expNoCtr             = this.grid_Export.FindEditFormTemplateControl("txtHouseNo") as ASPxTextBox;
            int         expN                 = 0; //SafeValue.SafeInt(expNoCtr.Text,0);
            string      expNs                = expNoCtr.Text.Trim();
            Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(AirImport), "JobNo='" + expNs + "'");
            AirImport exp   = C2.Manager.ORManager.GetObject(query) as AirImport;
            bool      isNew = false;
            if (exp == null)
            {
                isNew              = true;
                expN               = 0; //GetNo("IMPORT");
                exp                = new AirImport();
                exp.RefNo          = Request.QueryString["masterNo"].ToString();
                exp.JobNo          = C2Setup.GetSubNo(exp.RefNo, "AE");
                exp.CreateBy       = userId;
                exp.CreateDateTime = DateTime.Now;
                exp.Total          = "0";
                exp.RefType        = "AE";
                exp.StatusCode     = "USE";
            }
            ASPxSpinEdit spin_Weight = this.grid_Export.FindEditFormTemplateControl("spin_Weight") as ASPxSpinEdit;
            exp.Weight = SafeValue.SafeDecimal(spin_Weight.Text);
            ASPxSpinEdit spin_Volume = this.grid_Export.FindEditFormTemplateControl("spin_Volume") as ASPxSpinEdit;
            exp.Volume = SafeValue.SafeDecimal(spin_Volume.Text);
            ASPxSpinEdit spin_Qty = this.grid_Export.FindEditFormTemplateControl("spin_Qty") as ASPxSpinEdit;
            exp.Qty = SafeValue.SafeInt(spin_Qty.Text, 0);
            ASPxButtonEdit txt_PackageType = this.grid_Export.FindEditFormTemplateControl("txt_PackageType") as ASPxButtonEdit;
            exp.PackageType = txt_PackageType.Text;
            ASPxComboBox txt_TsInd = this.grid_Export.FindEditFormTemplateControl("txt_TsInd") as ASPxComboBox;
            exp.TsInd = txt_TsInd.Text;
            ASPxMemo remark = this.grid_Export.FindEditFormTemplateControl("Memo_Remark") as ASPxMemo;
            exp.Remark = remark.Text;
            ASPxMemo marking = this.grid_Export.FindEditFormTemplateControl("Memo_Marking") as ASPxMemo;
            exp.Marking = marking.Text;
            ASPxMemo memo_Des = this.grid_Export.FindEditFormTemplateControl("Memo_Des") as ASPxMemo;
            exp.Description = memo_Des.Text;

            ASPxButtonEdit txtCustId = this.grid_Export.FindEditFormTemplateControl("txtCustId") as ASPxButtonEdit;
            exp.CustomerId = txtCustId.Text;
            ASPxTextBox txtHouseBl = this.grid_Export.FindEditFormTemplateControl("txtHouseBl") as ASPxTextBox;
            exp.Hawb = txtHouseBl.Text;
            ASPxMemo tbxShipperName = pageControl.FindControl("tbxShipperName") as ASPxMemo;
            exp.ShipperName = tbxShipperName.Text;
            ASPxMemo tbxIssuedBy = pageControl.FindControl("tbxIssuedBy") as ASPxMemo;
            exp.IssuedBy = tbxIssuedBy.Text;
            ASPxMemo tbxConsigneeName = pageControl.FindControl("tbxConsigneeName") as ASPxMemo;
            exp.ConsigneeName = tbxConsigneeName.Text;
            ASPxMemo tbxCarrierAgent = pageControl.FindControl("tbxCarrierAgent") as ASPxMemo;
            exp.CarrierAgent = tbxCarrierAgent.Text;
            ASPxMemo tbxAccountInfo = pageControl.FindControl("tbxAccountInfo") as ASPxMemo;
            exp.AccountInfo = tbxAccountInfo.Text;
            ASPxTextBox tbxAgentIATACode = pageControl.FindControl("tbxAgentIATACode") as ASPxTextBox;
            exp.AgentIATACode = tbxAgentIATACode.Text;
            ASPxTextBox tbxAgentAccountNo = pageControl.FindControl("tbxAgentAccountNo") as ASPxTextBox;
            exp.AgentAccountNo = tbxAgentAccountNo.Text;
            ASPxTextBox tbxAirportDeparture = pageControl.FindControl("tbxAirportDeparture") as ASPxTextBox;
            exp.AirportDeparture = tbxAirportDeparture.Text;
            ASPxTextBox tbxConnDest1 = pageControl.FindControl("tbxConnDest1") as ASPxTextBox;
            exp.ConnDest1 = tbxConnDest1.Text;
            ASPxTextBox tbxConnCarrier1 = pageControl.FindControl("tbxConnCarrier1") as ASPxTextBox;
            exp.ConnCarrier1 = tbxConnCarrier1.Text;
            ASPxTextBox tbxConnDest2 = pageControl.FindControl("tbxConnDest2") as ASPxTextBox;
            exp.ConnDest2 = tbxConnDest2.Text;
            ASPxTextBox tbxConnCarrier2 = pageControl.FindControl("tbxConnCarrier2") as ASPxTextBox;
            exp.ConnCarrier2 = tbxConnCarrier2.Text;
            ASPxTextBox tbxConnDest3 = pageControl.FindControl("tbxConnDest3") as ASPxTextBox;
            exp.ConnDest3 = tbxConnDest3.Text;
            ASPxTextBox tbxConnCarrier3 = pageControl.FindControl("tbxConnCarrier3") as ASPxTextBox;
            exp.ConnCarrier3 = tbxConnCarrier3.Text;
            ASPxTextBox tbxCurrency = pageControl.FindControl("tbxCurrency") as ASPxTextBox;
            exp.Currency = tbxCurrency.Text;
            ASPxTextBox tbxChgsCode = pageControl.FindControl("tbxChgsCode") as ASPxTextBox;
            exp.ChgsCode = tbxChgsCode.Text;
            ASPxTextBox tbxPPD1 = pageControl.FindControl("tbxPPD1") as ASPxTextBox;
            exp.Ppd1 = tbxPPD1.Text;
            ASPxTextBox tbxCOLL1 = pageControl.FindControl("tbxCOLL1") as ASPxTextBox;
            exp.Coll1 = tbxCOLL1.Text;
            ASPxTextBox tbxPPD2 = pageControl.FindControl("tbxPPD2") as ASPxTextBox;
            exp.Ppd2 = tbxPPD2.Text;
            ASPxTextBox tbxCOLL2 = pageControl.FindControl("tbxCOLL2") as ASPxTextBox;
            exp.Coll2 = tbxCOLL2.Text;
            ASPxTextBox tbxCarriageValue = pageControl.FindControl("tbxCarriageValue") as ASPxTextBox;
            exp.CarriageValue = tbxCarriageValue.Text;
            ASPxTextBox tbxCustomValue = pageControl.FindControl("tbxCustomValue") as ASPxTextBox;
            exp.CustomValue = tbxCustomValue.Text;
            ASPxTextBox tbxAirportDestination = pageControl.FindControl("tbxAirportDestination") as ASPxTextBox;
            exp.AirportDestination = tbxAirportDestination.Text;
            ASPxTextBox tbxRequestedFlight = pageControl.FindControl("tbxRequestedFlight") as ASPxTextBox;
            exp.RequestedFlight = tbxRequestedFlight.Text;
            ASPxTextBox tbxRequestedDate = pageControl.FindControl("tbxRequestedDate") as ASPxTextBox;
            exp.RequestedDate = tbxRequestedDate.Text;
            ASPxTextBox tbxAmountInsurance = pageControl.FindControl("tbxAmountInsurance") as ASPxTextBox;
            exp.AmountInsurance = tbxAmountInsurance.Text;
            ASPxMemo tbxHandlingInfo = pageControl.FindControl("tbxHandlingInfo") as ASPxMemo;
            exp.HandlingInfo = tbxHandlingInfo.Text;
            ASPxTextBox tbxPiece = pageControl.FindControl("tbxPiece") as ASPxTextBox;
            exp.Piece = tbxPiece.Text;
            ASPxSpinEdit tbxGrossWeight = pageControl.FindControl("tbxGrossWeight") as ASPxSpinEdit;
            exp.GrossWeight = tbxGrossWeight.Text;
            ASPxSpinEdit tbxUnit = pageControl.FindControl("tbxUnit") as ASPxSpinEdit;
            exp.Unit = tbxUnit.Text;
            ASPxTextBox tbxRateClass = pageControl.FindControl("tbxRateClass") as ASPxTextBox;
            exp.RateClass = tbxRateClass.Text;
            ASPxTextBox tbxCommodityItemNo = pageControl.FindControl("tbxCommodityItemNo") as ASPxTextBox;
            exp.CommodityItemNo = tbxCommodityItemNo.Text;
            ASPxSpinEdit tbxChargeableWeight = pageControl.FindControl("tbxChargeableWeight") as ASPxSpinEdit;
            exp.ChargeableWeight = tbxChargeableWeight.Text;
            ASPxTextBox tbxRateCharge = pageControl.FindControl("tbxRateCharge") as ASPxTextBox;
            exp.RateCharge = tbxRateCharge.Text;
            ASPxSpinEdit tbxTotal = pageControl.FindControl("tbxTotal") as ASPxSpinEdit;
            exp.Total = tbxTotal.Text;
            ASPxMemo tbxGoodsNature = pageControl.FindControl("tbxGoodsNature") as ASPxMemo;
            exp.GoodsNature = tbxGoodsNature.Text;
            ASPxMemo tbxContentRemark = pageControl.FindControl("tbxContentRemark") as ASPxMemo;
            exp.ContentRemark = tbxContentRemark.Text;
            ASPxTextBox tbxWeightChargeP = pageControl.FindControl("tbxWeightChargeP") as ASPxTextBox;
            exp.WeightChargeP = tbxWeightChargeP.Text;
            ASPxTextBox tbxWeightChargeC = pageControl.FindControl("tbxWeightChargeC") as ASPxTextBox;
            exp.WeightChargeC = tbxWeightChargeC.Text;
            ASPxTextBox tbxValuationChargeP = pageControl.FindControl("tbxValuationChargeP") as ASPxTextBox;
            exp.ValuationChargeP = tbxValuationChargeP.Text;
            ASPxTextBox tbxValuationChargeC = pageControl.FindControl("tbxValuationChargeC") as ASPxTextBox;
            exp.ValuationChargeC = tbxValuationChargeC.Text;
            ASPxTextBox tbxTaxP = pageControl.FindControl("tbxTaxP") as ASPxTextBox;
            exp.TaxP = tbxTaxP.Text;
            ASPxTextBox tbxTaxC = pageControl.FindControl("tbxTaxC") as ASPxTextBox;
            exp.TaxC = tbxTaxC.Text;
            ASPxTextBox tbxOtherAgentChargeP = pageControl.FindControl("tbxOtherAgentChargeP") as ASPxTextBox;
            exp.OtherAgentChargeP = tbxOtherAgentChargeP.Text;
            ASPxTextBox tbxOtherAgentChargeC = pageControl.FindControl("tbxOtherAgentChargeC") as ASPxTextBox;
            exp.OtherAgentChargeC = tbxOtherAgentChargeC.Text;
            ASPxTextBox tbxOtherCarrierChargeP = pageControl.FindControl("tbxOtherCarrierChargeP") as ASPxTextBox;
            exp.OtherCarrierChargeP = tbxOtherCarrierChargeP.Text;
            ASPxTextBox tbxOtherCarrierChargeC = pageControl.FindControl("tbxOtherCarrierChargeC") as ASPxTextBox;
            exp.OtherCarrierChargeC = tbxOtherCarrierChargeC.Text;
            ASPxTextBox tbxTotalPrepaid = pageControl.FindControl("tbxTotalPrepaid") as ASPxTextBox;
            exp.TotalPrepaid = tbxTotalPrepaid.Text;
            ASPxTextBox tbxTotalCollect = pageControl.FindControl("tbxTotalCollect") as ASPxTextBox;
            exp.TotalCollect = tbxTotalCollect.Text;
            ASPxTextBox tbxCurrencyRate = pageControl.FindControl("tbxCurrencyRate") as ASPxTextBox;
            exp.CurrencyRate = tbxCurrencyRate.Text;
            ASPxTextBox tbxChargeDestCurrency = pageControl.FindControl("tbxChargeDestCurrency") as ASPxTextBox;
            exp.ChargeDestCurrency = tbxChargeDestCurrency.Text;

            ASPxTextBox tbxOtherCharge1 = pageControl.FindControl("tbxOtherCharge1") as ASPxTextBox;
            exp.OtherCharge1 = tbxOtherCharge1.Text;
            ASPxTextBox tbxOtherCharge1Currency = pageControl.FindControl("tbxOtherCharge1Currency") as ASPxTextBox;
            exp.OtherCharge1Currency = tbxOtherCharge1Currency.Text;
            ASPxSpinEdit tbxOtherCharge1Amount = pageControl.FindControl("tbxOtherCharge1Amount") as ASPxSpinEdit;
            exp.OtherCharge1Amount = SafeValue.SafeDecimal(tbxOtherCharge1Amount.Text);

            ASPxTextBox tbxOtherCharge2 = pageControl.FindControl("tbxOtherCharge2") as ASPxTextBox;
            exp.OtherCharge2 = tbxOtherCharge2.Text;
            ASPxTextBox tbxOtherCharge2Currency = pageControl.FindControl("tbxOtherCharge2Currency") as ASPxTextBox;
            exp.OtherCharge2Currency = tbxOtherCharge2Currency.Text;
            ASPxSpinEdit tbxOtherCharge2Amount = pageControl.FindControl("tbxOtherCharge2Amount") as ASPxSpinEdit;
            exp.OtherCharge2Amount = SafeValue.SafeDecimal(tbxOtherCharge2Amount.Text);

            ASPxTextBox tbxOtherCharge3 = pageControl.FindControl("tbxOtherCharge3") as ASPxTextBox;
            exp.OtherCharge3 = tbxOtherCharge3.Text;
            ASPxTextBox tbxOtherCharge3Currency = pageControl.FindControl("tbxOtherCharge3Currency") as ASPxTextBox;
            exp.OtherCharge3Currency = tbxOtherCharge3Currency.Text;
            ASPxSpinEdit tbxOtherCharge3Amount = pageControl.FindControl("tbxOtherCharge3Amount") as ASPxSpinEdit;
            exp.OtherCharge3Amount = SafeValue.SafeDecimal(tbxOtherCharge3Amount.Text);

            ASPxTextBox tbxOtherCharge4 = pageControl.FindControl("tbxOtherCharge4") as ASPxTextBox;
            exp.OtherCharge4 = tbxOtherCharge4.Text;
            ASPxTextBox tbxOtherCharge4Currency = pageControl.FindControl("tbxOtherCharge4Currency") as ASPxTextBox;
            exp.OtherCharge4Currency = tbxOtherCharge4Currency.Text;
            ASPxSpinEdit tbxOtherCharge4Amount = pageControl.FindControl("tbxOtherCharge4Amount") as ASPxSpinEdit;
            exp.OtherCharge4Amount = SafeValue.SafeDecimal(tbxOtherCharge4Amount.Text);

            ASPxTextBox tbxOtherCharge5 = pageControl.FindControl("tbxOtherCharge5") as ASPxTextBox;
            exp.OtherCharge5 = tbxOtherCharge5.Text;
            ASPxTextBox tbxOtherCharge5Currency = pageControl.FindControl("tbxOtherCharge5Currency") as ASPxTextBox;
            exp.OtherCharge5Currency = tbxOtherCharge5Currency.Text;
            ASPxSpinEdit tbxOtherCharge5Amount = pageControl.FindControl("tbxOtherCharge5Amount") as ASPxSpinEdit;
            exp.OtherCharge5Amount = SafeValue.SafeDecimal(tbxOtherCharge5Amount.Text);

            ASPxTextBox tbxSignatureShipper = pageControl.FindControl("tbxSignatureShipper") as ASPxTextBox;
            exp.SignatureShipper = tbxSignatureShipper.Text;
            ASPxTextBox tbxExecuteDate = pageControl.FindControl("tbxExecuteDate") as ASPxTextBox;
            exp.ExecuteDate = tbxExecuteDate.Text;
            ASPxTextBox tbxExecutePlace = pageControl.FindControl("tbxExecutePlace") as ASPxTextBox;
            exp.ExecutePlace = tbxExecutePlace.Text;
            ASPxTextBox tbxSignatureIssuing = pageControl.FindControl("tbxSignatureIssuing") as ASPxTextBox;
            exp.SignatureIssuing = tbxSignatureIssuing.Text;

            ASPxButtonEdit haulier = pageControl.FindControl("txt_Ref_H_Haulier") as ASPxButtonEdit;
            exp.HaulierName = haulier.Text;
            ASPxTextBox crno = pageControl.FindControl("txt_Ref_H_CrNo") as ASPxTextBox;
            exp.HaulierCrNo = crno.Text;
            ASPxTextBox attention = pageControl.FindControl("txt_Ref_H_Attention") as ASPxTextBox;
            exp.HaulierAttention = attention.Text;

            ASPxMemo collectFrm1 = pageControl.FindControl("txt_Ref_H_CltFrm") as ASPxMemo;
            exp.HaulierCollect = collectFrm1.Text;

            ASPxMemo truckTo1 = pageControl.FindControl("txt_Ref_H_TruckTo") as ASPxMemo;
            exp.HaulierTruck = truckTo1.Text;
            ASPxDateEdit collectDate = pageControl.FindControl("date_Ref_H_CltDate") as ASPxDateEdit;
            exp.HaulierCollectDate = collectDate.Date;
            ASPxMemo haulierRmk = pageControl.FindControl("txt_Ref_H_Rmk1") as ASPxMemo;
            exp.HaulierRemark = haulierRmk.Text;
            ASPxMemo haulierPermit = pageControl.FindControl("txt_Hbl_Permit") as ASPxMemo;
            exp.PermitRmk = haulierPermit.Text;

            ASPxTextBox txt_DriverName = pageControl.FindControl("txt_DriverName") as ASPxTextBox;
            exp.DriverName = txt_DriverName.Text;
            ASPxTextBox txt_DriverMobile = pageControl.FindControl("txt_DriverMobile") as ASPxTextBox;
            exp.DriverMobile = txt_DriverMobile.Text;
            ASPxTextBox txt_DriverLicense = pageControl.FindControl("txt_DriverLicense") as ASPxTextBox;
            exp.DriverLicense = txt_DriverLicense.Text;
            ASPxTextBox txt_VehicleNo = pageControl.FindControl("txt_VehicleNo") as ASPxTextBox;
            exp.VehicleNo = txt_VehicleNo.Text;
            ASPxTextBox txt_VehicleType = pageControl.FindControl("txt_VehicleType") as ASPxTextBox;
            exp.VehicleType = txt_VehicleType.Text;
            ASPxMemo me_DriverRemark = pageControl.FindControl("me_DriverRemark") as ASPxMemo;
            exp.DriverRemark = me_DriverRemark.Text;
            ASPxDateEdit deliveryDate = this.grid_Export.FindEditFormTemplateControl("date_DeliveryDate") as ASPxDateEdit;
            exp.DeliveryDate = deliveryDate.Date;

            ASPxComboBox doReady = this.grid_Export.FindEditFormTemplateControl("txtDoReady") as ASPxComboBox;
            exp.DoReadyInd = doReady.Text;

            ASPxButtonEdit txtPODBy = pageControl.FindControl("txtPODBy") as ASPxButtonEdit;
            exp.PODBy = txtPODBy.Text;
            ASPxDateEdit date_PodTime = pageControl.FindControl("date_PodTime") as ASPxDateEdit;
            exp.PODTime = date_PodTime.Date;
            ASPxMemo me_Remark = pageControl.FindControl("me_Remark") as ASPxMemo;
            exp.PODRemark     = me_Remark.Text;
            exp.PODUpdateUser = EzshipHelper.GetUserName();
            exp.PODUpdateTime = DateTime.Now;

            ASPxTextBox txt_TsBkgRef = this.grid_Export.FindEditFormTemplateControl("txt_TsBkgRef") as ASPxTextBox;
            exp.TsBkgRef = txt_TsBkgRef.Text;
            ASPxTextBox txt_TsBkgUser = this.grid_Export.FindEditFormTemplateControl("txt_TsBkgUser") as ASPxTextBox;
            exp.TsBkgUser = txt_TsBkgUser.Text;
            ASPxDateEdit date_TsBkgTime = this.grid_Export.FindEditFormTemplateControl("date_TsBkgTime") as ASPxDateEdit;
            exp.TsBkgTime = date_TsBkgTime.Date;

            if (isNew)
            {
                exp.CloseInd       = "N";
                exp.CreateBy       = userId;
                exp.CreateDateTime = DateTime.Now;
                exp.RefNo          = Request.QueryString["masterNo"].ToString();
                C2.Manager.ORManager.StartTracking(exp, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(exp);
                //SetNewNo("IMPORT", expN);
            }
            else
            {
                exp.UpdateBy       = userId;
                exp.UpdateDateTime = DateTime.Now;
                C2.Manager.ORManager.StartTracking(exp, Wilson.ORMapper.InitialState.Updated);
                C2.Manager.ORManager.PersistChanges(exp);
            }
            UpdateMast(exp.RefNo);
            Session["AirExpWhere"]      = "JobNo='" + exp.JobNo + "'";
            this.dsJob.FilterExpression = Session["AirExpWhere"].ToString();
            if (this.grid_Export.GetRow(0) != null)
            {
                this.grid_Export.StartEdit(0);
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message + ex.StackTrace); }
    }
Exemplo n.º 3
0
    private string Tranship(string impNo)
    {
        string user = HttpContext.Current.User.Identity.Name;
        //string pod = tPod.Text;
        string    refN       = SafeValue.SafeString(Request.QueryString["refNo"]);
        string    sql        = string.Format("select Pol,Pod,Vessel, Voyage, Eta, Etd, EtaDest from SeaExportRef where RefNo='{0}'", refN);
        DataTable tab_expRef = ConnectSql.GetTab(sql);

        if (tab_expRef.Rows.Count == 0)
        {
            return("Error");
        }
        string    pod     = SafeValue.SafeString(tab_expRef.Rows[0]["Pod"]);
        string    pol     = SafeValue.SafeString(tab_expRef.Rows[0]["Pol"]);
        string    polName = EzshipHelper.GetPortName(pol, "SINGAPORE");
        string    podName = EzshipHelper.GetPortName(pod, "SINGAPORE");
        SeaExport exp     = new SeaExport();

        #region export info

        exp.AsAgent = "N";

        string bkgNo      = C2Setup.GetNextNo("ExportBooking");
        string bkgNPrefix = "SIN";
        if (pod.Length == 5)
        {
            bkgNPrefix += pod.Substring(2);
        }
        exp.BkgRefNo       = bkgNPrefix + bkgNo;
        exp.CollectFrom    = "";
        exp.CreateBy       = EzshipHelper.GetUserName();
        exp.CreateDateTime = DateTime.Now;
        exp.CustomerId     = "";
        exp.ExpressBl      = "N";

        exp.FrtTerm            = "FP";
        exp.HaulierAttention   = "";
        exp.HaulierCollect     = "";
        exp.HaulierCrNo        = "";
        exp.HaulierName        = "";
        exp.HaulierRemark      = "";
        exp.HaulierTruck       = "";
        exp.HblNo              = "";
        exp.ImpCharge          = 0;
        exp.JobNo              = C2Setup.GetSubNo(refN, "SE");
        exp.Marking            = "";
        exp.PermitRmk          = "";
        exp.PlaceDeliveryId    = pod;
        exp.PlaceDeliveryName  = podName;
        exp.PlaceDeliveryTerm  = "CFS";
        exp.PlaceDischargeName = podName;
        exp.PlaceLoadingName   = polName;
        exp.PlaceReceiveId     = pol;
        exp.PlaceReceiveName   = polName;
        exp.PlaceReceiveTerm   = "CFS";
        exp.Pod                = pod;
        exp.Pol                = pol;
        exp.PreCarriage        = "";
        exp.RefNo              = refN;
        exp.Remark             = "";
        exp.SAgentRemark       = "";
        exp.SConsigneeRemark   = "";
        exp.ShipLoadInd        = "N";
        exp.ShipOnBoardDate    = DateTime.Today;
        exp.ShipOnBoardInd     = "N";
        exp.ShipperContact     = "";
        exp.ShipperEmail       = "";
        exp.ShipperFax         = "";
        exp.ShipperId          = "";
        exp.ShipperName        = "";
        exp.ShipperTel         = "";
        exp.SNotifyPartyRemark = "";
        exp.SShipperRemark     = "";
        exp.StatusCode         = "USE";
        exp.SurrenderBl        = "N";
        exp.TsInd              = "Y";
        exp.TsJobNo            = impNo;
        exp.UpdateBy           = EzshipHelper.GetUserName();
        exp.UpdateDateTime     = DateTime.Now;



        string  finDest = pod;
        decimal wt      = 0;
        decimal m3      = 0;
        int     qty     = 0;
        string  pkgType = "";

        sql = string.Format(@"SELECT TsPod, TsPortFinName, TsVessel, TsVoyage, TsColoader, TsEtd, TsEta, TsAgentId, TsRemark, TsAgtRate, TsTotAgtRate, TsImpRate, 
                      TsTotImpRate,Weight,Volume,Qty,PackageType FROM SeaImport where JobNo='{0}'", impNo);
        DataTable tab = C2.Manager.ORManager.GetDataSet(sql).Tables[0];
        if (tab.Rows.Count > 0)
        {
            DataRow row = tab.Rows[0];
            pod     = row["TsPod"].ToString();
            finDest = row["TsPortFinName"].ToString();
            wt      = SafeValue.SafeDecimal(row["Weight"], 0);
            m3      = SafeValue.SafeDecimal(row["Volume"], 0);
            qty     = SafeValue.SafeInt(row["Qty"], 0);
            pkgType = row["PackageType"].ToString();
        }
        exp.FinDest = finDest;



        exp.Weight      = wt;
        exp.Volume      = m3;
        exp.Qty         = qty;
        exp.PackageType = pkgType;
        #endregion

        C2.Manager.ORManager.StartTracking(exp, Wilson.ORMapper.InitialState.Inserted);
        C2.Manager.ORManager.PersistChanges(exp);
        C2Setup.SetNextNo("ExportBooking", bkgNo);
        //create bkg
        #region booking and marking
        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(SeaImportMkg), "JobNo='" + exp.TsJobNo + "'");
        ObjectSet set_impMkgs            = C2.Manager.ORManager.GetObjectSet(query);
        for (int m = 0; m < set_impMkgs.Count; m++)
        {
            C2.SeaImportMkg impMkg  = set_impMkgs[m] as C2.SeaImportMkg;
            C2.SeaExportMkg mkg_bkg = new SeaExportMkg();
            mkg_bkg.ContainerNo    = "";
            mkg_bkg.ContainerType  = "";
            mkg_bkg.Description    = impMkg.Description;
            mkg_bkg.CreateDateTime = DateTime.Now;
            mkg_bkg.JobNo          = exp.JobNo;
            mkg_bkg.Marking        = impMkg.Marking;
            mkg_bkg.MkgType        = "BKG";
            mkg_bkg.PackageType    = "";
            mkg_bkg.Qty            = impMkg.Qty;
            mkg_bkg.RefNo          = exp.RefNo;
            mkg_bkg.Remark         = impMkg.Remark;
            mkg_bkg.SealNo         = "";
            mkg_bkg.CreateBy       = EzshipHelper.GetUserName();
            mkg_bkg.Volume         = impMkg.Volume;
            mkg_bkg.Weight         = impMkg.Weight;
            C2.Manager.ORManager.StartTracking(mkg_bkg, Wilson.ORMapper.InitialState.Inserted);
            C2.Manager.ORManager.PersistChanges(mkg_bkg);

            C2.SeaExportMkg mkg = new SeaExportMkg();
            mkg.ContainerNo    = "";
            mkg.ContainerType  = "";
            mkg.Description    = impMkg.Description;
            mkg.CreateDateTime = DateTime.Now;
            mkg.JobNo          = exp.JobNo;
            mkg.Marking        = impMkg.Marking;
            mkg.MkgType        = "BL";
            mkg.PackageType    = "";
            mkg.Qty            = impMkg.Qty;
            mkg.RefNo          = exp.RefNo;
            mkg.Remark         = impMkg.Remark;
            mkg.SealNo         = "";
            mkg.CreateBy       = EzshipHelper.GetUserName();
            mkg.Volume         = impMkg.Volume;
            mkg.Weight         = impMkg.Weight;
            C2.Manager.ORManager.StartTracking(mkg, Wilson.ORMapper.InitialState.Inserted);
            C2.Manager.ORManager.PersistChanges(mkg);
        }

        #endregion

        //update import info

        DataRow  row1 = tab_expRef.Rows[0];
        string   ves  = row1["Vessel"].ToString();
        string   voy  = row1["Voyage"].ToString();
        DateTime eta  = SafeValue.SafeDate(row1["Eta"], new DateTime(1900, 1, 1));
        DateTime etd  = SafeValue.SafeDate(row1["Etd"], new DateTime(1900, 1, 1));
        // DateTime etaDest = SafeValue.SafeDate(row["EtaDest"], new DateTime(1900, 1, 1));
        sql = string.Format("Update SeaImport Set TsVessel='{0}', TsVoyage='{1}', TsEtd='{2}', TsEta='{3}',TsSchNo='{4}', TsBkgNo='{5}', TsPortFinName='{6}',tsBkgId='{7}',TsJobNo='{9}',TsRefNo='{10}' where JobNo='{8}'",
                            ves, voy, etd, eta, refN, exp.BkgRefNo, finDest, exp.SequenceId, impNo, exp.JobNo, exp.RefNo);
        int res = C2.Manager.ORManager.ExecuteCommand(sql);

        return("Success");
    }
Exemplo n.º 4
0
    private void SaveJob()
    {
        try
        {
            ASPxPageControl            pageControl = this.grid_ref.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
            ASPxTextBox                txtRefNo    = this.grid_ref.FindEditFormTemplateControl("txt_RefN") as ASPxTextBox;
            ASPxTextBox                txt_Id      = this.grid_ref.FindEditFormTemplateControl("txt_Id") as ASPxTextBox;
            ASPxDateEdit               refDate     = this.grid_ref.FindEditFormTemplateControl("date_RefDate") as ASPxDateEdit;
            string                     refNo       = SafeValue.SafeString(txt_RefNo.Text, "");
            int                        id          = SafeValue.SafeInt(txt_Id.Text, 0);
            Wilson.ORMapper.OPathQuery query       = new Wilson.ORMapper.OPathQuery(typeof(AirImportRef), "Id=" + id + "");
            AirImportRef               airRef      = C2.Manager.ORManager.GetObject(query) as AirImportRef;
            bool                       isNew       = false;
            string                     userId      = HttpContext.Current.User.Identity.Name;
            if (airRef == null)
            {
                airRef = new AirImportRef();
                isNew  = true;
                refNo  = C2Setup.GetNextNo("AI", "AirImport", refDate.Date);
                AirImport air = new AirImport();
                air.JobNo          = C2Setup.GetSubNo(refNo, "AI");
                air.CloseInd       = "N";
                air.CreateBy       = userId;
                air.CreateDateTime = DateTime.Now;
                air.RefNo          = refNo;
                air.Total          = "0";
                air.RefType        = "AI";
                air.StatusCode     = "USE";
                C2.Manager.ORManager.StartTracking(air, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(air);
            }
            ASPxButtonEdit txt_AgentId = this.grid_ref.FindEditFormTemplateControl("txt_AgentId") as ASPxButtonEdit;
            airRef.AgentId = txt_AgentId.Text;
            ASPxButtonEdit localCust = this.grid_ref.FindEditFormTemplateControl("txt_LocalCust") as ASPxButtonEdit;
            airRef.LocalCust = localCust.Text;
            ASPxMemo remarks = pageControl.FindControl("txt_Remarks") as ASPxMemo;
            airRef.Remarks = remarks.Text;
            ASPxButtonEdit tbxAirportCode0 = pageControl.FindControl("tbxAirportCode0") as ASPxButtonEdit;
            airRef.AirportCode0 = tbxAirportCode0.Text;
            ASPxTextBox tbxAirportName0 = pageControl.FindControl("tbxAirportName0") as ASPxTextBox;
            airRef.AirportName0 = tbxAirportName0.Text;
            ASPxDateEdit date_FlightDate0 = pageControl.FindControl("date_FlightDate0") as ASPxDateEdit;
            airRef.FlightDate0 = date_FlightDate0.Date;
            ASPxTextBox tbxFlightTime0 = pageControl.FindControl("tbxFlightTime0") as ASPxTextBox;
            airRef.FlightTime0 = tbxFlightTime0.Text;


            airRef.RefDate = refDate.Date;
            ASPxButtonEdit tbxAirportCode1 = pageControl.FindControl("txt_AirportCode1") as ASPxButtonEdit;
            airRef.AirportCode1 = tbxAirportCode1.Text;
            ASPxTextBox tbxAirportName1 = pageControl.FindControl("txt_AirportName1") as ASPxTextBox;
            airRef.AirportName1 = tbxAirportName1.Text;
            ASPxDateEdit spin_FlightDate1 = pageControl.FindControl("spin_FlightDate1") as ASPxDateEdit;
            airRef.FlightDate1 = spin_FlightDate1.Date;
            ASPxTextBox txt_FlightTime1 = pageControl.FindControl("txt_FlightTime1") as ASPxTextBox;
            airRef.FlightTime1 = txt_FlightTime1.Text;



            ASPxTextBox tbxAirlineCode1 = pageControl.FindControl("tbxAirlineCode1") as ASPxTextBox;
            airRef.AirlineCode1 = tbxAirlineCode1.Text;
            ASPxTextBox tbxAirlineName1 = pageControl.FindControl("tbxAirlineName1") as ASPxTextBox;
            airRef.AirlineName1 = tbxAirlineName1.Text;
            ASPxTextBox tbxFlightNo1 = pageControl.FindControl("tbxFlightNo1") as ASPxTextBox;
            airRef.FlightNo1 = tbxFlightNo1.Text;
            ASPxDateEdit tbxAirFlightDate1 = pageControl.FindControl("tbxAirFlightDate1") as ASPxDateEdit;
            airRef.AirFlightDate1 = tbxAirFlightDate1.Date;
            ASPxTextBox tbxAirFlightTime1 = pageControl.FindControl("tbxAirFlightTime1") as ASPxTextBox;
            airRef.AirFlightTime1 = tbxAirFlightTime1.Text;
            ASPxButtonEdit tbxAirLinePortCode1 = pageControl.FindControl("tbxAirLinePortCode1") as ASPxButtonEdit;
            airRef.AirLinePortCode1 = tbxAirLinePortCode1.Text;
            ASPxTextBox tbxAirLinePortName1 = pageControl.FindControl("tbxAirLinePortName1") as ASPxTextBox;
            airRef.AirLinePortName1 = tbxAirLinePortName1.Text;


            ASPxTextBox tbxAirlineCode2 = pageControl.FindControl("tbxAirlineCode2") as ASPxTextBox;
            airRef.AirlineCode2 = tbxAirlineCode2.Text;
            ASPxTextBox tbxAirlineName2 = pageControl.FindControl("tbxAirlineName2") as ASPxTextBox;
            airRef.AirlineName2 = tbxAirlineName2.Text;
            ASPxTextBox tbxFlightNo2 = pageControl.FindControl("tbxFlightNo2") as ASPxTextBox;
            airRef.FlightNo2 = tbxFlightNo2.Text;
            ASPxDateEdit tbxFlightDate2 = pageControl.FindControl("tbxFlightDate2") as ASPxDateEdit;
            airRef.FlightDate2 = tbxFlightDate2.Date;
            ASPxTextBox tbxFlightTime2 = pageControl.FindControl("tbxFlightTime2") as ASPxTextBox;
            airRef.FlightTime2 = tbxFlightTime2.Text;
            ASPxButtonEdit tbxAirportCode2 = pageControl.FindControl("tbxAirportCode2") as ASPxButtonEdit;
            airRef.AirportCode2 = tbxAirportCode2.Text;
            ASPxTextBox AirportName2 = pageControl.FindControl("tbxAirportName2") as ASPxTextBox;
            airRef.AirportName2 = AirportName2.Text;

            ASPxTextBox tbxAirlineCode3 = pageControl.FindControl("tbxAirlineCode3") as ASPxTextBox;
            airRef.AirlineCode3 = tbxAirlineCode3.Text;
            ASPxTextBox tbxAirlineName3 = pageControl.FindControl("tbxAirlineName3") as ASPxTextBox;
            airRef.AirlineName3 = tbxAirlineName3.Text;
            ASPxTextBox tbxFlightNo3 = pageControl.FindControl("tbxFlightNo3") as ASPxTextBox;
            airRef.FlightNo3 = tbxFlightNo3.Text;
            ASPxDateEdit tbxFlightDate3 = pageControl.FindControl("tbxFlightDate3") as ASPxDateEdit;
            airRef.FlightDate3 = tbxFlightDate3.Date;
            ASPxTextBox tbxFlightTime3 = pageControl.FindControl("tbxFlightTime3") as ASPxTextBox;
            airRef.FlightTime3 = tbxFlightTime3.Text;
            ASPxButtonEdit tbxAirportCode3 = pageControl.FindControl("tbxAirportCode3") as ASPxButtonEdit;
            airRef.AirportCode3 = tbxAirportCode3.Text;
            ASPxTextBox tbxAirportName3 = pageControl.FindControl("tbxAirportName3") as ASPxTextBox;
            airRef.AirportName3 = tbxAirportName3.Text;

            ASPxTextBox tbxAirlineCode4 = pageControl.FindControl("tbxAirlineCode4") as ASPxTextBox;
            airRef.AirlineCode4 = tbxAirlineCode4.Text;
            ASPxTextBox tbxAirlineName4 = pageControl.FindControl("tbxAirlineName4") as ASPxTextBox;
            airRef.AirlineName4 = tbxAirlineName4.Text;
            ASPxTextBox tbxFlightNo4 = pageControl.FindControl("tbxFlightNo4") as ASPxTextBox;
            airRef.FlightNo4 = tbxFlightNo4.Text;
            ASPxDateEdit tbxFlightDate4 = pageControl.FindControl("tbxFlightDate4") as ASPxDateEdit;
            airRef.FlightDate4 = tbxFlightDate4.Date;
            ASPxTextBox tbxFlightTime4 = pageControl.FindControl("tbxFlightTime4") as ASPxTextBox;
            airRef.FlightTime4 = tbxFlightTime4.Text;
            ASPxButtonEdit tbxAirportCode4 = pageControl.FindControl("tbxAirportCode4") as ASPxButtonEdit;
            airRef.AirportCode4 = tbxAirportCode4.Text;
            ASPxTextBox AirportName4 = pageControl.FindControl("tbxAirportName4") as ASPxTextBox;
            airRef.AirportName4 = AirportName4.Text;

            ASPxTextBox txtMAWB = this.grid_ref.FindEditFormTemplateControl("txt_MAWB") as ASPxTextBox;
            airRef.Mawb = txtMAWB.Text;

            ASPxButtonEdit txt_CrAgentId = this.grid_ref.FindEditFormTemplateControl("txt_CrAgentId") as ASPxButtonEdit;
            airRef.CarrierAgentId = txt_CrAgentId.Text;
            ASPxTextBox txt_CrBkgRefN = this.grid_ref.FindEditFormTemplateControl("txt_CrBkgRefN") as ASPxTextBox;
            airRef.CarrierBkgNo = txt_CrBkgRefN.Text;
            ASPxButtonEdit txt_NvoccAgentId = pageControl.FindControl("txt_NvoccAgentId") as ASPxButtonEdit;
            airRef.NvoccAgentId = txt_NvoccAgentId.Text;
            ASPxTextBox txt_NvoccBl = pageControl.FindControl("txt_NvoccBl") as ASPxTextBox;
            airRef.NvoccBlNO = txt_NvoccBl.Text;
            ASPxButtonEdit cbx_Currency = pageControl.FindControl("cbx_Currency") as ASPxButtonEdit;
            airRef.CurrencyId = cbx_Currency.Text;
            ASPxSpinEdit spin_CrExRate = pageControl.FindControl("spin_CrExRate") as ASPxSpinEdit;
            airRef.ExRate = SafeValue.SafeDecimal(spin_CrExRate.Value, 0);
            ASPxButtonEdit txt_WhId = pageControl.FindControl("txt_WhId") as ASPxButtonEdit;
            airRef.WareHouseId = txt_WhId.Text;
            ASPxMemo tbxShipperName = pageControl.FindControl("tbxShipperName") as ASPxMemo;
            airRef.ShipperName = tbxShipperName.Text;
            ASPxMemo tbxIssuedBy = pageControl.FindControl("tbxIssuedBy") as ASPxMemo;
            airRef.IssuedBy = tbxIssuedBy.Text;
            ASPxMemo tbxConsigneeName = pageControl.FindControl("tbxConsigneeName") as ASPxMemo;
            airRef.ConsigneeName = tbxConsigneeName.Text;
            ASPxMemo tbxCarrierAgent = pageControl.FindControl("tbxCarrierAgent") as ASPxMemo;
            airRef.CarrierAgent = tbxCarrierAgent.Text;
            ASPxMemo tbxAccountInfo = pageControl.FindControl("tbxAccountInfo") as ASPxMemo;
            airRef.AccountInfo = tbxAccountInfo.Text;
            ASPxTextBox tbxAgentIATACode = pageControl.FindControl("tbxAgentIATACode") as ASPxTextBox;
            airRef.AgentIATACode = tbxAgentIATACode.Text;
            ASPxTextBox tbxAgentAccountNo = pageControl.FindControl("tbxAgentAccountNo") as ASPxTextBox;
            airRef.AgentAccountNo = tbxAgentAccountNo.Text;
            ASPxTextBox tbxAirportDeparture = pageControl.FindControl("tbxAirportDeparture") as ASPxTextBox;
            airRef.AirportDeparture = tbxAirportDeparture.Text;
            ASPxTextBox tbxConnDest1 = pageControl.FindControl("tbxConnDest1") as ASPxTextBox;
            airRef.ConnDest1 = tbxConnDest1.Text;
            ASPxTextBox tbxConnCarrier1 = pageControl.FindControl("tbxConnCarrier1") as ASPxTextBox;
            airRef.ConnCarrier1 = tbxConnCarrier1.Text;
            ASPxTextBox tbxConnDest2 = pageControl.FindControl("tbxConnDest2") as ASPxTextBox;
            airRef.ConnDest2 = tbxConnDest2.Text;
            ASPxTextBox tbxConnCarrier2 = pageControl.FindControl("tbxConnCarrier2") as ASPxTextBox;
            airRef.ConnCarrier2 = tbxConnCarrier2.Text;
            ASPxTextBox tbxConnDest3 = pageControl.FindControl("tbxConnDest3") as ASPxTextBox;
            airRef.ConnDest3 = tbxConnDest3.Text;
            ASPxTextBox tbxConnCarrier3 = pageControl.FindControl("tbxConnCarrier3") as ASPxTextBox;
            airRef.ConnCarrier3 = tbxConnCarrier3.Text;
            ASPxTextBox tbxCurrency = pageControl.FindControl("tbxCurrency") as ASPxTextBox;
            airRef.Currency = tbxCurrency.Text;
            ASPxTextBox tbxChgsCode = pageControl.FindControl("tbxChgsCode") as ASPxTextBox;
            airRef.ChgsCode = tbxChgsCode.Text;
            ASPxTextBox tbxPPD1 = pageControl.FindControl("tbxPPD1") as ASPxTextBox;
            airRef.Ppd1 = tbxPPD1.Text;
            ASPxTextBox tbxCOLL1 = pageControl.FindControl("tbxCOLL1") as ASPxTextBox;
            airRef.Coll1 = tbxCOLL1.Text;
            ASPxTextBox tbxPPD2 = pageControl.FindControl("tbxPPD2") as ASPxTextBox;
            airRef.Ppd2 = tbxPPD2.Text;
            ASPxTextBox tbxCOLL2 = pageControl.FindControl("tbxCOLL2") as ASPxTextBox;
            airRef.Coll2 = tbxCOLL2.Text;
            ASPxTextBox tbxCarriageValue = pageControl.FindControl("tbxCarriageValue") as ASPxTextBox;
            airRef.CarriageValue = tbxCarriageValue.Text;
            ASPxTextBox tbxCustomValue = pageControl.FindControl("tbxCustomValue") as ASPxTextBox;
            airRef.CustomValue = tbxCustomValue.Text;
            ASPxTextBox tbxAirportDestination = pageControl.FindControl("tbxAirportDestination") as ASPxTextBox;
            airRef.AirportDestination = tbxAirportDestination.Text;
            ASPxTextBox tbxRequestedFlight = pageControl.FindControl("tbxRequestedFlight") as ASPxTextBox;
            airRef.RequestedFlight = tbxRequestedFlight.Text;
            ASPxTextBox tbxRequestedDate = pageControl.FindControl("tbxRequestedDate") as ASPxTextBox;
            airRef.RequestedDate = tbxRequestedDate.Text;
            ASPxTextBox tbxAmountInsurance = pageControl.FindControl("tbxAmountInsurance") as ASPxTextBox;
            airRef.AmountInsurance = tbxAmountInsurance.Text;
            ASPxMemo tbxHandlingInfo = pageControl.FindControl("tbxHandlingInfo") as ASPxMemo;
            airRef.HandlingInfo = tbxHandlingInfo.Text;
            ASPxTextBox tbxPiece = pageControl.FindControl("tbxPiece") as ASPxTextBox;
            airRef.Piece = tbxPiece.Text;
            ASPxSpinEdit tbxGrossWeight = pageControl.FindControl("tbxGrossWeight") as ASPxSpinEdit;
            airRef.GrossWeight = tbxGrossWeight.Text;
            ASPxSpinEdit tbxUnit = pageControl.FindControl("tbxUnit") as ASPxSpinEdit;
            airRef.Unit = tbxUnit.Text;
            ASPxTextBox tbxRateClass = pageControl.FindControl("tbxRateClass") as ASPxTextBox;
            airRef.RateClass = tbxRateClass.Text;
            ASPxTextBox tbxCommodityItemNo = pageControl.FindControl("tbxCommodityItemNo") as ASPxTextBox;
            airRef.CommodityItemNo = tbxCommodityItemNo.Text;
            ASPxSpinEdit tbxChargeableWeight = pageControl.FindControl("tbxChargeableWeight") as ASPxSpinEdit;
            airRef.ChargeableWeight = tbxChargeableWeight.Text;
            ASPxTextBox tbxRateCharge = pageControl.FindControl("tbxRateCharge") as ASPxTextBox;
            airRef.RateCharge = tbxRateCharge.Text;
            ASPxSpinEdit tbxTotal = pageControl.FindControl("tbxTotal") as ASPxSpinEdit;
            airRef.Total = tbxTotal.Text;
            ASPxMemo tbxGoodsNature = pageControl.FindControl("tbxGoodsNature") as ASPxMemo;
            airRef.GoodsNature = tbxGoodsNature.Text;
            ASPxMemo tbxContentRemark = pageControl.FindControl("tbxContentRemark") as ASPxMemo;
            airRef.ContentRemark = tbxContentRemark.Text;
            ASPxTextBox tbxWeightChargeP = pageControl.FindControl("tbxWeightChargeP") as ASPxTextBox;
            airRef.WeightChargeP = tbxWeightChargeP.Text;
            ASPxTextBox tbxWeightChargeC = pageControl.FindControl("tbxWeightChargeC") as ASPxTextBox;
            airRef.WeightChargeC = tbxWeightChargeC.Text;
            ASPxTextBox tbxValuationChargeP = pageControl.FindControl("tbxValuationChargeP") as ASPxTextBox;
            airRef.ValuationChargeP = tbxValuationChargeP.Text;
            ASPxTextBox tbxValuationChargeC = pageControl.FindControl("tbxValuationChargeC") as ASPxTextBox;
            airRef.ValuationChargeC = tbxValuationChargeC.Text;
            ASPxTextBox tbxTaxP = pageControl.FindControl("tbxTaxP") as ASPxTextBox;
            airRef.TaxP = tbxTaxP.Text;
            ASPxTextBox tbxTaxC = pageControl.FindControl("tbxTaxC") as ASPxTextBox;
            airRef.TaxC = tbxTaxC.Text;
            ASPxTextBox tbxOtherAgentChargeP = pageControl.FindControl("tbxOtherAgentChargeP") as ASPxTextBox;
            airRef.OtherAgentChargeP = tbxOtherAgentChargeP.Text;
            ASPxTextBox tbxOtherAgentChargeC = pageControl.FindControl("tbxOtherAgentChargeC") as ASPxTextBox;
            airRef.OtherAgentChargeC = tbxOtherAgentChargeC.Text;
            ASPxTextBox tbxOtherCarrierChargeP = pageControl.FindControl("tbxOtherCarrierChargeP") as ASPxTextBox;
            airRef.OtherCarrierChargeP = tbxOtherCarrierChargeP.Text;
            ASPxTextBox tbxOtherCarrierChargeC = pageControl.FindControl("tbxOtherCarrierChargeC") as ASPxTextBox;
            airRef.OtherCarrierChargeC = tbxOtherCarrierChargeC.Text;
            ASPxTextBox tbxTotalPrepaid = pageControl.FindControl("tbxTotalPrepaid") as ASPxTextBox;
            airRef.TotalPrepaid = tbxTotalPrepaid.Text;
            ASPxTextBox tbxTotalCollect = pageControl.FindControl("tbxTotalCollect") as ASPxTextBox;
            airRef.TotalCollect = tbxTotalCollect.Text;
            ASPxTextBox tbxCurrencyRate = pageControl.FindControl("tbxCurrencyRate") as ASPxTextBox;
            airRef.CurrencyRate = tbxCurrencyRate.Text;
            ASPxTextBox tbxChargeDestCurrency = pageControl.FindControl("tbxChargeDestCurrency") as ASPxTextBox;
            airRef.ChargeDestCurrency = tbxChargeDestCurrency.Text;

            ASPxTextBox tbxOtherCharge1 = pageControl.FindControl("tbxOtherCharge1") as ASPxTextBox;
            airRef.OtherCharge1 = tbxOtherCharge1.Text;
            ASPxTextBox tbxOtherCharge1Currency = pageControl.FindControl("tbxOtherCharge1Currency") as ASPxTextBox;
            airRef.OtherCharge1Currency = tbxOtherCharge1Currency.Text;
            ASPxSpinEdit tbxOtherCharge1Amount = pageControl.FindControl("tbxOtherCharge1Amount") as ASPxSpinEdit;
            airRef.OtherCharge1Amount = SafeValue.SafeDecimal(tbxOtherCharge1Amount.Text);

            ASPxTextBox tbxOtherCharge2 = pageControl.FindControl("tbxOtherCharge2") as ASPxTextBox;
            airRef.OtherCharge2 = tbxOtherCharge2.Text;
            ASPxTextBox tbxOtherCharge2Currency = pageControl.FindControl("tbxOtherCharge2Currency") as ASPxTextBox;
            airRef.OtherCharge2Currency = tbxOtherCharge2Currency.Text;
            ASPxSpinEdit tbxOtherCharge2Amount = pageControl.FindControl("tbxOtherCharge2Amount") as ASPxSpinEdit;
            airRef.OtherCharge2Amount = SafeValue.SafeDecimal(tbxOtherCharge2Amount.Text);

            ASPxTextBox tbxOtherCharge3 = pageControl.FindControl("tbxOtherCharge3") as ASPxTextBox;
            airRef.OtherCharge3 = tbxOtherCharge3.Text;
            ASPxTextBox tbxOtherCharge3Currency = pageControl.FindControl("tbxOtherCharge3Currency") as ASPxTextBox;
            airRef.OtherCharge3Currency = tbxOtherCharge3Currency.Text;
            ASPxSpinEdit tbxOtherCharge3Amount = pageControl.FindControl("tbxOtherCharge3Amount") as ASPxSpinEdit;
            airRef.OtherCharge3Amount = SafeValue.SafeDecimal(tbxOtherCharge3Amount.Text);

            ASPxTextBox tbxOtherCharge4 = pageControl.FindControl("tbxOtherCharge4") as ASPxTextBox;
            airRef.OtherCharge4 = tbxOtherCharge4.Text;
            ASPxTextBox tbxOtherCharge4Currency = pageControl.FindControl("tbxOtherCharge4Currency") as ASPxTextBox;
            airRef.OtherCharge4Currency = tbxOtherCharge4Currency.Text;
            ASPxSpinEdit tbxOtherCharge4Amount = pageControl.FindControl("tbxOtherCharge4Amount") as ASPxSpinEdit;
            airRef.OtherCharge4Amount = SafeValue.SafeDecimal(tbxOtherCharge4Amount.Text);

            ASPxTextBox tbxOtherCharge5 = pageControl.FindControl("tbxOtherCharge5") as ASPxTextBox;
            airRef.OtherCharge5 = tbxOtherCharge5.Text;
            ASPxTextBox tbxOtherCharge5Currency = pageControl.FindControl("tbxOtherCharge5Currency") as ASPxTextBox;
            airRef.OtherCharge5Currency = tbxOtherCharge5Currency.Text;
            ASPxSpinEdit tbxOtherCharge5Amount = pageControl.FindControl("tbxOtherCharge5Amount") as ASPxSpinEdit;
            airRef.OtherCharge5Amount = SafeValue.SafeDecimal(tbxOtherCharge5Amount.Text);

            ASPxTextBox tbxSignatureShipper = pageControl.FindControl("tbxSignatureShipper") as ASPxTextBox;
            airRef.SignatureShipper = tbxSignatureShipper.Text;
            ASPxTextBox tbxExecuteDate = pageControl.FindControl("tbxExecuteDate") as ASPxTextBox;
            airRef.ExecuteDate = tbxExecuteDate.Text;
            ASPxTextBox tbxExecutePlace = pageControl.FindControl("tbxExecutePlace") as ASPxTextBox;
            airRef.ExecutePlace = tbxExecutePlace.Text;
            ASPxTextBox tbxSignatureIssuing = pageControl.FindControl("tbxSignatureIssuing") as ASPxTextBox;
            airRef.SignatureIssuing = tbxSignatureIssuing.Text;

            if (isNew)
            {
                airRef.CloseInd       = "N";
                airRef.CreateBy       = userId;
                airRef.CreateDateTime = DateTime.Now;
                airRef.RefNo          = refNo.ToString();
                airRef.RefType        = "AI";
                airRef.UpdateBy       = userId;
                airRef.UpdateDateTime = DateTime.Now;
                airRef.StatusCode     = "USE";
                Manager.ORManager.StartTracking(airRef, Wilson.ORMapper.InitialState.Inserted);
                Manager.ORManager.PersistChanges(airRef);
                C2Setup.SetNextNo(airRef.RefType, "AirImport", refNo, airRef.RefDate);
            }
            else
            {
                airRef.UpdateBy       = userId;
                airRef.UpdateDateTime = DateTime.Now;
                Manager.ORManager.StartTracking(airRef, Wilson.ORMapper.InitialState.Updated);
                Manager.ORManager.PersistChanges(airRef);
            }
            Session["AirImpMastWhere"]        = "RefNo='" + refNo + "'";
            this.dsImportRef.FilterExpression = Session["AirImpMastWhere"].ToString();
            if (this.grid_ref.GetRow(0) != null)
            {
                this.grid_ref.StartEdit(0);
            }
        }
        catch { }
    }