Esempio n. 1
0
        private void FillWellOperationDetails()
        {
            try
            {
                WellOperationsModel model = repo.GetOperationEditDetails(WellOpId);
                if (model != null)
                {
                    fillOperation = false;
                    WellId        = model.WellId;
                    lstOperationCategory.EditValue = model.OperationsId;
                    txtStartDatetime.DateTime      = model.StartTime;
                    if (model.EndTime != null)
                    {
                        txtEndDateTime.DateTime = model.EndTime ?? DateTime.Now;
                    }
                    lstCurrentSection.EditValue = model.SecId;
                    txtCurrentDepth.Text        = model.CurrentDepth.ToString();
                    txtRemarks.Text             = model.Remarks;

                    DataSet ds = repo.GetOperationsType(model.OperationsId);
                    lstOperation.Properties.DataSource    = ds.Tables[0];
                    lstOperation.Properties.DisplayMember = "OprName";
                    lstOperation.Properties.ValueMember   = "OprId";
                    lstOperation.Properties.NullText      = "";
                    lstOperation.Properties.PopulateColumns();
                    lstOperation.Properties.Columns["OprId"].Visible = false;
                    lstOperation.Properties.ShowHeader = false;
                    lstOperation.EditValue             = model.OprId;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.InnerException == null ? ex.Message : ex.InnerException.Message);
            }
        }
Esempio n. 2
0
        private void Update()
        {
            try
            {
                WellOperationsModel model = new WellOperationsModel();
                model.CreatedDateTime = DateTime.Now;
                model.CurrentDepth    = Convert.ToDecimal(txtCurrentDepth.Text);
                model.OprId           = Convert.ToInt32(lstOperation.Properties.GetKeyValueByDisplayValue(lstOperation.Text));
                model.OperationsId    = Convert.ToInt32(lstOperationCategory.Properties.GetKeyValueByDisplayValue(lstOperationCategory.Text));
                model.Remarks         = txtRemarks.Text;
                model.SecId           = Convert.ToInt32(lstCurrentSection.Properties.GetKeyValueByDisplayValue(lstCurrentSection.Text));
                model.StartTime       = txtStartDatetime.DateTime;
                model.WellId          = WellId;
                model.WellOpId        = WellOpId;
                if (txtEndDateTime.Text != "")
                {
                    model.EndTime = txtEndDateTime.DateTime;
                }
                else
                {
                    model.EndTime = null;
                }

                model = repo.Update(model);
                if (model.WellOpId > 0)
                {
                    MessageBox.Show("Saved Successfully.");
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.InnerException == null ? ex.Message : ex.InnerException.Message);
            }
        }