Пример #1
0
 private void FillData()
 {
     try
     {
         RigModel model = repo.GetRig(RigId);
         txtCode.Text = model.RigCode;
         if (model.RigDeployed != null)
         {
             txtDateOfDeploy.DateTime = model.RigDeployed ?? DateTime.Now;
         }
         txtManufacturer.Text = model.RigManufacturer;
         txtModelNo.Text      = model.RigModelNo;
         txtName.Text         = model.RigName;
         txtProject.Text      = model.RigProject;
         txtRemarks.Text      = model.RigRemarks;
         //lstLocation.EditValue = model.LocId;
         lstRigType.EditValue = model.RigTypeId;
         txtLocation.Text     = model.RigLocation;
         txtRigType.Text      = model.RigTypeName;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.InnerException != null ? ex.InnerException.Message : ex.Message);
     }
 }
Пример #2
0
 private void Update()
 {
     try
     {
         RigModel model = new RigModel();
         //model.LocId = Convert.ToInt32(lstLocation.Properties.GetKeyValueByDisplayValue(lstLocation.Text));
         model.RigCode         = txtCode.Text;
         model.RigId           = RigId;
         model.RigManufacturer = txtManufacturer.Text;
         model.RigModelNo      = txtModelNo.Text;
         model.RigName         = txtName.Text;
         model.RigProject      = txtProject.Text;
         model.RigRemarks      = txtRemarks.Text;
         model.RigTypeId       = Convert.ToInt32(lstRigType.Properties.GetKeyValueByDisplayValue(lstRigType.Text));
         model.RigDeployed     = txtDateOfDeploy.DateTime;
         model.RigLocation     = txtLocation.Text;
         model.RigTypeName     = txtRigType.Text;
         model = repo.Update(model);
         if (model.RigId > 0)
         {
             MessageBox.Show("Successfully updated");
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.InnerException != null ? ex.InnerException.Message : ex.Message);
     }
 }