Ejemplo n.º 1
0
        /// <summary>
        /// Get a disconnected object from cache if caching has been required, from db otherwise.
        /// </summary>
        /// <param name="oType">Operation Type (GetDataAdapter or GetScalar).</param>
        /// <returns>Return a disconnected object.</returns>
        private object manageCaching(operationType oType)
        {
            string key            = String.Empty;
            object returnedObject = null;

            coreSettings();

            //Is caching required?
            if (m_cacheDisconnectData == true)
            {
                //Get unique identifier.
                key = getKey(oType);

                //Get object from cache.
                returnedObject = System.Web.HttpRuntime.Cache.Get(key);

                //Is object found ?
                if (returnedObject == null)
                {
                    //Create and cache a new disconnected object.
                    returnedObject = getDisconnectObject(oType);
                    System.Web.HttpRuntime.Cache.Insert(key, returnedObject, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(1800));
                }
            }
            else
            {
                returnedObject = getDisconnectObject(oType);
            }

            return(returnedObject);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get a disconnected object.
        /// </summary>
        /// <param name="oType">Operation Type (GetDataAdapter or GetScalar).</param>
        /// <returns>Return a disconnected object.</returns>
        private object getDisconnectObject(operationType oType)
        {
            object returnedObject = null;

            try
            {
                if (m_cmd.Connection.State != ConnectionState.Open)
                {
                    m_cmd.Connection.Open();
                }

                switch (oType)
                {
                case operationType.GetScalar:                         // Return a new Scalar object.
                    returnedObject = m_cmd.ExecuteScalar();
                    break;

                case operationType.GetResultSet:                         // Return a new ResultSet.
                    returnedObject = new DataSet();
                    m_dal.CreateDataAdapter(m_cmd).Fill((DataSet)returnedObject);
                    break;
                }
            }
            finally
            {
                if (m_cmd.Connection != null && m_cmd.Connection.State == ConnectionState.Open)
                {
                    m_cmd.Connection.Close();
                }
            }

            return(returnedObject);
        }
Ejemplo n.º 3
0
 public InputBox(Catalog currentCatalog, String name, String type, operationType otype)
 {
     InitializeComponent();
     current_catalog = currentCatalog;
     textBox1.Text   = name;
     file_name       = name;
     fileType        = type;
     operation_type  = otype;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructeur.
 /// </summary>
 public Due(string Name, operationType OperationType, int Day, paymentType PaymentType, float Amount, Category category)
 {
     this.Id            = Guid.NewGuid().ToString();
     this.Name          = Name;
     this.OperationType = OperationType;
     this.Day           = Day;
     this.PaymentType   = PaymentType;
     this.Amount        = Amount;
     this.category      = category;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructeur.
 /// </summary>
 public Operation(string Name, operationType OperationType, DateTime Date, paymentType PaymentType, float Amount, Category category)
 {
     this.Id            = Guid.NewGuid().ToString();
     this.Name          = Name;
     this.OperationType = OperationType;
     this.Date          = Date;
     this.PaymentType   = PaymentType;
     this.Amount        = Amount;
     this.category      = category;
 }
Ejemplo n.º 6
0
        private ServiceOperation BuildServiceOperation(string p1, string p2, operationType type = operationType.Inspect)
        {
            var so = new ServiceOperation() { OperationName = p1, ServiceNotes = p2 };

            foreach (var si in ServiceIntervals)
            {
                so.ServiceOperations.Add(new ServiceIntervalOperation() { OperationType = type, ServiceInterval = si });
            }
            return so;
        }
Ejemplo n.º 7
0
 public void Settype(String value)
 {
     if (value == "income" || value == "Debit")
     {
         type = operationType.Debit;
     }
     else
     {
         type = operationType.Credit;
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Permet d'éditer une nouvelle opération.
        /// </summary>
        /// <param name="operation">Opération concernée.</param>
        /// <param name="Name">Nom de l'opération.</param>
        /// <param name="Amount">Montant de l'opération.</param>
        /// <param name="PaymentType">Type de paiement.</param>
        /// <param name="OperationType">Type d'opération.</param>
        /// <param name="Date">Date de l'opération.</param>
        /// <param name="category">Catégorie de l'opération.</param>
        public static void EditOperation(Model.Operation operation, string Name, float Amount, paymentType PaymentType,
                                         operationType OperationType, DateTime Date, Category category)
        {
            operation.Name          = Name;
            operation.Amount        = Amount;
            operation.PaymentType   = PaymentType;
            operation.OperationType = OperationType;
            operation.Date          = Date;
            operation.category      = category;

            Program.ctx.Save();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Permet d'éditer une échéance.
        /// </summary>
        /// <param name="due">Echéance à éditer.</param>
        /// <param name="Name">Nom de l'échéance.</param>
        /// <param name="Amount">Montant de l'échéance.</param>
        /// <param name="PaymentType">Type de paiement.</param>
        /// <param name="OperationType">Type d'opération.</param>
        /// <param name="Day">Jours de récurrence.</param>
        /// <param name="category">Catégorie.</param>
        public static void EditDue(Model.Due due, string Name, float Amount, paymentType PaymentType,
                                   operationType OperationType, int Day, Category category)
        {
            due.Name          = Name;
            due.Amount        = Amount;
            due.PaymentType   = PaymentType;
            due.OperationType = OperationType;
            due.Day           = Day;
            due.category      = category;

            Program.ctx.Save();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Create a unique identifier.
        /// </summary>
        /// <param name="oType">Operation Type (GetDataAdapter or GetScalar).</param>
        /// <returns>Return a unique identifier.</returns>
        private string getKey(operationType oType)
        {
            StringBuilder key = new StringBuilder(100);

            // Add stored procedure name to key.
            key.Append(m_name);

            foreach (DictionaryEntry parameter in m_parameters)
            {
                // Add parameter name - value to key.
                key.Append(parameter.Key.ToString());
            }


            // Add operation type to key.
            key.Append(oType.ToString());

            return(key.ToString());
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Permet d'ajouter une nouvelle opération.
 /// </summary>
 /// <param name="Account">Compte concerné par l'operation.</param>
 /// <param name="Name">Nom de l'opération.</param>
 /// <param name="opT">Type d'opération.</param>
 /// <param name="date">Date de l'opération.</param>
 /// <param name="paT">Type de paiement.</param>
 /// <param name="Amount">Montant de l'opération.</param>
 /// <param name="cat">Catégorie de l'opération.</param>
 public static void AddOperation(Model.Account Account, string Name, operationType opT, DateTime date, paymentType paT, float Amount, Category cat)
 {
     Account.Operations.Add(new Operation(Name, opT, date, paT, Amount, cat));
     Program.ctx.Save();
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Permet d'ajouter une nouvelle échéance.
 /// </summary>
 /// <param name="Account">Compte bancaire sur laquelle l'échéance est active.</param>
 /// <param name="Name">Nom de l'échéance.</param>
 /// <param name="opT">Type d'opération.</param>
 /// <param name="Day">Jours de récurrence.</param>
 /// <param name="pyT">Type de paiement.</param>
 /// <param name="Amount">Montant de l'échéance.</param>
 /// <param name="category">Catégorie</param>
 public static void AddDue(Model.Account Account, string Name, operationType opT, int Day, paymentType pyT, float Amount, Category category)
 {
     Account.Dues.Add(new Due(Name, opT, Day, pyT, Amount, category));
     Program.ctx.Save();
 }
Ejemplo n.º 13
0
 public void Settype(operationType value)
 {
     type = value;
 }
Ejemplo n.º 14
0
 !(Get(operationType, operandTypes) is null);
Ejemplo n.º 15
0
        public static Prices GetFilePrice(operationType type, string fileName, bool colori)
        {
            decimal totale = 0;

            ComponentInfo.SetLicense("ADWG-YKI0-D7LE-5JK9");
            var document = PdfDocument.Load(fileName);

            if (document.Pages.Count == 1)
            {
                if (type == operationType.LOL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(2.49);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(2.32);
                    }
                }

                if (type == operationType.ROL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(4.00);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(3.70);
                    }
                }
            }

            if (document.Pages.Count == 2)
            {
                if (type == operationType.LOL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(2.60);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(2.40);
                    }
                }

                if (type == operationType.ROL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(4.15);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(3.80);
                    }
                }
            }

            if (document.Pages.Count == 3)
            {
                if (type == operationType.LOL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(2.69);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(2.46);
                    }
                }

                if (type == operationType.ROL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(4.30);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(3.90);
                    }
                }
            }

            if (document.Pages.Count == 4 || document.Pages.Count == 5)
            {
                if (type == operationType.LOL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(2.81);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(2.55);
                    }
                }

                if (type == operationType.ROL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(5.35);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(5.05);
                    }
                }
            }

            if (document.Pages.Count == 6 || document.Pages.Count == 7 || document.Pages.Count == 8 || document.Pages.Count == 9)
            {
                if (type == operationType.LOL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(3.03);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(2.67);
                    }
                }

                if (type == operationType.ROL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(5.70);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(5.10);
                    }
                }
            }

            if (document.Pages.Count == 10 || document.Pages.Count == 11 || document.Pages.Count == 12 || document.Pages.Count == 13)
            {
                if (type == operationType.LOL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(3.33);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(2.85);
                    }
                }

                if (type == operationType.ROL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(5.85);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(5.15);
                    }
                }
            }

            if (document.Pages.Count > 13)
            {
                if (type == operationType.LOL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(3.78);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(3.15);
                    }
                }

                if (type == operationType.ROL)
                {
                    if (colori)
                    {
                        totale = Convert.ToDecimal(6.00);
                    }
                    else
                    {
                        totale = Convert.ToDecimal(5.20);
                    }
                }
            }

            document.Close();

            var p = new Prices();

            if (type == operationType.LOL)
            {
                decimal vat = GetVat(totale);
                p.vatPrice   = vat;
                p.totalPrice = Convert.ToDecimal(totale);
                p.price      = Convert.ToDecimal(totale) - vat;
            }
            ;
            if (type == operationType.ROL)
            {
                p.vatPrice   = 0;
                p.totalPrice = Convert.ToDecimal(totale);
                p.price      = Convert.ToDecimal(totale);
            }

            return(p);
        }