Ejemplo n.º 1
0
        protected void RateFinder1_RateChosen(object sender, RateFinder.RateChosenEventArgs e)
        {
            txtRates.Text = e.RateValue;
            c = ContainerObject;

            object[] o = { c };
            //Control qe = Functions.Tools.FindConrolRecursive(this.Page.Controls[0], "QuoteEntry1");
            Functions.Tools.ExecutePageMethod("ContainerInfo_Saving", o, this.Page);
        }
Ejemplo n.º 2
0
        //public void bindcontrols()
        //{
        //    if (c != null)
        //    {
        //        //txtContainerNo.Text = c.ContainerNumber;
        //        //txtContainerType.Text = c.ContainerType;
        //        //txtSeal1.Text = c.Seal1;
        //        //txtSeal2.Text = c.Seal2;
        //        //txtSeal3.Text = c.Seal3;
        //        //txtTareWeight.Text = c.TareWeight;
        //        //txtDischargeDate.Text=c.DischargeDate.ToShortDateString();
        //        //txtPickupDate.Text = c.PickupDate.ToShortDateString();
        //        //txtReturnDate.Text = c.ReturnDate.ToShortDateString();
        //        //txtCarrierPickup.Text = c.CarrierPickUpLastDate.ToShortDateString();
        //        //txtCustReturnLastFree.Text = c.CustomerReturnLastDate.ToShortDateString();
        //        //txtCustPickupLastFree.Text = c.CustomerPickupLastDate.ToShortDateString();
        //        //txtCarrierReturn.Text = c.CarrierReturnLastDate.ToShortDateString();
        //        //grCargo.DataSource = c.Cargo;
        //        //grCargo.DataBind();
        //    }
        //}
        private void getContainerFromControls()
        {
            //Because of an error with viewstate. This will always be the original container before any edits deletes or inserts.
            //Viewstate is not holding updates. Only the first entry.
            if (c==null&&ViewState["Container"] != null) { c = (BusinessObjects.Container)ViewState["Container"]; }
            if (c==null){c = new BusinessObjects.Container();}

            c.ContainerNumber = txtContainerNo.Text;
            c.ContainerType = txtContainerType.Text;
            c.Seal1 = txtSeal1.Text;
            c.Seal2 = txtSeal2.Text;
            c.Seal3 = txtSeal3.Text;
            c.TareWeight = txtTareWeight.Text;
            DateTime dt = DateTime.MinValue;
            c.DischargeDate = DateTime.TryParse(txtDischargeDate.Text, out dt) ? dt : dt;
            c.PickupDate = DateTime.TryParse(txtPickupDate.Text, out dt) ? dt : dt;
            c.ReturnDate = DateTime.TryParse(txtReturnDate.Text, out dt) ? dt : dt;
            c.CarrierPickUpLastDate = DateTime.TryParse(txtCarrierPickup.Text, out dt) ? dt : dt;
            c.CustomerReturnLastDate = DateTime.TryParse(txtCustReturnLastFree.Text, out dt) ? dt : dt;
            c.CustomerPickupLastDate = DateTime.TryParse(txtCustPickupLastFree.Text, out dt) ? dt : dt;
            c.CarrierReturnLastDate = DateTime.TryParse(txtCarrierReturn.Text, out dt) ? dt : dt;
            c.Rate = txtRates.Text;

            if (grCargo.DataSource != null)
            {
                foreach (Obout.Grid.GridRow gr in grCargo.Rows)
                {
                    bool inst = false;
                    System.Collections.Hashtable row = gr.ToHashtable();
                    if (row.Count > 0)
                    {
                        BusinessObjects.ContainerCargo crg = (from cr in c.Cargo where cr.ID == int.Parse(row["ID"].ToString()) select cr).FirstOrDefault();
                        if (crg == null) { crg = new BusinessObjects.ContainerCargo(); inst = true; }
                        int i; double d; bool b;
                        i = 0; int.TryParse(row["ID"].ToString(), out i);
                        crg.ID = i;
                        crg.NetWeight = double.TryParse(row["NetWeight"].ToString(), out d) ? d : 0;
                        //i = 1; int.TryParse(row["NetWeightUnit"].ToString(), out i);
                        crg.NetWeightUnit = (BusinessObjects.Units.WeightUnits)i;
                        i = 0; int.TryParse(row["Pieces"].ToString(), out i);
                        crg.Pieces = i;
                        crg.UOM = row["UOM"].ToString();
                        crg.Description = row["Description"].ToString();
                        d = 0; double.TryParse(row["GrossWeight"].ToString(), out d);
                        crg.GrossWeight = d;
                        //i = 1; int.TryParse(row["GrossWeightUnit"].ToString(), out i);
                        crg.GrossWeightUnit = (BusinessObjects.Units.WeightUnits)i;
                        crg.Hazardous = bool.TryParse(row["Hazardous"].ToString(), out b) ? b : false;
                        if (inst) { c.Cargo.Add(crg); }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static List<BusinessObjects.Container> GetContainers(string QuoteNumber)
        {
            if (QuoteNumber==null || QuoteNumber == string.Empty) { QuoteNumber = "0"; }
            DataTable dt = new DataTable();
            string sql = string.Format( @"SELECT * FROM Containers where QuoteNumber={0}",QuoteNumber);
            OdbcDataAdapter adp = new OdbcDataAdapter(sql, Properties.Settings.Default.IESDBConn);

            adp.Fill(dt);

            List<BusinessObjects.Container> lc = new List<BusinessObjects.Container>();
            foreach (DataRow row in dt.Rows)
            {
                BusinessObjects.Container c = new BusinessObjects.Container();
                c.ID = int.Parse(row["ID"].ToString());
                c.ContainerNumber = row["ContainerNumer"].ToString();
                c.ContainerType = row["ContainerType"].ToString();
                c.Seal1 = row["Seal1"].ToString();
                c.Seal2 = row["Seal2"].ToString();
                c.Seal3 = row["Seal3"].ToString();
                c.TareWeight = row["TareWeight"].ToString();
                int i = 1; int.TryParse(row["TareWeightUnit"].ToString(), out i);
                c.TareWeightUnit =(BusinessObjects.Units.WeightUnits)i ;
                DateTime d=DateTime.MinValue;
                c.DischargeDate=  DateTime.TryParse(row["DischargeDate"].ToString(),out d)?d:d;
                c.PickupDate= DateTime.TryParse(row["PickupDate"].ToString(),out d)?d:d;
                c.ReturnDate= DateTime.TryParse(row["ReturnDate"].ToString(),out d)?d:d;
                c.CustomerPickupLastDate= DateTime.TryParse(row["CustomerPickupDate"].ToString(),out d)?d:d;
                c.CustomerReturnLastDate= DateTime.TryParse(row["CustomerReturnDate"].ToString(),out d)?d:d;
                c.CarrierPickUpLastDate= DateTime.TryParse(row["CarrierPickupDate"].ToString(),out d)?d:d;
                c.CarrierReturnLastDate = DateTime.TryParse(row["CarrierReturnDate"].ToString(), out d) ? d : d;
                c.Cargo = GetCargo(c.ID);
                lc.Add(c);
            }
            return lc;
        }