public OperationPresenter(IMainView view)
 {
     // Inject dependencies from DI IoC Container
     this._view     = view;
     _model         = new Model.Operation();
     operationCache = new List <string>();
 }
Exemplo n.º 2
0
        private void dataOperationGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int[] indexes = new int[dataOperationGridView.ColumnCount];
            for (int i = 0; i < dataOperationGridView.ColumnCount; i++)
            {
                indexes[i] = i;
            }

            if (indexes.Contains(e.ColumnIndex) == true && e.RowIndex != -1)
            {
                if (dataOperationGridView.Rows[e.RowIndex].Cells["Id"].Value != null)
                {
                    currentOperation = Program.currentSelectedAccount.Operations.Find(o =>
                                                                                      string.Compare(o.Id, dataOperationGridView.Rows[e.RowIndex].Cells["Id"].Value.ToString()) == 0);
                }
                else
                {
                    currentOperation = null;
                }
            }
            else
            {
                currentOperation = null;
            }
        }
        public static Model.Operation ToOperation(this OwcOperation operation)
        {
            var o = new Model.Operation()
            {
                Code       = operation.Code,
                RequestURL = operation.RequestUrl,
                Method     = operation.Method,
                Type       = operation.Type
            };

            if (operation.Request != null)
            {
                o.Request = operation.Request.ToContent();
            }
            if (operation.Result != null)
            {
                o.Result = operation.Result.ToContent();
            }
            if (operation.Any != null)
            {
                o.Extensions = operation.Any.ToSyndicationElementExtensionCollection();
            }

            return(o);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Update a Operation.
 /// </summary>
 public void Update(Model.Operation operation)
 {
     //
     // todo: add other logic here.
     //
     Validate(operation);
     accessor.Update(operation);
 }
Exemplo n.º 5
0
        public void ShowEditFormLogic(Model.Operation operation)
        {
            ClearComponentRessources(operationComponentPanel);
            formComponent = new FormAddOrEditOperationComponent(operation);
            ChangeComponent(operationComponentPanel, formComponent);

            isDataGridActive = false;
            isFormActive     = true;
        }
Exemplo n.º 6
0
 private void Validate(Model.Operation operation)
 {
     if (string.IsNullOrEmpty(operation.OperationId))
     {
         throw new Helper.RequireValueException(Model.Operation.PRO_OperationId);
     }
     if (string.IsNullOrEmpty(operation.OperationName))
     {
         throw new Helper.RequireValueException(Model.Operation.PRO_OperationName);
     }
 }
        /// <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();
        }
Exemplo n.º 8
0
        public OperationDialog(Model.Operation operation, ModelController controller)
        {
            InitializeComponent();

            this.controller = controller;
            this.operation  = operation;
            this.Title      = string.Format("Property: {0}.{1}", operation.Class.Name, operation.Name);

            oldName = operation.Name;

            tbName.Text = operation.Name;
        }
