예제 #1
0
 public Text(CfText source)
 {
     FromNumber = source.FromNumber;
     ToNumber   = ToNumberMapper.ToToNumber(source.ToNumber);
     State      = EnumeratedMapper.ScreamingSnakeCase(source.State.ToString());
     if (source.BatchId.HasValue)
     {
         BatchId          = source.BatchId.Value;
         BatchIdSpecified = true;
     }
     if (source.BroadcastId.HasValue)
     {
         BroadcastId          = source.BroadcastId.Value;
         BroadcastIdSpecified = true;
     }
     ContactId   = source.ContactId;
     Inbound     = source.Inbound;
     Created     = source.Created;
     Modified    = source.Modified;
     FinalResult = EnumeratedMapper.ScreamingSnakeCase(source.FinalResult.ToString());
     Label       = LabelMapper.ToLabel(source.Label);
     id          = source.Id;
     Message     = source.Message;
     TextRecord  = TextRecordMapper.ToTextRecord(source.TextRecord);
 }
예제 #2
0
        public IBLL.DTO.LabelDTO GetLabelById(string labeidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            log.Info(string.Format("Starting ..."));

            IBLL.DTO.LabelDTO labe = null;

            try
            {
                IDAL.VO.LabelVO labe_ = this.dal.GetLabelById(labeidid);
                labe = LabelMapper.LabeMapper(labe_);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(labe), LibString.TypeName(labe_), LibString.TypeName(labe)));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();
            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(labe);
        }
예제 #3
0
        public List <IBLL.DTO.LabelDTO> GetLabelsByRichiesta(string richidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            log.Info(string.Format("Starting ..."));

            List <IBLL.DTO.LabelDTO> labes = null;

            try
            {
                List <IDAL.VO.LabelVO> labes_ = this.dal.GetLabelsByRichiesta(richidid);
                labes = LabelMapper.LabeMapper(labes_);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(labes), LibString.TypeName(labes_), LibString.TypeName(labes)));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();
            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(labes);
        }
예제 #4
0
        public List <IBLL.DTO.LabelDTO> AddLabels(List <IBLL.DTO.LabelDTO> data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            log.Info(string.Format("Starting ..."));

            List <IBLL.DTO.LabelDTO> toReturn = null;

            try
            {
                data.ForEach(p => p.labeidid = null);
                List <IDAL.VO.LabelVO> data_ = LabelMapper.LabeMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                List <IDAL.VO.LabelVO> stored = dal.NewLabels(data_);
                log.Info(string.Format("{0} {1} items added and got back!", LibString.ItemsNumber(stored), LibString.TypeName(stored)));
                toReturn = LabelMapper.LabeMapper(stored);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(toReturn), LibString.TypeName(stored), LibString.TypeName(toReturn)));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();
            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(toReturn);
        }
예제 #5
0
 public MethodWeaver(ModuleWeavingContext context, MethodDefinition method, ILogger log)
 {
     _context        = context;
     _method         = method;
     _il             = new WeaverILProcessor(_method);
     _sequencePoints = new SequencePointMapper(_method, context.Config);
     _log            = new MethodWeaverLogger(log, _method);
     _labels         = new LabelMapper(_il, _log);
     _consumer       = new ArgumentConsumer(_il);
 }
예제 #6
0
        // NO ENTITYFRAMEWORK

        public IDAL.VO.LabelVO GetLabelById(string labeidid)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            log.Info(string.Format("Starting ..."));

            IDAL.VO.LabelVO labe = null;
            try
            {
                string connectionString = this.GRConnectionString;

                long   labelidid_ = long.Parse(labeidid);
                string table      = this.LabelTabName;

                Dictionary <string, DBSQL.QueryCondition> conditions = new Dictionary <string, DBSQL.QueryCondition>()
                {
                    {
                        "id",
                        new DBSQL.QueryCondition()
                        {
                            Key   = "labeidid",
                            Op    = DBSQL.Op.Equal,
                            Value = labelidid_,
                            Conj  = DBSQL.Conj.None
                        }
                    }
                };
                DataTable data = DBSQL.SelectOperation(connectionString, table, conditions);
                log.Info(string.Format("DBSQL Query Executed! Retrieved {0} record!", LibString.ItemsNumber(data)));
                if (data != null)
                {
                    if (data.Rows.Count == 1)
                    {
                        labe = LabelMapper.LabeMapper(data.Rows[0]);
                        log.Info(string.Format("{0} Records mapped to {1}", LibString.ItemsNumber(labe), LibString.TypeName(labe)));
                    }
                }
            }
            catch (Exception ex)
            {
                log.Info(string.Format("DBSQL Query Executed! Retrieved 0 record!"));
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();

            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(labe);
        }
