Exemplo n.º 1
0
        private void frmImplementation_Load(object sender, EventArgs e)
        {
            radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Numeric;



            cboDataMIgrationLead.DisplayMember = "Description";
            cboDataMIgrationLead.ValueMember   = "Code";
            cboDataMIgrationLead.DataSource    = _db.GetStandardLookupByGroup(Costants.DataMigrationList);



            if (this.IsEdit)
            {
                Implentat _newImp = new Implentat();

                _newImp           = _db.GetImplentationById(RecordId, databaseId);
                txtFee.Text       = _newImp.ImplentationFee.ToString();
                chkIsLive.Checked = _newImp.Live ?? false;
                chkIsPaid.Checked = _newImp.Paid ?? false;
                txtOldEhr.Text    = _newImp.OldEhr.ToString();

                cboDataMIgrationLead.SelectedValue = _newImp.DataMigrationLead ?? 0;

                txtProjectManager.Text = _newImp.ProjectManager;
            }
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Implentat _imp = new Implentat();

            if (this.IsEdit)
            {
                _imp = _db.GetImplentationById(RecordId, databaseId);
            }

            _imp.customerId = this.CustomerId;

            _imp.ImplentationFee = Convert.ToDecimal(txtFee.Text);

            //   _imp.DataMigrationLead = (int)cboDataMIgrationLead.SelectedValue;
            _imp.ProjectManager = txtProjectManager.Text;
            _imp.Paid           = chkIsPaid.Checked;
            _imp.Live           = chkIsLive.Checked;
            _imp.databaseID     = databaseId;
            _imp.OldEhr         = Int32.Parse(txtOldEhr.Text);

            if (this.IsEdit)
            {
                _db.SaveImplmentation(_imp);
                _db.SaveChanges();
                MessageBox.Show("Implentation Saved", "Implentation has been updated ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                _db.AddToImplemtnation(_imp);
                _db.SaveChanges();
                MessageBox.Show("Implentation Saved", "Implentation has been Created ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            this.Close();
        }
 public void SaveImplmentation(Implentat _newImp)
 {
     try
     {
         using (var ctx = new customerDbEntities())
         {
             ctx.Implentats.Add(_newImp);
             ctx.Entry(_newImp).State = System.Data.Entity.EntityState.Modified;
             ctx.SaveChanges();
         }
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                               eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                   ve.PropertyName, ve.ErrorMessage);
             }
         }
         throw;
     }
 }
 public Implentat GetImplentationById(int Id, int databaseId)
 {
     using (var myContext = new customerDbEntities())
     {
         Implentat q = myContext.Implentats.Where(w => w.id == Id && w.databaseID == databaseId).FirstOrDefault();
         return(q);
     }
 }
        private void btnDeleteImplentation_Click(object sender, EventArgs e)
        {
            Implentat _deleteImplentat = new Implentat();

            _deleteImplentat = CustomerDb.GetImplentationById(ImplentationiD, DatabaseId);
            DialogResult dialogResult = MessageBox.Show(this, "Are you sure you wish to Delete Implentation ", "Delete Implentation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (dialogResult == DialogResult.Yes)
            {
                CustomerDb.DeleteImplmentation(_deleteImplentat);
                BindImplentationsForCustomer(CustomerId);
            }
            else if (dialogResult == DialogResult.No)
            {
                //do something else
            }
            BindImplentationsForCustomer(CustomerId);
        }
 public void AddToImplemtnation(Implentat newImp)
 {
     using (var myContext = new customerDbEntities())
     {
         myContext.Implentats.Add(newImp);
         try
         {
             myContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             foreach (var entityValidationErrors in ex.EntityValidationErrors)
             {
                 foreach (var validationError in entityValidationErrors.ValidationErrors)
                 {
                     Console.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
                 }
             }
         }
     }
 }
 public void DeleteImplmentation(Implentat deleteImplentation)
 {
     using (var myContext = new customerDbEntities())
     {
         myContext.Implentats.Attach(deleteImplentation);
         myContext.Implentats.Remove(deleteImplentation);
         try
         {
             myContext.SaveChanges();
         }
         catch (DbEntityValidationException ex)
         {
             foreach (var entityValidationErrors in ex.EntityValidationErrors)
             {
                 foreach (var validationError in entityValidationErrors.ValidationErrors)
                 {
                     Console.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
                 }
             }
         }
     }
 }