Beispiel #1
0
        protected void FindTruckRegistration(string truckNo, bool isTrailer)
        {
            ((TruckInfo)SubscriberData).TruckTypeId      = Guid.Empty;
            ((TruckInfo)SubscriberData).TruckModelId     = Guid.Empty;
            ((TruckInfo)SubscriberData).TruckModelYearId = Guid.Empty;
            ((TruckInfo)SubscriberData).IsNew            = false;

            TruckRegisterBLL obj = null;

            if (truckNo.Trim() != string.Empty)
            {
                obj = new TruckRegisterBLL().GetTruckInfoByTruckNumber(truckNo, isTrailer);
            }
            if (obj != null)
            {
                TruckModelYearBLL objTMY = new TruckModelYearBLL();
                objTMY = objTMY.GetbyId(obj.TruckModelYearId);
                if (objTMY != null)
                {
                    ((TruckInfo)SubscriberData).TruckModelYearId = objTMY.Id;
                    TruckModelBLL objTM = new TruckModelBLL();
                    objTM = objTM.GetbyId(objTMY.TruckModelId);
                    if (objTM != null)
                    {
                        ((TruckInfo)SubscriberData).TruckModelId = objTM.Id;
                        TruckTypeBLL objTT = new TruckTypeBLL();
                        objTT = objTT.GetbyId(objTM.TruckTypeId);
                        if (objTT != null)
                        {
                            ((TruckInfo)SubscriberData).TruckTypeId = objTT.Id;
                        }
                    }
                }
            }
            else
            {
                ((TruckInfo)SubscriberData).IsNew = true;
            }
            foreach (Control subscriber in Subscribers)
            {
                if (subscriber == null)
                {
                    continue;
                }
                switch (subscriber.ID)
                {
                case "cddExtender_TruckTypeId":
                    ((CascadingDropDown)subscriber).SelectedValue = (((TruckInfo)SubscriberData).TruckTypeId.ToString());
                    break;

                case "cddExtender_TruckModelId":
                    ((CascadingDropDown)subscriber).SelectedValue = (((TruckInfo)SubscriberData).TruckModelId.ToString());
                    break;

                case "cddExtender_TruckModelYearId":
                    ((CascadingDropDown)subscriber).SelectedValue = (((TruckInfo)SubscriberData).TruckModelYearId.ToString());
                    break;
                }
            }
        }
Beispiel #2
0
        protected void txtTrailerPlateNo_TextChanged(object sender, EventArgs e)
        {
            ViewState["TrailerRegisterId"] = null;
            Nullable <Guid> TruckTypeId, TruckModelId;

            TruckTypeId  = null;
            TruckModelId = null;

            TruckRegisterBLL obj = new TruckRegisterBLL();

            obj = obj.GetTruckInfoByTruckNumber(this.txtTrailerPlateNo.Text, true);
            if (obj != null)
            {
                TruckModelYearBLL objTMY = new TruckModelYearBLL();
                objTMY = objTMY.GetbyId(obj.TruckModelYearId);
                if (objTMY != null)
                {
                    TruckModelBLL objTM = new TruckModelBLL();
                    objTM = objTM.GetbyId(objTMY.TruckModelId);
                    if (objTM != null)
                    {
                        TruckTypeBLL objTT = new TruckTypeBLL();
                        objTT        = objTT.GetbyId(objTM.TruckTypeId);
                        TruckModelId = objTM.Id;
                        if (objTT != null)
                        {
                            TruckTypeId = objTT.Id;
                        }
                    }
                }


                if (TruckTypeId != null)
                {
                    this.cboTruckType2_CascadingDropDown1.SelectedValue = TruckTypeId.ToString();
                }
                if (TruckModelId != null)
                {
                    this.cboTrailerModel_CascadingDropDown2.SelectedValue = TruckModelId.ToString();
                }
                if (obj.TruckModelYearId != null)
                {
                    this.cboTrailerModelYear_CascadingDropDown3.SelectedValue = obj.TruckModelYearId.ToString();
                }
                this.cboTruckModel.Enabled     = false;
                ViewState["TrailerRegisterId"] = obj.Id.ToString();
            }// Big if
        }