예제 #7
0
        public IDAL.VO.LabelVO NewLabel(IDAL.VO.LabelVO data)
        {
            IDAL.VO.LabelVO result = null;

            Stopwatch tw = new Stopwatch();

            tw.Start();

            log.Info(string.Format("Starting ..."));

            string table = this.LabelTabName;

            try
            {
                string connectionString = this.GRConnectionString;

                List <string> pk = new List <string>()
                {
                    "LABEIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "labeIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.InsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null)
                {
                    if (res.Rows.Count > 0)
                    {
                        result = LabelMapper.LabeMapper(res.Rows[0]);
                        log.Info(string.Format("Inserted new record with ID: {0}!", result.labeidid));
                    }
                }
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();

            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(result);
        }
예제 #8
0
        public async Task <IActionResult> Detail(string id)
        {
            if (id.IsUid())
            {
                Guid.TryParse(id, out var uid);
                var labelUid = uid;
                if (labelUid.IsEmptyGuid())
                {
                    return(RedirectToHome());
                }

                var request  = new LabelReadRequest(CurrentUser.Id, labelUid);
                var response = await _labelService.GetLabel(request);

                if (response.Status.IsNotSuccess)
                {
                    return(RedirectToAccessDenied());
                }

                var model = LabelMapper.MapLabelDetailModel(response.Item);

                return(View(model));
            }
            else
            {
                var labelKey = id;
                if (labelKey.IsEmpty())
                {
                    return(RedirectToHome());
                }

                var request  = new LabelReadByKeyRequest(CurrentUser.Id, labelKey);
                var response = await _labelService.GetLabelByKey(request);

                if (response.Status.IsNotSuccess)
                {
                    return(RedirectToAccessDenied());
                }

                var model = LabelMapper.MapLabelDetailModel(response.Item);

                return(View(model));
            }
        }
예제 #9
0
        public async Task <IActionResult> UploadLabelTranslationFromCSVFile(Guid id)
        {
            var labelUid = id;

            if (labelUid.IsEmptyGuid())
            {
                return(RedirectToAccessDenied());
            }

            var request = new LabelReadRequest(CurrentUser.Id, labelUid);
            var label   = await _labelService.GetLabel(request);

            if (label.Status.IsNotSuccess)
            {
                return(RedirectToAccessDenied());
            }

            var model = LabelMapper.MapUploadLabelTranslationFromCSVFileModel(label.Item);

            return(View(model));
        }
예제 #10
0
        public async Task <IActionResult> LabelTranslationEdit(Guid id)
        {
            var labelTranslationUid = id;

            if (labelTranslationUid.IsEmptyGuid())
            {
                return(RedirectToAccessDenied());
            }

            var request  = new LabelTranslationReadRequest(CurrentUser.Id, labelTranslationUid);
            var response = await _labelService.GetTranslation(request);

            if (response.Status.IsNotSuccess)
            {
                return(RedirectToAccessDenied());
            }

            var model = LabelMapper.MapLabelTranslationEditModel(response.Item);

            return(View(model));
        }
예제 #11
0
        public async Task <IActionResult> CreateBulkLabel(Guid id)
        {
            var projectUid = id;

            if (projectUid.IsEmptyGuid())
            {
                return(RedirectToAccessDenied());
            }

            var request = new ProjectReadRequest(CurrentUser.Id, projectUid);
            var project = await _projectService.GetProject(request);

            if (project.Status.IsNotSuccess)
            {
                return(RedirectToAccessDenied());
            }

            var model = LabelMapper.MapCreateBulkLabelModel(project.Item);

            return(View(model));
        }
예제 #12
0
        public IBLL.DTO.LabelDTO UpdatLabel(IBLL.DTO.LabelDTO data)
        {
            Stopwatch tw = new Stopwatch();

            tw.Start();

            log.Info(string.Format("Starting ..."));

            int stored = 0;

            IBLL.DTO.LabelDTO toReturn = null;
            string            id       = data.labeidid.ToString();

            try
            {
                if (id == null || GetLabelById(id) == null)
                {
                    string msg = string.Format("No record found with the id {0}! Updating is impossible!", id);
                    log.Info(msg);
                    log.Error(msg);
                    return(null);
                }
                IDAL.VO.LabelVO data_ = LabelMapper.LabeMapper(data);
                log.Info(string.Format("{0} {1} mapped to {2}", LibString.ItemsNumber(data_), LibString.TypeName(data), LibString.TypeName(data_)));
                stored   = dal.SetLabel(data_);
                toReturn = GetLabelById(data.labeidid.ToString());
                log.Info(string.Format("{0} {1} items added and {2} {3} retrieved back!", stored, LibString.TypeName(data_), LibString.ItemsNumber(toReturn), LibString.TypeName(toReturn)));
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();
            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(toReturn);
        }
 private void OnEnable()
 {
     mapper = (LabelMapper)target;
 }
예제 #14
0
        public List <IDAL.VO.LabelVO> NewLabels(List <IDAL.VO.LabelVO> data)
        {
            List <IDAL.VO.LabelVO> results = null;

            Stopwatch tw = new Stopwatch();

            tw.Start();

            log.Info(string.Format("Starting ..."));

            string table = this.LabelTabName;

            try
            {
                string connectionString = this.GRConnectionString;

                List <string> pk = new List <string>()
                {
                    "LABEIDID"
                };
                List <string> autoincrement = new List <string>()
                {
                    "lAbeIdiD"
                };
                // INSERT NUOVA
                DataTable res = DBSQL.MultiInsertBackOperation(connectionString, table, data, pk, autoincrement);
                if (res != null && res.Rows.Count > 0)
                {
                    results = LabelMapper.LabeMapper(res);
                }
                if (results != null)
                {
                    if (results.Count > 0)
                    {
                        string tmp = "";
                        int    o   = 0;
                        foreach (IDAL.VO.LabelVO tmp_ in results)
                        {
                            tmp += tmp_.labeidid.Value.ToString();
                            if (o < results.Count - 1)
                            {
                                tmp += ", ";
                            }
                            o++;
                        }
                        log.Info(string.Format("Inserted {0} new records with IDs: {1}!", LibString.ItemsNumber(results), tmp));
                    }
                }
                else
                {
                    log.Info(string.Format("No records Inserted!"));
                }
            }
            catch (Exception ex)
            {
                string msg = "An Error occured! Exception detected!";
                log.Info(msg);
                log.Error(msg + "\n" + ex.Message);
            }

            tw.Stop();

            log.Info(string.Format("Completed! Elapsed time {0}", LibString.TimeSpanToTimeHmsms(tw.Elapsed)));

            return(results);
        }