Ejemplo n.º 1
0
 private void FnClearAll()
 {
     objLib                 = new CommonLibClasses();
     m_ServiceInsurance     = new ServiceInsurance();
     m_ServiceInsuranceList = new List <ServiceInsurance>();
     txtInsuranceCode.Focus();
 }
Ejemplo n.º 2
0
 private void FrmServiceInsuranceView_atInitialise()
 {
     try
     {
         db = atContext.CreateContext();
         m_ServiceInsurance     = new ServiceInsurance();
         PrintButton.Visible    = false;
         MaximizeButton.Visible = false;
         MinimizeButton.Visible = false;
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
         atMessageBox.Show(MessageKeys.MsgExceptionOccuredWhileIntialising);
     }
 }
Ejemplo n.º 3
0
        private bool FrmServiceInsuranceView_atSaveClick(object source, SaveClickEventArgs e)
        {
            try
            {
                if (NewRecord)
                {
                    GetSeqNo();
                    m_ServiceInsurance = new ServiceInsurance();
                }

                m_ServiceInsurance.LocationID    = GlobalFunctions.LoginLocationID;
                m_ServiceInsurance.LoginUserID   = GlobalFunctions.LoginUserID;
                m_ServiceInsurance.InsuranceCode = txtInsuranceCode.Text.ToString();
                m_ServiceInsurance.InsuranceName = txtInsuranceName.Text.ToString();
                m_ServiceInsurance.Description   = txtDescription.Text.ToString();
                m_ServiceInsurance.CompanyName   = cmbCompany.Text.ToString();
                if (NewRecord)
                {
                    db.ServiceInsurances.AddObject(m_ServiceInsurance);
                }
                else
                {
                    db.ObjectStateManager.ChangeObjectState(m_ServiceInsurance, EntityState.Modified);
                }
                db.SaveChanges();
                return(true);
            }
            catch (UpdateException updEx)
            {
                db.DetachAllEntities();

                ExceptionManager.Publish(updEx);
                atMessageBox.Show(MessageKeys.MsgExceptionOccurredWhileSaving);

                return(false);
            }
            catch (Exception ex)
            {
                db.DetachAllEntities();
                ExceptionManager.Publish(ex);
                atMessageBox.Show(MessageKeys.MsgExceptionOccurredWhileSaving);
                return(false);
            }
        }
Ejemplo n.º 4
0
 public override void ReLoadData(int id)
 {
     try
     {
         db = atContext.CreateContext();
         m_ServiceInsurance = db.ServiceInsurances.Where(x => x.id == id).SingleOrDefault();
         if (m_ServiceInsurance != null)
         {
             txtInsuranceCode.Text = m_ServiceInsurance.InsuranceCode.ToString();
             txtInsuranceName.Text = m_ServiceInsurance.InsuranceName.ToString();
             txtDescription.Text   = m_ServiceInsurance.Description.ToString();
             cmbCompany.Text       = m_ServiceInsurance.CompanyName.ToString();
         }
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
         throw;
     }
 }
Ejemplo n.º 5
0
        private void FrmServiceInsuranceView_atNewClick(object source)
        {
            try
            {
                m_ServiceInsurance = new ServiceInsurance();
                db = atContext.CreateContext();
                txtInsuranceCode.Focus();

                FnClearAll();
                PopulateCombos();
                ShowToolTip();
                PopulateServiceInsurance();
                GetSeqNo();
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                atMessageBox.Show(ex, ENOperation.New);
                return;
            }
        }