public JsonResult AddNewLeadType(LeadTypeModel ltype)
 {
     if (ltype.ID > 0)
     {
         var result = db.LeadTypes.SingleOrDefault(b => b.ID == ltype.ID);
         if (result != null)
         {
             result.LeadTypeName = ltype.LeadTypeName;
             //result.Is_Active = false;
             //result.Status = "Active";
             // result.Created_By = Convert.ToInt32(Session["UserId"]);
             db.SaveChanges();
         }
     }
     else
     {
         int      userId = Convert.ToInt32(Session["UserId"]);
         LeadType lt     = new LeadType();
         lt.LeadTypeName = ltype.LeadTypeName;
         lt.Status       = "Active";
         lt.Is_Active    = true;
         lt.DateCreated  = DateTime.Now;
         lt.Created_By   = userId;
         db.LeadTypes.Add(lt);
         db.SaveChanges();
     }
     //LeadType lt = db.LeadTypes.Where(c => c.LeadTypeName == ltype).SingleOrDefault();
     return(Json(new { status = "ok", code = 200, data = ltype }, JsonRequestBehavior.AllowGet));
 }
Beispiel #2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,CreatedDateUtc,IsActive,Name,Description")] LeadType leadType)
        {
            if (id != leadType.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(leadType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LeadTypeExists(leadType.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(leadType));
        }
Beispiel #3
0
 /// <summary>
 /// <see cref="PMToolpath"/> that own this <see cref="PMLead"/>
 /// </summary>
 /// <param name="property">property name</param>
 /// <returns>Full qualified powermill parameter name/></returns>
 protected string GetPropertyFullName(string property)
 {
     return(string.Format("{0}.{1}.{2}",
                          Resources.Connections,
                          Resources.ResourceManager.GetString(LeadType.ToString()),
                          property));
 }
Beispiel #4
0
 public Lead(LeadType nInputLeadType,
             String strInputLeadContent,
             String strInputLeadURL)
 {
     nLeadType      = nInputLeadType;
     strLeadContent = strInputLeadContent;
     strLeadURL     = strInputLeadURL;
     dtTimeStamp    = DateTime.Now;
     //nIdnId++;
 }
Beispiel #5
0
 public Lead(Int32 nInputLeadId,
             LeadType nInputLeadType,
             String strInputLeadContent,
             String strInputLeadURL)
 {
     nId            = nInputLeadId;
     nLeadType      = nInputLeadType;
     strLeadContent = strInputLeadContent;
     strLeadURL     = strInputLeadURL;
     dtTimeStamp    = DateTime.Now;
 }
Beispiel #6
0
        public ActionResult Update(int id, LeadType type)
        {
            var lead = _leadService.GetByID(id);

            lead.Status = type;

            //write activity to the log
            _activityService.Create("status was updated", AreaType.Lead, User.Identity.Name, lead.ID);
            _leadService.Save(lead);

            return(RedirectToAction("Index"));
        }
Beispiel #7
0
        public async Task <IActionResult> Create([Bind("ID,CreatedDateUtc,IsActive,Name,Description")] LeadType leadType)
        {
            if (ModelState.IsValid)
            {
                leadType.ID = Guid.NewGuid();
                _context.Add(leadType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(leadType));
        }
Beispiel #8
0
        public IActionResult Add([FromBody] LeadDto dto)
        {
            //check number
            dto.MobileNo = PhoneNoModule.NormalizePhoneNoFormat(dto.MobileNo);
            if (!PhoneNoModule.isPhoneNumberValid(dto.MobileNo))
            {
                return(BadRequest("Mobile number not valid. Needs to 12 Characters"));
            }

            if (!_leadTypeRepository.All.Any(s => s.Id == dto.LeadTypeId))
            {
                return(BadRequest($"Lead type {dto.LeadTypeId} not valid"));
            }

            if (!string.IsNullOrWhiteSpace(dto.ProductBracket) && !_mobileProductRepository.GetProductsByBracket(dto.ProductBracket).Any())
            {
                return(BadRequest($"No product found for {dto.ProductBracket}"));
            }

            //check if lead is active
            var currentlead = _leadRepo.FindOpenLeadByMobileNo(dto.MobileNo);

            if (currentlead.IsSome)
            {
                if (currentlead.Val.IsClosed == false)
                {
                    currentlead.Val.Close();
                    _leadRepo.Update(currentlead.Val);
                }
            }
            //LeadTypeModule
            var leadType = new LeadType(dto.LeadTypeId);
            var lead     = new Lead(leadType, dto.MobileNo, dto.FirstName.StrToOpt())
            {
                ProductBracket  = dto.ProductBracket.StrToOpt(),
                IdNumber        = dto.IdNumber.StrToOpt(),
                Surname         = dto.Surname.StrToOpt(),
                ExternalRefNo   = dto.ExternalRefNo.StrToOpt(),
                BankName        = dto.BankName.StrToOpt(),
                BankAccountType = dto.BankAccountType.StrToOpt(),
                BankAccountNo   = dto.BankAccountNo.StrToOpt(),
                EmployerName    = dto.EmployerName.StrToOpt(),
                EmployerNumber  = dto.EmployerNumber.StrToOpt(),
                EmployerAddress = string.IsNullOrEmpty(dto.EmployerAddressStreet) ? None <Address>() :  Some(new Address(dto.EmployerAddressStreet, dto.EmployerAddressSuburb, dto.EmployerAddressCity, dto.EmployerAddressPostalCode)),
                HomeAddress     = string.IsNullOrEmpty(dto.HomeAddressStreet) ? None <Address>() : Some(new Address(dto.HomeAddressStreet, dto.HomeAddressSuburb, dto.HomeAddressCity, dto.HomeAddressPostalCode))
            };

            _leadRepo.Add(lead);

            return(Ok("Lead Created"));
        }
Beispiel #9
0
 public Lead()
 {
     _messages = new List<Message>();
     _document = new TaxDocument();
     _address = new Address();
     _recordeddate = "";
     _middle = "";
     _last = "";
     _first = "";
     _debt = "";
     _businessname = "";
     _leadtype = LeadType.Federal;
     _status = LeadStatus.MissingInformation;
 }
Beispiel #10
0
 public Signal this[LeadType leadType]
 {
     get
     {
         if (Leads != null)
         {
             foreach (Signal signal in Leads)
             {
                 if (signal.Type == leadType)
                 {
                     return(signal);
                 }
             }
         }
         return(null);
     }
 }
Beispiel #11
0
        private void CreateImageFromTempFile(LeadType leadType)
        {
            string tempFileName;
            var    tempFilePath = Path.Combine(this.ImagePath, leadType.Image);

            using (var tempFileStream = FileHelper.OpenFile(tempFilePath))
            {
                tempFileName = tempFileStream.Name;

                var newFileName = leadType.Id + Path.GetExtension(tempFileStream.Name);
                var newFilePath = Path.Combine(this.ImagePath, newFileName);

                FileHelper.SaveFile(tempFileStream, newFilePath);
                leadType.Image = newFileName;
            }

            FileHelper.DeleteFile(tempFileName);
        }
Beispiel #12
0
        public IActionResult Post(string values)
        {
            var model = new LeadType();

            JsonConvert.PopulateObject(values, model);

            if (!TryValidateModel(model))
            {
                return(BadRequest(GetFullErrorMessage(ModelState)));
            }

            _leadTypeRepo.Add(model);

            // Adding logo
            if (!String.IsNullOrEmpty(model.Image))
            {
                this.CreateImageFromTempFile(model);
            }

            return(_uow.Commit() ? Ok() : StatusCode(StatusCodes.Status500InternalServerError));
        }
Beispiel #13
0
        public async Task CreateLeadAsync <T>(T command, LeadType leadType) where T : ICommand
        {
            switch (leadType)
            {
            case LeadType.CallCenter:
                await _leadService.CreateCallCenterLeadAsync(command);

                break;

            case LeadType.CustomerSupport:
                await _emailService.SendAsync();

                break;

            case LeadType.Order:
                await _leadService.CreateOrderLeadAsync(command);

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(leadType), leadType, null);
            }
        }
Beispiel #14
0
        public ActionResult Convert(int id, LeadType type)
        {
            Lead lead = _leadService.GetByID(id);
            
            Contact company = new Contact();

            if (!string.IsNullOrEmpty(lead.CompanyName))
            {
                //add a company contact   
                company.Type = ContactType.Company;
                company.CompanyName = lead.CompanyName;
                company.Email = lead.Email;
                company.Mobile = lead.Mobile;
                company.Work = lead.Work;
                company.Address = lead.Address;
                company.City = lead.City;
                company.County = lead.County;
                company.Postcode = lead.Postcode;
                company.OwnerID = lead.OwnerID;

                _contactService.Save(company);
            }

            Contact person = new Contact();
            if (!string.IsNullOrEmpty(lead.FirstName) && !string.IsNullOrEmpty(lead.LastName))
            {
                //add a person contact       
                person.Type = ContactType.Person;                
                person.CompanyID = lead.CompanyID.HasValue ? lead.CompanyID.Value : company.ID;
                person.FirstName = lead.FirstName;
                person.LastName = lead.LastName;
                person.JobTitle = lead.JobTitle;
                person.Email = lead.Email;
                person.Mobile = lead.Mobile;
                person.Work = lead.Work;
                person.Address = lead.Address;
                person.City = lead.City;
                person.County = lead.County;
                person.Postcode = lead.Postcode;
                person.OwnerID = lead.OwnerID;

                _contactService.Save(person);
            }

            Sale sale = new Sale()
            {
                Name = lead.FirstName + " " + lead.LastName,
                JobTitle = company.CompanyName,
                CreatedDate = DateTime.Now,
                CompanyID = lead.CompanyID.HasValue ? lead.CompanyID.Value : company.ID,
                OwnerID = lead.OwnerID,
                PersonID = person.ID,
                Status = SaleType.Prospecting,
                CampaignID = lead.CampaignID
            };
           
            // set converted date
            lead.Converted = DateTime.Now;            
            _leadService.Save(lead);

            _saleService.Save(sale);
            _activityService.Create("was converted", AreaType.Sale, User.Identity.Name, sale.ID);

            // re-assign existing tags
            lead.Tags.ToList().ForEach(t => _saleService.AssignTag(sale, t.Tag));

            TempData.Add("StatusMessage", "Lead converted");

            return RedirectToAction("Index", "Sale");
        }
Beispiel #15
0
 protected override void PerformOCR(ref Lead lead, LeadType type)
 {
     if (type == LeadType.Federal)
     {
         var fed = new Federal(lead.Document.Disklocation, "Monroe");
         lead = fed.GetLeadFromOcr();
     }
     else
     {
         var state = new MonroeOcr(lead.Document.Disklocation,"Monroe");
         lead = state.GetLeadFromOcr();
     }
 }
        protected static ExchangeAcquisitionEvent CreateLeadTypeEvent()
        {
            LeadType lead = new LeadType();
            lead.Guid = GuidGenerator.Generate();
            lead.Aid = new Random().Next(99999).ToString();
            lead.Cid = new Random().Next(999).ToString();
            lead.City = "Seattle";
            lead.Email = "*****@*****.**";
            lead.FirstName = "John";
            lead.LastName = "Cusak";
            lead.Password = "******";
            lead.Phone = "2323234543";
            lead.State = "WA";
            lead.Street = "234 WanderLand Ave.";
            lead.Username = "******";
            lead.Zip = "98102";

            List<String> errors = new List<string>();
            errors.Add("Test Error 1");
            errors.Add("Test Error 2");

            return new ExchangeAcquisitionEvent(lead, DebtAcquisition.AllocationEvent, errors);
        }
Beispiel #17
0
        /// <summary>
        /// Function to make a twelve leads signals object.
        /// </summary>
        /// <returns>returns twelve leads signals object or null</returns>
        public Signals CalculateTwelveLeads()
        {
            LeadType[] lt = new LeadType[] { LeadType.I, LeadType.II, LeadType.III,
                                             LeadType.aVR, LeadType.aVL, LeadType.aVF,
                                             LeadType.V1, LeadType.V2, LeadType.V3,
                                             LeadType.V4, LeadType.V5, LeadType.V6 };

            int nrSim = NrSimultaneosly();

            if (nrSim != _Lead.Length)
            {
                return(null);
            }

            Signal[] leads = null;

            if (nrSim == 12)
            {
                ArrayList pos_list = new ArrayList(lt);

                int       check_one = 0;
                ArrayList check_two = new ArrayList(lt);
                Signal[]  pos       = new Signal[12];

                for (int i = 0; i < nrSim; i++)
                {
                    if (_Lead[i].Type == lt[i])
                    {
                        check_one++;
                    }

                    int temp = check_two.IndexOf(_Lead[i].Type);
                    if (temp < 0)
                    {
                        return(null);
                    }

                    check_two.RemoveAt(temp);

                    pos[pos_list.IndexOf(_Lead[i].Type)] = _Lead[i];
                }

                if (check_one == 12)
                {
                    return(this);
                }

                if (check_two.Count == 0)
                {
                    for (int i = 0; i < pos.Length; i++)
                    {
                        if (pos[i] != null)
                        {
                            pos[i] = pos[i].Clone();
                        }
                    }

                    leads = pos;
                }
            }
            else
            {
                short[][]
                tempRhythm = null,
                tempMedian = null;

                Signal[] pos = new Signal[12];

                if (nrSim == 8)
                {
                    ArrayList pos_list = new ArrayList(lt);

                    ArrayList check = new ArrayList(
                        new LeadType[] { LeadType.I, LeadType.II,
                                         LeadType.V1, LeadType.V2, LeadType.V3,
                                         LeadType.V4, LeadType.V5, LeadType.V6 });

                    for (int i = 0; i < nrSim; i++)
                    {
                        int temp = check.IndexOf(_Lead[i].Type);
                        if (temp < 0)
                        {
                            return(null);
                        }

                        check.RemoveAt(temp);

                        pos[pos_list.IndexOf(_Lead[i].Type)] = _Lead[i];
                    }

                    if (check.Count == 0)
                    {
                        for (int i = 0; i < pos.Length; i++)
                        {
                            if (pos[i] != null)
                            {
                                pos[i] = pos[i].Clone();
                            }
                        }

                        tempRhythm    = new short[2][];
                        tempRhythm[0] = pos[0].Rhythm;
                        tempRhythm[1] = pos[1].Rhythm;

                        tempMedian    = new short[2][];
                        tempMedian[0] = pos[0].Median;
                        tempMedian[1] = pos[1].Median;
                    }
                }
                else if (nrSim == 9)
                {
                    ArrayList pos_list = new ArrayList(lt);

                    ArrayList check = new ArrayList(
                        new LeadType[] { LeadType.I, LeadType.II, LeadType.III,
                                         LeadType.V1, LeadType.V2, LeadType.V3,
                                         LeadType.V4, LeadType.V5, LeadType.V6 });

                    for (int i = 0; i < nrSim; i++)
                    {
                        int temp = check.IndexOf(_Lead[i].Type);
                        if (temp < 0)
                        {
                            return(null);
                        }

                        check.RemoveAt(temp);

                        pos[pos_list.IndexOf(_Lead[i].Type)] = _Lead[i];
                    }

                    if (check.Count == 0)
                    {
                        for (int i = 0; i < pos.Length; i++)
                        {
                            if (pos[i] != null)
                            {
                                pos[i] = pos[i].Clone();
                            }
                        }

                        tempRhythm    = new short[3][];
                        tempRhythm[0] = pos[0].Rhythm;
                        tempRhythm[1] = pos[1].Rhythm;
                        tempRhythm[2] = pos[2].Rhythm;

                        tempMedian    = new short[3][];
                        tempMedian[0] = pos[0].Median;
                        tempMedian[1] = pos[1].Median;
                        tempMedian[2] = pos[2].Median;
                    }
                }

                if ((tempRhythm != null) ||
                    (tempMedian != null))
                {
                    short[][] calcLeads;

                    if ((tempRhythm != null) &&
                        (tempRhythm[0] != null) &&
                        ECGTool.CalculateLeads(tempRhythm, tempRhythm[0].Length, out calcLeads) == 0)
                    {
                        for (int i = 0; i < calcLeads.Length; i++)
                        {
                            Signal sig = new Signal();
                            sig.Type        = lt[i + tempRhythm.Length];
                            sig.RhythmStart = pos[0].RhythmStart;
                            sig.RhythmEnd   = pos[0].RhythmEnd;
                            sig.Rhythm      = calcLeads[i];

                            pos[i + tempRhythm.Length] = sig;
                        }

                        if ((tempMedian != null) &&
                            (tempMedian[0] != null) &&
                            (ECGTool.CalculateLeads(tempMedian, tempMedian[0].Length, out calcLeads) == 0))
                        {
                            for (int i = 0; i < calcLeads.Length; i++)
                            {
                                pos[i + tempRhythm.Length].Median = calcLeads[i];
                            }
                        }

                        leads = pos;
                    }
                }
            }

            if (leads != null)
            {
                Signals sigs = this.Clone();

                sigs.NrLeads = (byte)leads.Length;

                for (int i = 0; i < leads.Length; i++)
                {
                    sigs._Lead[i] = leads[i];
                }

                return(sigs);
            }

            return(null);
        }
Beispiel #18
0
            static LeadType NewOutboundLeadType()
            {
                var leadType = new LeadType(LeadTypes.OutboundLeads);

                return(leadType);
            }
 public void Update(LeadType type)
 {
     _store.StoreAsync(type).Wait();
 }
Beispiel #20
0
 public void Update(LeadType entity)
 {
     _context.Update(entity);
     // _context.SaveChanges();
 }
Beispiel #21
0
        public ActionResult Convert(int id, LeadType type)
        {
            Lead lead = _leadService.GetByID(id);

            Contact company = new Contact();

            if (!string.IsNullOrEmpty(lead.CompanyName))
            {
                //add a company contact
                company.Type        = ContactType.Company;
                company.CompanyName = lead.CompanyName;
                company.Email       = lead.Email;
                company.Mobile      = lead.Mobile;
                company.Work        = lead.Work;
                company.Address     = lead.Address;
                company.City        = lead.City;
                company.County      = lead.County;
                company.Postcode    = lead.Postcode;
                company.OwnerID     = lead.OwnerID;

                _contactService.Save(company);
            }

            Contact person = new Contact();

            if (!string.IsNullOrEmpty(lead.FirstName) && !string.IsNullOrEmpty(lead.LastName))
            {
                //add a person contact
                person.Type      = ContactType.Person;
                person.CompanyID = lead.CompanyID.HasValue ? lead.CompanyID.Value : company.ID;
                person.FirstName = lead.FirstName;
                person.LastName  = lead.LastName;
                person.JobTitle  = lead.JobTitle;
                person.Email     = lead.Email;
                person.Mobile    = lead.Mobile;
                person.Work      = lead.Work;
                person.Address   = lead.Address;
                person.City      = lead.City;
                person.County    = lead.County;
                person.Postcode  = lead.Postcode;
                person.OwnerID   = lead.OwnerID;

                _contactService.Save(person);
            }

            Sale sale = new Sale()
            {
                Name        = lead.FirstName + " " + lead.LastName,
                JobTitle    = company.CompanyName,
                CreatedDate = DateTime.Now,
                CompanyID   = lead.CompanyID.HasValue ? lead.CompanyID.Value : company.ID,
                OwnerID     = lead.OwnerID,
                PersonID    = person.ID,
                Status      = SaleType.Prospecting,
                CampaignID  = lead.CampaignID
            };

            // set converted date
            lead.Converted = DateTime.Now;
            _leadService.Save(lead);

            _saleService.Save(sale);
            _activityService.Create("was converted", AreaType.Sale, User.Identity.Name, sale.ID);

            // re-assign existing tags
            lead.Tags.ToList().ForEach(t => _saleService.AssignTag(sale, t.Tag));

            TempData.Add("StatusMessage", "Lead converted");

            return(RedirectToAction("Index", "Sale"));
        }
Beispiel #22
0
 public void Remove(LeadType entity)
 {
     _context.Remove(entity);
     //_context.SaveChanges();
 }
Beispiel #23
0
 /// <summary>
 /// Constructor to make a SCP statement.
 /// </summary>
 public SCPLeadMeasurements(LeadType lt, ushort nrMes)
 {
     LeadId = lt;
     Count  = nrMes;
 }
Beispiel #24
0
        public ActionResult Update(int id, LeadType type)
        {
            var lead = _leadService.GetByID(id);
            lead.Status = type;

            //write activity to the log
            _activityService.Create("status was updated", AreaType.Lead, User.Identity.Name, lead.ID);
            _leadService.Save(lead);

            return RedirectToAction("Index");
        }
Beispiel #25
0
        /// <summary>
        /// Function to make a fifteen leads signals object.
        /// </summary>
        /// <returns>returns fifteen leads signals object or null</returns>
        public Signals CalculateFifteenLeads()
        {
            LeadType[] lt1 = new LeadType[] { LeadType.I, LeadType.II, LeadType.III,
                                              LeadType.aVR, LeadType.aVL, LeadType.aVF,
                                              LeadType.V1, LeadType.V2, LeadType.V3,
                                              LeadType.V4, LeadType.V5, LeadType.V6,
                                              LeadType.V3R, LeadType.V4R, LeadType.V7 };
            LeadType[] lt2 = new LeadType[] { LeadType.I, LeadType.II, LeadType.III,
                                              LeadType.aVR, LeadType.aVL, LeadType.aVF,
                                              LeadType.V1, LeadType.V2, LeadType.V3,
                                              LeadType.V4, LeadType.V5, LeadType.V6,
                                              LeadType.V7, LeadType.V8, LeadType.V9 };

            int nrSim = NrSimultaneosly();

            if (nrSim != _Lead.Length)
            {
                return(null);
            }

            Signal[] leads = null;

            if (nrSim == lt1.Length)
            {
                ArrayList pos_list1 = new ArrayList(lt1);
                ArrayList pos_list2 = new ArrayList(lt2);

                int       check_one1 = 0;
                int       check_one2 = 0;
                ArrayList check_two1 = new ArrayList(lt1);
                ArrayList check_two2 = new ArrayList(lt2);
                Signal[]  pos1       = new Signal[lt1.Length];
                Signal[]  pos2       = new Signal[lt2.Length];

                for (int i = 0; i < nrSim; i++)
                {
                    if (_Lead[i].Type == lt1[i])
                    {
                        check_one1++;
                    }

                    if (_Lead[i].Type == lt2[i])
                    {
                        check_one2++;
                    }

                    int temp = check_two1.IndexOf(_Lead[i].Type);
                    if (temp >= 0)
                    {
                        check_two1.RemoveAt(temp);

                        pos1[pos_list1.IndexOf(_Lead[i].Type)] = _Lead[i];
                    }
                    temp = check_two2.IndexOf(_Lead[i].Type);
                    if (temp >= 0)
                    {
                        check_two2.RemoveAt(temp);

                        pos2[pos_list2.IndexOf(_Lead[i].Type)] = _Lead[i];
                    }
                }

                if (check_one1 == lt1.Length)
                {
                    return(this);
                }
                if (check_one2 == lt2.Length)
                {
                    return(this);
                }

                if (check_two1.Count == 0)
                {
                    for (int i = 0; i < pos1.Length; i++)
                    {
                        if (pos1[i] != null)
                        {
                            pos1[i] = pos1[i].Clone();
                        }
                    }

                    leads = pos1;
                }
                else if (check_two2.Count == 0)
                {
                    for (int i = 0; i < pos2.Length; i++)
                    {
                        if (pos2[i] != null)
                        {
                            pos2[i] = pos2[i].Clone();
                        }
                    }

                    leads = pos2;
                }
            }
            else
            {
                LeadType[] lt = null;

                short[][]
                tempRhythm = null,
                tempMedian = null;

                Signal[] pos = null;

                if (nrSim == 11)
                {
                    Signal[] pos1 = new Signal[lt1.Length];
                    Signal[] pos2 = new Signal[lt2.Length];

                    ArrayList pos_list1 = new ArrayList(lt1);
                    ArrayList pos_list2 = new ArrayList(lt2);

                    ArrayList check1 = new ArrayList(
                        new LeadType[] { LeadType.I, LeadType.II,
                                         LeadType.V1, LeadType.V2, LeadType.V3,
                                         LeadType.V4, LeadType.V5, LeadType.V6,
                                         LeadType.V7, LeadType.V3R, LeadType.V4R });

                    ArrayList check2 = new ArrayList(
                        new LeadType[] { LeadType.I, LeadType.II,
                                         LeadType.V1, LeadType.V2, LeadType.V3,
                                         LeadType.V4, LeadType.V5, LeadType.V6,
                                         LeadType.V7, LeadType.V8, LeadType.V9 });

                    for (int i = 0; i < nrSim; i++)
                    {
                        int temp = check1.IndexOf(_Lead[i].Type);
                        if (temp >= 0)
                        {
                            check1.RemoveAt(temp);

                            pos1[pos_list1.IndexOf(_Lead[i].Type)] = _Lead[i];
                        }
                        temp = check2.IndexOf(_Lead[i].Type);
                        if (temp >= 0)
                        {
                            check2.RemoveAt(temp);

                            pos2[pos_list2.IndexOf(_Lead[i].Type)] = _Lead[i];
                        }
                    }

                    if (check1.Count == 0)
                    {
                        pos = pos1;
                        lt  = lt1;
                    }
                    else if (check2.Count == 0)
                    {
                        pos = pos2;
                        lt  = lt2;
                    }

                    if (pos != null)
                    {
                        for (int i = 0; i < pos.Length; i++)
                        {
                            if (pos[i] != null)
                            {
                                pos[i] = pos[i].Clone();
                            }
                        }

                        tempRhythm    = new short[2][];
                        tempRhythm[0] = pos1[0].Rhythm;
                        tempRhythm[1] = pos1[1].Rhythm;

                        tempMedian    = new short[2][];
                        tempMedian[0] = pos1[0].Median;
                        tempMedian[1] = pos1[1].Median;
                    }
                }
                else if (nrSim == 12)
                {
                    Signal[] pos1 = new Signal[lt1.Length];
                    Signal[] pos2 = new Signal[lt2.Length];

                    ArrayList pos_list1 = new ArrayList(lt1);
                    ArrayList pos_list2 = new ArrayList(lt2);

                    ArrayList check1 = new ArrayList(
                        new LeadType[] { LeadType.I, LeadType.II, LeadType.III,
                                         LeadType.V1, LeadType.V2, LeadType.V3,
                                         LeadType.V4, LeadType.V5, LeadType.V6,
                                         LeadType.V7, LeadType.V3R, LeadType.V4R });

                    ArrayList check2 = new ArrayList(
                        new LeadType[] { LeadType.I, LeadType.II, LeadType.III,
                                         LeadType.V1, LeadType.V2, LeadType.V3,
                                         LeadType.V4, LeadType.V5, LeadType.V6,
                                         LeadType.V7, LeadType.V8, LeadType.V9 });

                    for (int i = 0; i < nrSim; i++)
                    {
                        int temp = check1.IndexOf(_Lead[i].Type);
                        if (temp >= 0)
                        {
                            check1.RemoveAt(temp);

                            pos1[pos_list1.IndexOf(_Lead[i].Type)] = _Lead[i];
                        }
                        temp = check2.IndexOf(_Lead[i].Type);
                        if (temp >= 0)
                        {
                            check2.RemoveAt(temp);

                            pos2[pos_list2.IndexOf(_Lead[i].Type)] = _Lead[i];
                        }
                    }

                    if (check1.Count == 0)
                    {
                        pos = pos1;
                        lt  = lt1;
                    }
                    else if (check2.Count == 0)
                    {
                        pos = pos2;
                        lt  = lt2;
                    }

                    if (pos != null)
                    {
                        for (int i = 0; i < pos.Length; i++)
                        {
                            if (pos[i] != null)
                            {
                                pos[i] = pos[i].Clone();
                            }
                        }

                        tempRhythm    = new short[3][];
                        tempRhythm[0] = pos[0].Rhythm;
                        tempRhythm[1] = pos[1].Rhythm;
                        tempRhythm[2] = pos[2].Rhythm;

                        tempMedian    = new short[3][];
                        tempMedian[0] = pos[0].Median;
                        tempMedian[1] = pos[1].Median;
                        tempMedian[2] = pos[2].Median;
                    }
                }

                if ((tempRhythm != null) ||
                    (tempMedian != null))
                {
                    short[][] calcLeads;

                    if ((tempRhythm != null) &&
                        (tempRhythm[0] != null) &&
                        ECGTool.CalculateLeads(tempRhythm, tempRhythm[0].Length, out calcLeads) == 0)
                    {
                        for (int i = 0; i < calcLeads.Length; i++)
                        {
                            Signal sig = new Signal();
                            sig.Type        = lt[i + tempRhythm.Length];
                            sig.RhythmStart = pos[0].RhythmStart;
                            sig.RhythmEnd   = pos[0].RhythmEnd;
                            sig.Rhythm      = calcLeads[i];

                            pos[i + tempRhythm.Length] = sig;
                        }

                        if ((tempMedian != null) &&
                            (tempMedian[0] != null) &&
                            (ECGTool.CalculateLeads(tempMedian, tempMedian[0].Length, out calcLeads) == 0))
                        {
                            for (int i = 0; i < calcLeads.Length; i++)
                            {
                                pos[i + tempRhythm.Length].Median = calcLeads[i];
                            }
                        }

                        leads = pos;
                    }
                }
            }

            if (leads != null)
            {
                Signals sigs = this.Clone();

                sigs.NrLeads = (byte)leads.Length;

                for (int i = 0; i < leads.Length; i++)
                {
                    sigs._Lead[i] = leads[i];
                }

                return(sigs);
            }

            return(null);
        }
Beispiel #26
0
 public void Add(LeadType entity)
 {
     _context.LeadTypes.Add(entity);
     //_context.SaveChanges();
 }
 public void Add(LeadType type)
 {
     _store.StoreAsync(type).Wait();
 }
        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="lead"></param>
        /// 
        /// <returns></returns>
        /// 
        public static ExchangeResponse SecurityViolation(LeadType lead)
        {
            ExchangeResponse response = new ExchangeResponse();
            response.aid = lead.Aid;
            response.amount = 0;
            response.cid = lead.Cid;
            response.guid = lead.Guid;
            response.matchcount = 0;
            response.status = SECURITY;
            response.tid = lead.Tid;

            List<Error> errors = new List<Error>();
            errors.Add(new Error(ExchangeValidator.Credentials, ExchangeValidator.credentialsErrorDesc));
            response.errors = errors;
            return response;
        }
 public void Remove(LeadType type)
 {
     _store.DeleteAsync(type.DocumentId).Wait();
 }
Beispiel #30
0
 public LeadMeasurement(LeadType lt)
 {
     LeadType = lt;
 }
Beispiel #31
0
            static LeadType NewUpgradeType()
            {
                var leadType = new LeadType(LeadTypes.UpgradeLeads);

                return(leadType);
            }
Beispiel #32
0
        public bool ResolveSignals(byte[] buffer, int offset, out Signals signals)
        {
            ClearItemList();
            BaseData.IsLittleEndian = false;
            ResolveResultCode result = ResolveResultCode.UNKNOWN_ERROR;

            while (offset < buffer.Length)
            {
                switch (buffer[offset])
                {
                case 0x00:
                    MWF_ZRO_00 MWF_ZRO_00 = new MWF_ZRO_00();
                    result = MWF_ZRO_00.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_ZRO_00.Add(MWF_ZRO_00);
                    }
                    break;

                case 0x01:
                    MWF_BLE_01 MWF_BLE_01 = new MWF_BLE_01();
                    result = MWF_BLE_01.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_BLE_01.Add(MWF_BLE_01);
                    }
                    break;

                case 0x02:
                    MWF_VER_02 MWF_VER_02 = new MWF_VER_02();
                    result = MWF_VER_02.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_VER_02.Add(MWF_VER_02);
                    }
                    break;

                case 0x03:
                    MWF_TXC_03 MWF_TXC_03 = new MWF_TXC_03();
                    result = MWF_TXC_03.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_TXC_03.Add(MWF_TXC_03);
                    }
                    break;

                case 0x04:
                    MWF_BLK_04 MWF_BLK_04 = new MWF_BLK_04();
                    result = MWF_BLK_04.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_BLK_04.Add(MWF_BLK_04);
                    }
                    break;

                case 0x05:
                    MWF_CHN_05 MWF_CHN_05 = new MWF_CHN_05();
                    result = MWF_CHN_05.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_CHN_05.Add(MWF_CHN_05);
                    }
                    break;

                case 0x06:
                    MWF_SEQ_06 MWF_SEQ_06 = new MWF_SEQ_06();
                    result = MWF_SEQ_06.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_SEQ_06.Add(MWF_SEQ_06);
                    }
                    break;

                case 0x07:
                    MWF_PNT_07 MWF_PNT_07 = new MWF_PNT_07();
                    result = MWF_PNT_07.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_PNT_07.Add(MWF_PNT_07);
                    }
                    break;

                case 0x08:
                    MWF_WFM_08 MWF_WFM_08 = new MWF_WFM_08();
                    result = MWF_WFM_08.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_WFM_08.Add(MWF_WFM_08);
                    }
                    break;

                case 0x09:
                    MWF_LDN_09 MWF_LDN_09 = new MWF_LDN_09();
                    result = MWF_LDN_09.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_LDN_09.Add(MWF_LDN_09);
                    }
                    break;

                case 0x0A:
                    MWF_DTP_0A MWF_DTP_0A = new MWF_DTP_0A();
                    result = MWF_DTP_0A.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_DTP_0A.Add(MWF_DTP_0A);
                    }
                    break;

                case 0x0B:
                    MWF_IVL_0B MWF_IVL_0B = new MWF_IVL_0B();
                    result = MWF_IVL_0B.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_IVL_0B.Add(MWF_IVL_0B);
                    }
                    break;

                case 0x0C:
                    MWF_SEN_0C MWF_SEN_0C = new MWF_SEN_0C();
                    result = MWF_SEN_0C.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_SEN_0C.Add(MWF_SEN_0C);
                    }
                    break;

                case 0x0D:
                    MWF_OFF_0D MWF_OFF_0D = new MWF_OFF_0D();
                    result = MWF_OFF_0D.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_OFF_0D.Add(MWF_OFF_0D);
                    }
                    break;

                case 0x0E:
                    MWF_CMP_0E MWF_CMP_0E = new MWF_CMP_0E();
                    result = MWF_CMP_0E.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_CMP_0E.Add(MWF_CMP_0E);
                    }
                    break;

                case 0x0F:
                    MWF_IPD_OF MWF_IPD_OF = new MWF_IPD_OF();
                    result = MWF_IPD_OF.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_IPD_OF.Add(MWF_IPD_OF);
                    }
                    break;

                case 0x11:
                    MWF_FLT_11 MWF_FLT_11 = new MWF_FLT_11();
                    result = MWF_FLT_11.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_FLT_11.Add(MWF_FLT_11);
                    }
                    break;

                case 0x12:
                    MWF_NUL_12 MWF_NUL_12 = new MWF_NUL_12();
                    result = MWF_NUL_12.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_NUL_12.Add(MWF_NUL_12);
                    }
                    break;

                case 0x15:
                    MWF_INF_15 MWF_INF_15 = new MWF_INF_15();
                    result = MWF_INF_15.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_INF_15.Add(MWF_INF_15);
                    }
                    break;

                case 0x16:
                    MWF_NTE_16 MWF_NTE_16 = new MWF_NTE_16();
                    result = MWF_NTE_16.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_NTE_16.Add(MWF_NTE_16);
                    }
                    break;

                case 0x17:
                    MWF_MAN_17 MWF_MAN_17 = new MWF_MAN_17();
                    result = MWF_MAN_17.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_MAN_17.Add(MWF_MAN_17);
                    }
                    break;

                case 0x1E:
                    MWF_WAV_1E MWF_WAV_1E = null;
                    if (_MWF_DTP_0A.Count > 0)
                    {
                        MWF_WAV_1E = new MWF_WAV_1E(_MWF_DTP_0A[_MWF_DTP_0A.Count - 1].Content);
                    }
                    else
                    {
                        MWF_WAV_1E = new MWF_WAV_1E(DataType.Int16);
                    }
                    result = MWF_WAV_1E.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_WAV_1E.Add(MWF_WAV_1E);
                    }
                    break;

                case 0x3F:
                    MWF_ATT_3F att = new MWF_ATT_3F();
                    result = att.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_ATT_3F.Add(att);
                    }
                    break;

                default:
                    MWF_NORMAL_FF MWF_NORMAL_FF = new MWF_NORMAL_FF();
                    result = MWF_NORMAL_FF.Resolve(buffer, ref offset);
                    if (result == ResolveResultCode.SUCCESS)
                    {
                        _MWF_NORMAL_FF.Add(MWF_NORMAL_FF);
                    }
                    break;
                }
            }
            if (result == ResolveResultCode.SUCCESS)
            {
                if (_MWF_WAV_1E.Count > 0 &&
                    _MWF_IVL_0B.Count > 0 &&
                    _MWF_SEN_0C.Count > 0 &&
                    _MWF_BLK_04.Count > 0 &&
                    _MWF_SEQ_06.Count > 0)
                {
                    byte       iLeadNumber   = (byte)_MWF_CHN_05[0].Content;
                    int        iRhythmLength = (int)(_MWF_WAV_1E[0].Content.Length / _MWF_CHN_05[0].Content);
                    LeadType[] leadTypes     = new LeadType[iLeadNumber];
                    for (int i = 0; i < iLeadNumber; i++)
                    {
                        leadTypes[i] = (LeadType)Enum.Parse(typeof(LeadType), MFERdef.GetLeadName(_MWF_ATT_3F[i].Content.Content));
                    }
                    signals = new Signals();
                    signals.InitializeSignals(_MWF_IVL_0B[0].SamplesPerSecond, (float)_MWF_SEN_0C[0].AVM, leadTypes);
                    for (int i = 0; i < iLeadNumber; i++)
                    {
                        signals[i].Data = new float[iRhythmLength];
                        for (int j = 0; j < iRhythmLength; j++)
                        {
                            signals[i].Data[j] = _MWF_WAV_1E[0].Content[i * _MWF_BLK_04[0].Content + j];
                        }
                    }
                    return(true);
                }
            }
            signals = null;
            return(false);
        }
