public static void DeleteObjectOfTransactionFromDb(ObjectOfTransaction objectOfTransaction)
 {
     using (var db = new DB_Context())
     {
         db.ObjectOfTransactions.Remove(db.ObjectOfTransactions.Find(objectOfTransaction.ObjectOfTransactionID));
         db.SaveChanges();
     }
 }
 public static void AddObjectOfTransactionToDb(ObjectOfTransaction objectOfTransaction)
 {
     using (var db = new DB_Context())
     {
         db.ObjectOfTransactions.Add(objectOfTransaction);
         db.SaveChanges();
     }
 }
        public static ViewObjOfTransact ConvertObjOfTransact(ObjectOfTransaction obj)
        {
            return new ViewObjOfTransact
            {
                ObjectOfTransactionID = obj.ObjectOfTransactionID,
                UserID = obj.UserID,
                UserInfo = DataManager.GetuUserFromDbById(obj.UserID).ToString(),

                ObjectType = (EnumObjectType)obj.ObjectTypeID,
                ObjectState = (EnumObjectState)obj.ObjectStateID,
                ServiceType = (EnumServiceType)obj.ServiceTypeID,
                KindOfCalculating = (EnumKindOfCalculating)obj.KindOfCalculatingID,

                Cost = obj.Cost,
                Description = obj.Description
            };
        }
        public static void UpdateObjectOfTransactionFromDb(ObjectOfTransaction objectOfTransaction)
        {
            using (var db = new DB_Context())
            {
                var obj = db.ObjectOfTransactions.Find(objectOfTransaction.ObjectOfTransactionID);
                obj.ObjectTypeID = objectOfTransaction.ObjectTypeID;
                obj.ServiceTypeID = objectOfTransaction.ServiceTypeID;
                obj.KindOfCalculatingID = objectOfTransaction.KindOfCalculatingID;
                obj.UserID = objectOfTransaction.UserID;
                obj.ObjectStateID = objectOfTransaction.ObjectStateID;
                obj.Cost = objectOfTransaction.Cost;
                obj.Description = objectOfTransaction.Description;

                db.SaveChanges();
            }
        }