private void SaveTruckType()
 {
     try
     {
         if (truckTypeId == 0)
         {
             var truckType = new TruckType
             {
                 TruckTypeId   = truckTypeId,
                 TruckTypeDesc = txtTruckTypeName.Text.Trim(),
                 Active        = chkActive.Checked,
                 CreateBy      = "system",
             };
             TruckTypeController.Insert(truckType);
         }
         else
         {
             var truckType = new TruckType
             {
                 TruckTypeId   = this.truckTypeId,
                 TruckTypeDesc = txtTruckTypeName.Text.Trim(),
                 Active        = chkActive.Checked,
                 ModifiedBy    = "system",
             };
             truckType.TruckTypeId = Convert.ToInt32(txtTruckTypeId.Text);
             TruckTypeController.Update(truckType);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
        private void LoadTruckType()
        {
            //var farmCtrl = new FarmController();
            var coll = TruckTypeController.GetAllTruckType(TxtFilter.Text);

            gv.DataSource = coll;
            //LoadItem("");
        }
 private void LoadData()
 {
     try
     {
         if (this.truckTypeId > 0)
         {
             TruckType truckType = TruckTypeController.GetTruckType(this.truckTypeId);
             txtTruckTypeId.Text   = this.truckTypeId.ToString();;
             txtTruckTypeName.Text = truckType.TruckTypeDesc;
             chkActive.Checked     = truckType.Active;
             BtnSaveAndNew.Visible = false;
             //txtTruckNo.Enabled = false;
         }
     }
     catch (Exception)
     {
     }
 }
 private void LoadTruckType()
 {
     comboxTruckType.DataSource    = TruckTypeController.GetAllTruckType();
     comboxTruckType.ValueMember   = "TruckTypeId";
     comboxTruckType.DisplayMember = "TruckTypeDesc";
 }