/// <summary>
        /// Save the given item.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public override ReconciliationTemplate Save(ReconciliationTemplate rTemplate)
        {
            //getExcel();
            //sendExcelFile();

            if (rTemplate != null)
            {
                try
                {
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    var request = new RestRequest(ResourcePath + "/save", Method.POST);

                    request.RequestFormat    = DataFormat.Json;
                    serializer.MaxJsonLength = int.MaxValue;
                    string json = serializer.Serialize(rTemplate);
                    request.AddParameter("application/json", json, ParameterType.RequestBody);
                    var          response    = RestClient.ExecuteTaskAsync(request);
                    RestResponse queryResult = (RestResponse)response.Result;
                    bool         valid       = ValidateResponse(queryResult);

                    JavaScriptSerializer Serializer = new JavaScriptSerializer();
                    Serializer.MaxJsonLength = int.MaxValue;
                    rTemplate = Serializer.Deserialize <ReconciliationTemplate>(queryResult.Content);
                    try
                    {
                        if (FileService != null)
                        {
                            FileService.SaveCurrentFile();
                        }
                    }
                    catch (Exception) { }
                    return(rTemplate);
                }
                catch (Exception e)
                {
                    logger.Error("Unable to save Item.", e);
                    throw new BcephalException("Unable to save Item.", e);
                }
            }
            else
            {
                return(rTemplate);
            }
        }
Beispiel #2
0
        public void updateReconciliation(ReconciliationTemplate reco1, ReconciliationTemplate reCo)
        {
            int    index        = 0;
            int    pos          = 0;
            int    pos1         = 0;
            bool   found        = false;
            bool   found1       = false;
            string newName      = reco1.name;
            string oldTableName = reCo.name;

            ReconciliationTemplate input = null;

            foreach (ReconciliationTemplate inputtable in this.liste)
            {
                if (!found)
                {
                    if (inputtable.name == reco1.name)
                    {
                        inputtable.name = reCo.name;
                        found           = true;
                        input           = inputtable;
                        pos             = index;
                    }
                }
                if (!found1)
                {
                    if (inputtable.name == reCo.name)
                    {
                        pos1   = index;
                        found1 = true;
                    }
                }
                index++;
            }

            this.liste[pos] = input;
            this.cvs.DeferRefresh();
        }
Beispiel #3
0
 /// <summary>
 /// Retire une reco de la liste
 /// </summary>
 /// <param name="reco">La reco à modifier</param>
 public void RemoveReconciliation(ReconciliationTemplate reco)
 {
     this.liste.Remove(reco);
     this.cvs.DeferRefresh();
 }
Beispiel #4
0
 /// <summary>
 /// Rajoute une reco
 /// </summary>
 /// <param name="inputTable">L'Reconciliation à modifier</param>
 public void AddReconciliation(ReconciliationTemplate reco)
 {
     this.liste.Add(reco);
     this.cvs.DeferRefresh();
 }