Exemplo n.º 9
0
 private void treeLoad21(Model.Operation operation, TreeListNode node)
 {
     foreach (Model.Operation operation1 in this.operationManager.Select_ByParent(operation.OperationId))
     {
         TreeListNode node1 = treeList2.AppendNode(new object[] { operation1 }, node, operation1.OperationId);
         if (this.operationManager.Select_ByParent(operation1.OperationId) == null)
         {
             continue;
         }
         treeLoad21(operation1, node1);
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// Insert a Operation.
        /// </summary>
        public void Insert(Model.Operation operation)
        {
            //
            // todo:add other logic here
            //
            Validate(operation);

            if (this.HasRows(operation.OperationId))
            {
                throw new Helper.InvalidValueException(Model.Operation.PRO_OperationId);
            }

            accessor.Insert(operation);
        }
        public FormAddOrEditOperationComponent(Model.Operation operation)
        {
            InitializeComponent();
            UpdateCbox();

            mOperation = operation;

            this.nameTxtBox.Text = operation.Name;
            this.operationTypeCbox.SelectedItem = operation.OperationType;
            this.dateTPicker.Value            = operation.Date;
            this.paymentTypeCbox.SelectedItem = operation.PaymentType;
            this.amountTxtBox.Text            = operation.Amount.ToString();
            this.categoryCbox.SelectedItem    = operation.category.GetName();


            this.editBtn.Visible = true;
            this.addBtn.Visible  = false;
        }
Exemplo n.º 12
0
        private void dataOperationGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int[] indexes = new int[dataOperationGridView.ColumnCount];
            for (int i = 0; i < dataOperationGridView.ColumnCount; i++)
            {
                indexes[i] = i;
            }

            if (indexes.Contains(e.ColumnIndex) == true && e.RowIndex != -1)
            {
                if (dataOperationGridView.Rows[e.RowIndex].Cells["Id"].Value != null)
                {
                    Program.SearchParent(this, "ViewOperation").GetType().GetMethod("ShowEditFormLogic").Invoke(Program.SearchParent(this, "ViewOperation"), new object[] { currentOperation });
                }
            }
            else
            {
                currentOperation = null;
            }
        }
Exemplo n.º 13
0
 public bool HasRowsAfter(Model.Operation e)
 {
     return(accessor.HasRowsAfter(e));
 }
Exemplo n.º 14
0
 public bool HasRowsBefore(Model.Operation e)
 {
     return(accessor.HasRowsBefore(e));
 }
Exemplo n.º 15
0
 public Model.Operation GetNext(Model.Operation e)
 {
     return(sqlmapper.QueryForObject <Model.Operation>("Operation.get_next", e));
 }
Exemplo n.º 16
0
 public Model.Operation GetPrev(Model.Operation e)
 {
     return(sqlmapper.QueryForObject <Model.Operation>("Operation.get_prev", e));
 }
Exemplo n.º 17
0
 public bool HasRowsAfter(Model.Operation e)
 {
     return(sqlmapper.QueryForObject <bool>("Operation.has_rows_after", e));
 }
Exemplo n.º 18
0
 public bool HasRowsBefore(Model.Operation e)
 {
     return(sqlmapper.QueryForObject <bool>("Operation.has_rows_before", e));
 }
Exemplo n.º 19
0
 public void Update(Model.Operation e)
 {
     this.Update <Model.Operation>(e);
 }
Exemplo n.º 20
0
 public Model.Operation GetPrev(Model.Operation e)
 {
     return(accessor.GetPrev(e));
 }
Exemplo n.º 21
0
 public Model.Operation GetNext(Model.Operation e)
 {
     return(accessor.GetNext(e));
 }
        /// <summary>
        /// Create json string as per the Mail chimp api
        /// </summary>
        /// <param name="marketingListID">Marketing list id from config record</param>
        /// <param name="members">Entity Collection marketing list members</param>
        /// <returns>json string</returns>
        private static string CreateBatchJSON(string mailChimpMarketingListID, EntityCollection members, ITracingService tracer)
        {
            string jsonData = string.Empty;

            Model.MailChimpContactCreateBatchRequest requestObject = new Model.MailChimpContactCreateBatchRequest();
            List <Model.Operation> operationlist = new List <Model.Operation>();

            foreach (var memberEntity in members.Entities)
            {
                Model.Operation operation  = new Model.Operation();
                string          subscribed = "subscribed";
                string          firstname  = string.Empty;
                string          lastname   = string.Empty;
                if (memberEntity.Contains("firstname"))
                {
                    firstname = memberEntity.Attributes["firstname"].ToString();
                }

                if (memberEntity.Contains("lastname"))
                {
                    lastname = memberEntity.Attributes["lastname"].ToString();
                }
                if (!string.IsNullOrEmpty(firstname))
                {
                    if (!string.IsNullOrEmpty(lastname))
                    {
                        tracer.Trace("First name and last name present");
                        operation.body = "{\"email_address\":\"" + memberEntity.Attributes["emailaddress1"] + "\",\"status\":\"" + subscribed + "\",\"merge_fields\":{\"FNAME\":\"" + firstname + "\",\"LNAME\":\"" + lastname + "\"}}";
                        tracer.Trace("operation.body: " + operation.body);
                    }
                    else
                    {
                        tracer.Trace("First name present");
                        operation.body = "{\"email_address\":\"" + memberEntity.Attributes["emailaddress1"] + "\",\"status\":\"" + subscribed + "\",\"merge_fields\":{\"FNAME\":\"" + firstname + "\"}}";
                        tracer.Trace("operation.body: " + operation.body);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(lastname))
                    {
                        tracer.Trace(" last name present");
                        operation.body = "{\"email_address\":\"" + memberEntity.Attributes["emailaddress1"] + "\",\"status\":\"" + subscribed + "\",\"merge_fields\":{\"LNAME\":\"" + lastname + "\"}}";
                        tracer.Trace("operation.body: " + operation.body);
                    }
                    else
                    {
                        tracer.Trace("First name and last name not present");
                        operation.body = "{\"email_address\":\"" + memberEntity.Attributes["emailaddress1"] + "\",\"status\":\"" + subscribed + "\"}";
                        tracer.Trace("operation.body: " + operation.body);
                    }
                }

                //// Create request
                tracer.Trace("Create request");
                operation.method = "POST";
                operation.path   = "lists/" + mailChimpMarketingListID + "/members";
                tracer.Trace("Operation path: " + operation.path.ToString());
                operationlist.Add(operation);
            }

            requestObject.operations = operationlist;

            jsonData = GetRequestJSON(requestObject);
            return(jsonData);
        }
Exemplo n.º 23
0
 public void Insert(Model.Operation e)
 {
     this.Insert <Model.Operation>(e);
 }