Beispiel #33
0
 protected virtual void PerformOCR(ref Lead lead, LeadType type)
 {
     return;
 }
Beispiel #34
0
        protected internal RPMLead(java.io.DataInputStream inputStream)
        {//throws IOException {
            if (logger.isLoggable(java.util.logging.Level.FINER))
            {
                logger.finer("Start Reading Lead");
            }

            try
            {
                int magic = inputStream.readUnsignedByte();
                check(magic == 0xED, "Lead magic 0x" + java.lang.Integer.toHexString(magic) + " != 0xED");
                magic = inputStream.readUnsignedByte();
                check(magic == 0xAB, "Lead magic 0x" + java.lang.Integer.toHexString(magic) + " != 0xAB");
                magic = inputStream.readUnsignedByte();
                check(magic == 0xEE, "Lead magic 0x" + java.lang.Integer.toHexString(magic) + " != 0xEE");
                magic = inputStream.readUnsignedByte();
                check(magic == 0xDB, "Lead magic 0x" + java.lang.Integer.toHexString(magic) + " != 0xDB");
                major = inputStream.readUnsignedByte();
                check(major < 5, "Major Number should be less than 5");

                if (logger.isLoggable(java.util.logging.Level.FINER))
                {
                    logger.finer("major: " + major);
                }

                minor = inputStream.readUnsignedByte();

                if (logger.isLoggable(java.util.logging.Level.FINER))
                {
                    logger.finer("minor: " + minor);
                }

                int uS = inputStream.readUnsignedShort();
                //LeadType lt;
                type = LeadType.getLeadType(uS);
                //type = LeadType.getLeadType(inputStream.readUnsignedShort());

                if (logger.isLoggable(java.util.logging.Level.FINER))
                {
                    logger.finer("type: " + type.getName());
                }
                arch = LeadArchitecture.getLeadArchitecture(inputStream.readUnsignedShort());

                if (logger.isLoggable(java.util.logging.Level.FINER))
                {
                    logger.finer("arch: " + arch.getName());
                }

                byte[] nameBuf = new byte[66];

                inputStream.readFully(nameBuf);
                name = RPMUtil.cArrayToString(nameBuf, 0);

                if (logger.isLoggable(java.util.logging.Level.FINER))
                {
                    logger.finer("name: " + name);
                }

                os = LeadOS.getLeadOS(inputStream.readUnsignedShort());

                if (logger.isLoggable(java.util.logging.Level.FINER))
                {
                    logger.finer("os: " + os.getName());
                }

                sigType = LeadSignature.getLeadSignature(inputStream.readUnsignedShort());

                if (logger.isLoggable(java.util.logging.Level.FINER))
                {
                    logger.finer("sigType: " + sigType.getName());
                }

                inputStream.skipBytes(16);

                check(!type.equals(LeadType.UNKNOWN), "Type is not specified");
                check(!sigType.equals(LeadType.UNKNOWN), "Signaturetype is not specified");
            }
            finally
            {
                if (logger.isLoggable(java.util.logging.Level.FINER))
                {
                    logger.finer("Finished Reading Lead");
                }
            }
        }