public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.VisitTiming_VisionRefractionReading.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 2
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.VisitTiming_TreatmentPlan.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 3
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.ServiceCategory_Surcharge_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.Medication_Dose_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.CashBoxInOutTransactions.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 6
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.Service_StationPoint_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 7
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.UncorrectedDistanceVisualAcuity_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.VisitTiming_SurgeryReservation.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 9
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.UnitMeasurment_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 10
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.PatientDepositeBalances.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 11
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.RawMaterials_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.InPatientRoomClassification_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 13
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.FinanceInvoiceDetails.FirstOrDefault(item => item.FinanceInvoiceID.Equals(id)));
 }
Esempio n. 14
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.OrganizationMachine_CashBox_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.VisitTiming_MainAdnexaSegmentSign.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 16
0
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.PEM_ElementPrintOrder_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.Doctor_DiagnosisCategory_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.InsuranceCarrier_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.InPatientRoomBed_InPatientAdmissionPricingType_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.Employee_cu.FirstOrDefault(item => item.Person_CU_ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.InventoryItem_Printing_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.AccountingJournalEntryTransactions.FirstOrDefault(item => item.ID.Equals(id)));
 }
 public IDBCommon GetSpecificEntity(MerkFinanceEntities context, int id)
 {
     return(context.GeneralChartOfAccountType_cu.FirstOrDefault(item => item.ID.Equals(id)));
 }
Esempio n. 24
0
        public void objContext_SavingChanges(object sender, EventArgs e)
        {
            MerkFinanceEntities merkContext = this;

            LogAuditing log = new LogAuditing();

            using (TransactionScope scope = new TransactionScope())
            {
                StringBuilder currentvalues                  = new StringBuilder();
                StringBuilder originalvalues                 = new StringBuilder();
                IEnumerable <DbEntityEntry> addEntries       = GetDbEntityEntries(merkContext, EntityState.Added);
                IEnumerable <DbEntityEntry> unchangedEntries = GetDbEntityEntries(merkContext, EntityState.Unchanged);
                IEnumerable <DbEntityEntry> updatedEntries   = GetDbEntityEntries(merkContext, EntityState.Modified);

                #region New Items

                foreach (DbEntityEntry entry in addEntries)
                {
                    log = new LogAuditing();
                    log.CommonTransactionType_P_ID = (int)DB_CommonTransactionType.SaveNew;
                    log.Date = DateTime.Now;
                    string[] entityNameArray = entry.Entity.ToString().Split('.');
                    log.EntityName = entityNameArray[1];
                    //TODO :: Should get the user from the context

                    int index = 0;
                    foreach (var propertyName in entry.CurrentValues.PropertyNames)
                    {
                        currentvalues.Append("(");
                        currentvalues.Append(entry.Member(propertyName).Name);
                        currentvalues.Append("=");
                        if (entry.Member(propertyName).CurrentValue != null)
                        {
                            Type type = entry.Member(propertyName).CurrentValue.GetType();
                            currentvalues.Append(entry.Member(propertyName).CurrentValue);
                        }
                        else
                        {
                            currentvalues.Append("null");
                        }

                        if (propertyName == "InsertedBy")
                        {
                            log.User_CU_ID = Convert.ToInt32(entry.Member(propertyName).CurrentValue);
                        }

                        currentvalues.Append(")");
                        index++;

                        if (index == entry.CurrentValues.PropertyNames.Count())
                        {
                            break;
                        }

                        currentvalues.Append(", ");
                    }

                    log.CurrentValues = currentvalues.ToString();

                    //MerkAuditingEntities.DBAuditingEntities.LogAuditings.Add(log);
                    //MerkAuditingEntities.DBAuditingEntities.SaveChanges();
                }

                #endregion

                #region Updated Items

                foreach (DbEntityEntry entry in updatedEntries)
                {
                    log.CommonTransactionType_P_ID = (int)DB_CommonTransactionType.UpdateExisting;
                    log.Date = DateTime.Now;
                    string[] entityNameArray = entry.Entity.ToString().Split('.');
                    log.EntityName = entityNameArray[1];
                    //TODO :: Should get the user from the context
                    //log
                    int index = 0;
                    foreach (var propertyName in entry.OriginalValues.PropertyNames)
                    {
                        originalvalues.Append("(");
                        originalvalues.Append(entry.Member(propertyName).Name);
                        originalvalues.Append("=");
                        if (entry.Member(propertyName).CurrentValue != null)
                        {
                            originalvalues.Append(entry.Member(propertyName).CurrentValue);
                        }
                        else
                        {
                            originalvalues.Append("null");
                        }
                        originalvalues.Append(")");
                        index++;

                        if (index == entry.OriginalValues.PropertyNames.Count())
                        {
                            break;
                        }

                        originalvalues.Append(", ");
                        log.OriginalValues = originalvalues.ToString();
                    }

                    foreach (var propertyName in entry.CurrentValues.PropertyNames)
                    {
                        currentvalues.Append("(");
                        currentvalues.Append(entry.Member(propertyName).Name);
                        currentvalues.Append("=");
                        if (entry.Member(propertyName).CurrentValue != null)
                        {
                            currentvalues.Append(entry.Member(propertyName).CurrentValue);
                        }
                        else
                        {
                            currentvalues.Append("null");
                        }
                        currentvalues.Append(")");
                        index++;

                        if (index == entry.CurrentValues.PropertyNames.Count())
                        {
                            break;
                        }

                        currentvalues.Append(", ");
                    }

                    log.CurrentValues = currentvalues.ToString();

                    //MerkAuditingEntities.DBAuditingEntities.LogAuditings.Add(log);
                    //MerkAuditingEntities.DBAuditingEntities.SaveChanges();
                }

                #endregion

                scope.Complete();
            }
        }