Inheritance: IReaction
Beispiel #1
0
    public bool loadPromoters(XmlNode node, LinkedList<IReaction> reactions)
    {
        XmlNodeList promotersList = node.SelectNodes("promoter");
        bool b = true;

        foreach (XmlNode promoter in promotersList)
          {
        Promoter p = new Promoter();
        foreach (XmlNode attr in promoter)
          {
            switch (attr.Name)
              {
              case "name":
                b = b && loadPromoterName(attr.InnerText, p);
                break;
              case "productionMax":
                b = b && loadPromoterProductionMax(attr.InnerText, p);
                break;
              case "terminatorFactor":
                b = b && loadPromoterTerminatorFactor(attr.InnerText, p);
                break;
              case "formula":
                b = b && loadPromoterFormula(attr.InnerText, p);
                break;
              case "operon":
                b = b && loadPromoterOperon(attr, p);
                break;
              }
          }
        reactions.AddLast(p);
          }
        return b;
    }
Beispiel #2
0
        public async Task CreateAsync(IndexPromoterViewModel model)
        {
            var promoter = new Promoter
            {
                GroupId     = model.GroupId,
                ProjectId   = model.ProjectId,
                FirstName   = model.FirstName,
                LastName    = model.LastName,
                Description = model.Description,
                Email       = model.Email,
                Gender      = model.Gender,
                Skills      = model.Skills,
                Mobile      = model.Mobile,
                Age         = model.Age,
                Language    = model.Language,
                ImageUrl    = model.ImageUrl,
                City        = model.City,
                District    = model.District,
            };

            foreach (var file in model.Gallery)
            {
                promoter.PromoterGalleries.Add(new PromoterGallery
                {
                    Name = file.Name,
                    Url  = file.Url,
                });
            }

            await this.promoteRepository.AddAsync(promoter);

            await this.promoteRepository.SaveChangesAsync();
        }
Beispiel #3
0
        public void TestElementWithParams()
        {
            var elem = new Dial(
                "number",
                new Uri("https://example.com"),
                Twilio.Http.HttpMethod.Get,
                1,
                true,
                1,
                "caller_id",
                Dial.RecordEnum.DoNotRecord,
                Dial.TrimEnum.TrimSilence,
                new Uri("https://example.com"),
                Twilio.Http.HttpMethod.Get,
                Promoter.ListOfOne(Dial.RecordingEventEnum.InProgress),
                true,
                Dial.RingToneEnum.At,
                Dial.RecordingTrackEnum.Both
                );

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Dial action=\"https://example.com\" method=\"GET\" timeout=\"1\" hangupOnStar=\"true\" timeLimit=\"1\" callerId=\"caller_id\" record=\"do-not-record\" trim=\"trim-silence\" recordingStatusCallback=\"https://example.com\" recordingStatusCallbackMethod=\"GET\" recordingStatusCallbackEvent=\"in-progress\" answerOnBridge=\"true\" ringTone=\"at\" recordingTrack=\"both\">number</Dial>",
                elem.ToString()
                );
        }
Beispiel #4
0
        private void AddOrUpdateEmployee(EKontoUser eKontoUser, EKadryEmployee eKadryEmployee, Institute institute)
        {
            Promoter promoter = _context.Promoters.Where(p => p.Id == eKadryEmployee.id).FirstOrDefault();

            if (promoter == null)
            {
                promoter = new Promoter
                {
                    Id          = eKadryEmployee.id,
                    InstituteId = institute.Id,
                    ExpectedNumberOfBachelorProposals = 0,
                    ExpectedNumberOfMasterProposals   = 0,
                    UserId = eKontoUser.id
                };
                _mapper.Map(eKontoUser, promoter);
                _mapper.Map(eKadryEmployee, promoter);
                _context.Promoters.Add(promoter);
            }
            else
            {
                _mapper.Map(eKontoUser, promoter);
                _mapper.Map(eKadryEmployee, promoter);
                promoter.InstituteId = institute.Id;
                _context.Promoters.Update(promoter);
            }
            _context.SaveChanges();
        }
Beispiel #5
0
        public static void PromotionMethod(List <Staff> ListOfTheStaff, Promoter IsPromotable) // Using the delegate to change the logic
        {
            //This App can Tell you if a member of your staff is promoted or not based on their experience and more.
            //to make the code below more effective re-usable, i decided to use delegate instead of harcoding.

            //foreach (Staff member in ListOfTheStaff)
            //{
            //    if (member.Experience > 5)

            //    {
            //        Console.WriteLine(member.Name + "Is promoted");
            //    }
            //    else
            //    {
            //        Console.WriteLine(member.Name + "Can not be promoted");
            //    }
            //}


            foreach (Staff member in ListOfTheStaff)
            {
                if (IsPromotable(member))

                {
                    Console.WriteLine(member.Name + " Is promoted");
                }
                else
                {
                    Console.WriteLine(member.Name + " Can not be promoted");
                }
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            string path = String.Format("{0}{1}{2}{3}{4}", "Log_", DateTime.Now.Month.ToString()
                                        , DateTime.Now.Day.ToString()
                                        , DateTime.Now.Year.ToString(), ".log");

            //  ChangeFilePath("MyRollingFileAppender", path);


            //XmlConfigurator.Configure();
            // log.Debug("Debug message");
            //log.Info("Info message");
            // log.Warn("Warning message");
            // log.Error("Error message");
            // log.Fatal("Fatal message");
            var             mobileNo = "whatsapp:+Number";
            var             url      = new Uri("URL");
            var             body     = "Hello There! Please find your receipt.";
            MessageResource result;

            try
            {
                //throw new Exception();

                result = SendWhatsAppMessagerAsync(mobileNo, body, Promoter.ListOfOne(url)).GetAwaiter().GetResult();
                log.Info(JsonConvert.SerializeObject(result));
            }
            catch (Exception ex) {
                log.Error(ex);
            }
        }
Beispiel #7
0
 public void CreateAndUpdatePromoter(AddPromotersDTO dto)
 {
     if (dto.PromoterId != 0)
     {
         var promoter = dBContext.Promoters.FirstOrDefault(x => x.Id == dto.PromoterId);
         if (promoter != null)
         {
             promoter.CompanyId     = dto.CompanyId;
             promoter.ContactNumber = dto.ContactNumber;
             promoter.Address       = dto.Address;
             promoter.EmailAddress  = dto.EmailAddress;
             promoter.PromoterName  = dto.PromoterName;
             dBContext.SaveChanges();
         }
     }
     else
     {
         var promoter = new Promoter()
         {
             CompanyId     = dto.CompanyId,
             ContactNumber = dto.ContactNumber,
             Address       = dto.Address,
             EmailAddress  = dto.EmailAddress,
             PromoterName  = dto.PromoterName
         };
         dBContext.Promoters.Add(promoter);
         dBContext.SaveChanges();
     }
 }
        public async Task <int> AddPromoter(Promoter Promoter)
        {
            db.Promoters.Add(Promoter);
            int result = await db.SaveChangesAsync();

            return(result);
        }
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var toBinding = new List <string> {
            JsonConvert.SerializeObject(new Dictionary <string, Object>()
            {
                { "binding_type", "sms" },
                { "address", "+1651000000000" }
            }, Formatting.Indented)
        };

        var notification = NotificationResource.Create(
            body: "Knok-Knok! This is your first Notify SMS",
            toBinding: toBinding,
            identity: Promoter.ListOfOne("Identity"),
            pathServiceSid: "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );

        Console.WriteLine(notification.Sid);
    }
Beispiel #10
0
        public ProjectTeaserModel GetNewTeaser(int projectid)
        {
            Teaser   teaser   = default(Teaser);
            Project  project  = ProjectRepository.Projects.SingleOrDefault(p => p.ProjectId == projectid);
            Company  company  = CompanyRepository.Companys.SingleOrDefault(c => c.CompanyId == project.CompanyId);
            Group    group    = GroupRepository.Groups.SingleOrDefault(g => g.GroupId == project.GroupId);
            Promoter promoter = PromoterRepository.GetPromoters().FirstOrDefault(p => p.CompanyId == company.CompanyId && p.IsMainPromoter == "Yes");

            if (promoter == default(Promoter))
            {
                promoter = PromoterRepository.GetPromoters().FirstOrDefault(p => p.CompanyId == company.CompanyId);
            }


            // Project project = ProjectRepository.Projects.FirstOrDefault(p => p.ProjectId == promoter.ProjectId);


            IList <Director>    directorslist    = DirectorRepository.GetDirectors().Where(d => d.CompanyId == company.CompanyId && d.DirectorType == DirectorType.Company.ToString()).ToList();
            IList <Shareholder> shareholderslist = ShareholderRepository.GetShareholders().Where(s => s.CompanyId == company.CompanyId && (s.ShareholderType == ShareholderType.Company.ToString() || s.ShareholderType == ShareholderType.Others.ToString())).ToList();


            ProjectTeaserModel ptmodel = new ProjectTeaserModel(project, company, group, promoter, teaser, directorslist, shareholderslist);

            return(ptmodel);
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            var uris = new List <Uri>();

            uris.Add(new Uri("URL"));

            // Find your Account Sid and Token at twilio.com/console
            const string accountSid = "";
            const string authToken  = "";


            TwilioClient.Init(accountSid, authToken);

            var message = MessageResource.Create(
                body: "Hello there! Please find your receipt",
                from: new Twilio.Types.PhoneNumber("whatsapp:+Number"),
                to: new Twilio.Types.PhoneNumber("whatsapp:+Number"),
                mediaUrl: Promoter.ListOfOne(new Uri("URL"))

                );

            Console.WriteLine(message);
            Console.WriteLine(message.Sid);
            Console.ReadKey();
        }
Beispiel #12
0
        /// <summary>
        /// </summary>
        /// <param name="regId"></param>
        /// <returns></returns>
        public Promoter GetModel(int regId)
        {
            var strSql = new StringBuilder();

            strSql.Append("select  top 1 PromId,RegId,PID,Prices from PromotionUser ");
            strSql.Append(" where RegId=@RegId ");
            SqlParameter[] parameters = { new SqlParameter("@RegId", SqlDbType.Int, 4) };
            parameters[0].Value = regId;
            var     model = new Promoter();
            DataSet ds    = DataBase.ExecuteDataset(CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PromId"].ToString() != "")
                {
                    model.PromId = int.Parse(ds.Tables[0].Rows[0]["PromId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["RegId"].ToString() != "")
                {
                    model.RegId = int.Parse(ds.Tables[0].Rows[0]["RegId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PID"].ToString() != "")
                {
                    model.PID = int.Parse(ds.Tables[0].Rows[0]["PID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Prices"].ToString() != "")
                {
                    model.Prices = decimal.Parse(ds.Tables[0].Rows[0]["Prices"].ToString());
                }
                return(model);
            }
            return(model);
        }
Beispiel #13
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var apn = new Dictionary <string, Object>()
        {
            { "aps", new Dictionary <string, Object>()
              {
                  { "alert", new Dictionary <string, Object>()
                    {
                        { "title", "Bob alert" },
                        { "body", "Bob, you just received a badge" }
                    } },
                  { "badge", 1 }
              } }
        };

        var notification = NotificationResource.Create(
            apn: apn,
            identity: Promoter.ListOfOne("00000001"),
            pathServiceSid: "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
            );

        Console.WriteLine(notification.Sid);
    }
        public void TestCreateRequest()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();
            var request          = new Request(
                HttpMethod.Post,
                Twilio.Rest.Domain.Preview,
                "/HostedNumbers/AuthorizationDocuments",
                ""
                );

            request.AddPostParam("HostedNumberOrderSids", Serialize("HostedNumberOrderSids"));
            request.AddPostParam("AddressSid", Serialize("ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"));
            request.AddPostParam("Email", Serialize("Email"));
            request.AddPostParam("ContactTitle", Serialize("ContactTitle"));
            request.AddPostParam("ContactPhoneNumber", Serialize("ContactPhoneNumber"));
            twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content"));

            try
            {
                AuthorizationDocumentResource.Create(Promoter.ListOfOne("HostedNumberOrderSids"), "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "Email", "ContactTitle", "ContactPhoneNumber", client: twilioRestClient);
                Assert.Fail("Expected TwilioException to be thrown for 500");
            }
            catch (ApiException) {}
            twilioRestClient.Received().Request(request);
        }
        public void TestElementWithParams()
        {
            var elem = new Conference(
                "name",
                true,
                Conference.BeepEnum.True,
                true,
                true,
                new Uri("https://example.com"),
                Twilio.Http.HttpMethod.Get,
                1,
                Conference.RecordEnum.DoNotRecord,
                Conference.RegionEnum.Us1,
                "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                Conference.TrimEnum.TrimSilence,
                Promoter.ListOfOne(Conference.EventEnum.Start),
                new Uri("https://example.com"),
                Twilio.Http.HttpMethod.Get,
                new Uri("https://example.com"),
                Twilio.Http.HttpMethod.Get,
                Promoter.ListOfOne(Conference.RecordingEventEnum.Started),
                new Uri("https://example.com")
                );

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Conference muted=\"true\" beep=\"true\" startConferenceOnEnter=\"true\" endConferenceOnExit=\"true\" waitUrl=\"https://example.com\" waitMethod=\"GET\" maxParticipants=\"1\" record=\"do-not-record\" region=\"us1\" whisper=\"CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\" trim=\"trim-silence\" statusCallbackEvent=\"start\" statusCallback=\"https://example.com\" statusCallbackMethod=\"GET\" recordingStatusCallback=\"https://example.com\" recordingStatusCallbackMethod=\"GET\" recordingStatusCallbackEvent=\"started\" eventCallbackUrl=\"https://example.com\">name</Conference>",
                elem.ToString()
                );
        }
        public async Task <IActionResult> Put([FromRoute] int id, [FromBody] Promoter promoter)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != promoter.Id)
            {
                return(BadRequest());
            }

            promoter.ModifiedUserId = Convert.ToInt32(((ClaimsIdentity)HttpContext.User.Identity).FindFirst(ClaimTypes.Sid).Value);
            promoter.ModifiedDate   = DateTime.Now;

            _context.Entry(promoter).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Exists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok(promoter));
        }
Beispiel #17
0
        public void TestElementWithParams()
        {
            var elem = new Pay(
                Pay.InputEnum.Dtmf,
                new Uri("https://example.com"),
                new Uri("https://example.com"),
                Pay.StatusCallbackMethodEnum.Get,
                1,
                1,
                true,
                "postal_code",
                "payment_connector",
                Pay.TokenTypeEnum.OneTime,
                "charge_amount",
                Pay.CurrencyEnum.Usd,
                "description",
                Promoter.ListOfOne(Pay.ValidCardTypesEnum.Visa),
                Pay.LanguageEnum.DeDe
                );

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Pay input=\"dtmf\" action=\"https://example.com\" statusCallback=\"https://example.com\" statusCallbackMethod=\"GET\" timeout=\"1\" maxAttempts=\"1\" securityCode=\"true\" postalCode=\"postal_code\" paymentConnector=\"payment_connector\" tokenType=\"one-time\" chargeAmount=\"charge_amount\" currency=\"usd\" description=\"description\" validCardTypes=\"visa\" language=\"de-DE\"></Pay>",
                elem.ToString()
                );
        }
        public ProjectTeaserModel(Project project, Company company, Group group, Promoter promoter, Teaser teaser, IList <Director> directors, IList <Shareholder> shareholders)
        {
            ProjectId         = project.ProjectId;
            NameoftheCompany  = company.CompanyName;
            GroupName         = group.GroupName;
            OfficeAddress     = company.RegisteredAddress;
            IncorporationDate = project.IncorporationDate;
            CreditCompRating  = project.CreditCompRating;
            ProjectName       = project.ProjectName;
            Capacity_AC       = project.Capacity_AC; //Capacity_AC

            Capacity_DC     = project.Capacity_DC;
            PlantLocation   = project.PlantLocation;
            Planttype       = project.Planttype;
            Technology      = project.Technology;
            RequiredLand    = project.RequiredLand;
            EPCContractor   = project.EPCContractor;
            TermLoan        = project.TotalDebt;
            DTDTenure       = project.DTDTenure;
            RepaymentPeriod = project.RepaymentPeriod;
            Tariff          = project.Tariff;

            TotalCost           = project.TotalCost;
            OMContractor        = project.OMContractor;
            DebtEquityRatio     = project.DebtEquityRatio;
            PPADate             = project.PPADate;
            SCOD                = project.SCOD;
            CUF                 = project.CUF;
            IRR                 = project.IRR;
            MinDSCR             = project.MinDSCR;
            AvgDSCR             = project.AvgDSCR;
            ProjectTariffUnit   = project.ProjectTariffUnit;
            ProjectCapacityUnit = project.ProjectCapacityUnit;
            TeaserModel         = new Teasermodel(promoter, teaser, directors, shareholders);
        }
Beispiel #19
0
        public void TestElementWithParams()
        {
            var elem = new Gather(
                Promoter.ListOfOne(Gather.InputEnum.Dtmf),
                new Uri("https://example.com"),
                Twilio.Http.HttpMethod.Get,
                1,
                "speech_timeout",
                1,
                true,
                "finish_on_key",
                1,
                new Uri("https://example.com"),
                Twilio.Http.HttpMethod.Get,
                Gather.LanguageEnum.AfZa,
                "hints",
                true,
                true,
                true,
                Gather.SpeechModelEnum.Default,
                true
                );

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Gather input=\"dtmf\" action=\"https://example.com\" method=\"GET\" timeout=\"1\" speechTimeout=\"speech_timeout\" maxSpeechTime=\"1\" profanityFilter=\"true\" finishOnKey=\"finish_on_key\" numDigits=\"1\" partialResultCallback=\"https://example.com\" partialResultCallbackMethod=\"GET\" language=\"af-ZA\" hints=\"hints\" bargeIn=\"true\" debug=\"true\" actionOnEmptyResult=\"true\" speechModel=\"default\" enhanced=\"true\"></Gather>",
                elem.ToString()
                );
        }
Beispiel #20
0
        public IEnumerable <DirectorListModel> GetAllDirectors(int companyId)
        {
            List <DirectorListModel> directorlist = new List <DirectorListModel>();
            IEnumerable <Director>   directors    = DirectorRepository.Directors.Where(d => d.CompanyId == companyId);

            foreach (Director director in directors)
            {
                if (director.DirectorType == DirectorType.Promoter.ToString())
                {
                    Promoter promoter = PromoterRepository.Promoters.SingleOrDefault(p => p.PromoterId == director.DirectorPromoterId);
                    if (promoter != default(Promoter))
                    {
                        directorlist.Add(new DirectorListModel
                        {
                            DirectorId         = director.DirectorId,
                            CompanyId          = director.CompanyId,
                            DirectorType       = director.DirectorType,
                            DirectorPromoterId = director.DirectorPromoterId,
                            CompanyName        = default(string),
                            PromoterName       = promoter.Name,
                            Name           = director.Name,
                            Address        = director.Address,
                            DIN            = director.DIN,
                            PAN            = director.PAN,
                            Qualification  = director.Qualification,
                            ExpRelSector   = director.ExpRelSector,
                            CompSharehold  = director.CompSharehold,
                            IsMainDirector = director.IsMainDirector,
                            CreatedDate    = director.CreatedDate,
                            CreatedBy      = director.CreatedBy
                        });
                    }
                }
                else
                {
                    Company company = CompanyRepository.Companys.SingleOrDefault(c => c.CompanyId == director.CompanyId);
                    directorlist.Add(new DirectorListModel
                    {
                        DirectorId         = director.DirectorId,
                        CompanyId          = director.CompanyId,
                        DirectorType       = director.DirectorType,
                        DirectorPromoterId = director.DirectorPromoterId,
                        CompanyName        = company.CompanyName,
                        PromoterName       = default(string),
                        Name           = director.Name,
                        Address        = director.Address,
                        DIN            = director.DIN,
                        PAN            = director.PAN,
                        Qualification  = director.Qualification,
                        ExpRelSector   = director.ExpRelSector,
                        CompSharehold  = director.CompSharehold,
                        IsMainDirector = director.IsMainDirector,
                        CreatedDate    = director.CreatedDate,
                        CreatedBy      = director.CreatedBy
                    });
                }
            }
            return(directorlist);
        }
        private async void Start()
        {
            Debug.Log($"=> {nameof(IPromoter.Initialize)}Promoter");

            await Promoter.InitializeAsync();

            LogAdvertisements();
        }
 public IHttpActionResult PostPromoter(Promoter promoter)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest("Not a valid model"));
     }
     Task.Run(async() => await _promoter.AddPromoter(promoter));
     return(Ok("Added successfully"));
 }
        public static Promoter AddPromoter(ISession dbSession)
        {
            var newItem = new Promoter();

            newItem.Name  = $"Тестовый пользователь";
            newItem.Login = $"login_{Guid.NewGuid().ToString().Replace("-", "").Substring(0, 5)}";
            dbSession.Save(newItem);
            return(newItem);
        }
        public async Task <int> DeletePromoter(int promoterid)
        {
            Promoter Promoter = await FetchbyPromoterId(promoterid);

            db.Promoters.Remove(Promoter);
            int result = await db.SaveChangesAsync();

            return(result);
        }
Beispiel #25
0
        public IEnumerable <ShareholderListModel> GetAllShareholders(int companyId)
        {
            List <ShareholderListModel> shareholderlist = new List <ShareholderListModel>();
            IEnumerable <Shareholder>   shareholders    = ShareholderRepository.Shareholders.Where(d => d.CompanyId == companyId);

            foreach (Shareholder shareholder in shareholders)
            {
                if (shareholder.ShareholderType == ShareholderType.Promoter.ToString())
                {
                    Promoter promoter = PromoterRepository.Promoters.SingleOrDefault(p => p.PromoterId == shareholder.ShareholderPromoterId);
                    if (promoter != default(Promoter))
                    {
                        shareholderlist.Add(new ShareholderListModel
                        {
                            ShareholderId         = shareholder.ShareholderId,
                            ShareholderType       = shareholder.ShareholderType,
                            CompanyId             = shareholder.CompanyId,
                            CompanyName           = default(string),
                            ShareholderPromoterId = shareholder.ShareholderPromoterId,
                            PromoterName          = promoter.Name,
                            Name              = shareholder.Name,
                            Share             = shareholder.Share,
                            FaceValue         = shareholder.FaceValue,
                            Percentage        = shareholder.Percentage,
                            IsMainShareholder = shareholder.IsMainShareholder,
                            CreatedDate       = shareholder.CreatedDate,
                            CreatedBy         = shareholder.CreatedBy
                        });
                    }
                }
                else
                {
                    Company company = CompanyRepository.Companys.SingleOrDefault(c => c.CompanyId == shareholder.CompanyId);
                    if (company != default(Company))
                    {
                        shareholderlist.Add(new ShareholderListModel
                        {
                            ShareholderId         = shareholder.ShareholderId,
                            ShareholderType       = shareholder.ShareholderType,
                            CompanyId             = shareholder.CompanyId,
                            CompanyName           = company.CompanyName,
                            ShareholderPromoterId = shareholder.ShareholderPromoterId,
                            PromoterName          = default(string),
                            Name              = shareholder.Name,
                            Share             = shareholder.Share,
                            FaceValue         = shareholder.FaceValue,
                            Percentage        = shareholder.Percentage,
                            IsMainShareholder = shareholder.IsMainShareholder,
                            CreatedDate       = shareholder.CreatedDate,
                            CreatedBy         = shareholder.CreatedBy
                        });
                    }
                }
            }
            return(shareholderlist);
        }
        public async Task <int> UpdatePromoter(Promoter Promoter)
        {
            Promoter existingPromoter = await FetchbyPromoterId(Promoter.PromoterId);

            db.Entry(existingPromoter).State = EntityState.Detached;
            db.Entry(Promoter).State         = EntityState.Modified;
            int result = await db.SaveChangesAsync();

            return(result);
        }
Beispiel #27
0
 private int CountSubmittedProposals(Promoter promoter, StudyLevel level)
 {
     if (promoter == null)
     {
         return(0);
     }
     return(promoter
            .Proposals
            .Count(p => p.Level == level));
 }
Beispiel #28
0
        private bool HasPermissionToCreateMasterProposal(Promoter promoter)
        {
            var numOfSubmittedProposals = CountSubmittedProposals(promoter, StudyLevel.Master);

            if (numOfSubmittedProposals < promoter.ExpectedNumberOfMasterProposals)
            {
                return(true);
            }
            return(false);
        }
        public Promoter GetPromoter(int?id)
        {
            if (id == null)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }
            Promoter promoter = _promoter.GetPromoter((int)id);

            return(promoter);
        }
Beispiel #30
0
        public async Task <PromoterCommandResponse> Handle(CreatePromoterCommand command)
        {
            await _promoterDomainService.CheckPromoterIsExist(command.NationalCode);

            var code     = _seqRepository.GetNextSequenceValue(SqNames.PromoterSequence);
            var promoter = new Promoter(Guid.NewGuid(), code, command.FirstName, command.LastName, command.NationalCode,
                                        command.MobileNumber);

            _repository.Add(promoter);
            return(new PromoterCommandResponse());
        }
Beispiel #31
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="promoter"></param>
 /// <returns></returns>
 public static int Insert(Promoter promoter)
 {
     try
     {
         return(dal.Insert(promoter));
     }
     catch (Exception ex)
     {
         ExceptionHandler.HandleException(ex);
         return(0);
     }
 }
Beispiel #32
0
    private bool loadPromoterFormula(string formula, Promoter p)
    {
        TreeNode<PromoterNodeData> tree = _parser.Parse(formula);

        if (tree == null)
          {
        Debug.Log("Syntax Error in promoter Formula");
        return false;
          }
        p.setFormula(tree);
        return true;
    }
Beispiel #33
0
    private bool loadGene(Promoter prom, string name, string RBSf)
    {
        Product gene = new Product();

        if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(RBSf))
          {
        Debug.Log("Error: Empty Gene name field");
        return false;
          }
        gene.setName(name);
        gene.setQuantityFactor(float.Parse(RBSf.Replace(",", ".")));
        prom.addProduct(gene);
        return true;
    }
Beispiel #34
0
 //! Copy constructor
 public Promoter(Promoter r)
     : base(r)
 {
     _terminatorFactor = r._terminatorFactor;
     _formula = r._formula;
     _beta = r._beta;
 }
 /*!
 \brief Load promoter energy cost by checking the validity of the given string
 \param value The given energy cost
 \param prom The Promoter reaction
 \return Return true if succed and false if value parameter is invalid.
    */
 private bool loadEnergyCost(string value, Promoter prom)
 {
     if (String.IsNullOrEmpty(value))
       {
     Debug.Log("Error: Empty EnergyCost field. default value = 0");
     prom.setEnergyCost(0f);
       }
     else
       prom.setEnergyCost(float.Parse(value.Replace(",", ".")));
     return true;
 }
 /*!
 \brief Load promoter name by checking the validity of the given string
 \param value The given name
 \param prom The Promoter reaction
 \return Return true if succed and false if value parameter is invalid.
    */
 private bool loadPromoterName(string value, Promoter prom)
 {
     if (String.IsNullOrEmpty(value))
       {
     Debug.Log("Error: Empty name field");
     return false;
       }
     prom.setName(value);
     return true;
 }
    /*!
    \brief Load promoter operon
    \param node the xml node
    \param prom The Promoter reaction
    \return Return true if succed and false if value parameter is invalid.
       */
    private bool loadPromoterOperon(XmlNode node, Promoter prom)
    {
        string name = null;
        string RBSf = null;
        bool n = false;
        bool rbsf = false;
        bool b = true;

        foreach (XmlNode gene in node)
          {
        n = false;
        rbsf = false;
        foreach(XmlNode attr in gene)
          {
            switch (attr.Name)
              {
              case "name":
                name = attr.InnerText;
                n = true;
                break;
              case "RBSFactor":
                RBSf = attr.InnerText;
                rbsf = true;
                break;
              }
          }
        if (n && rbsf)
          b = b && loadGene(prom, name, RBSf);
        if (!n)
          Debug.Log("Error : Missing Gene name in operon");
        if (!rbsf)
          Debug.Log("Error : Missing RBSfactor in operon");
          }
        return b;
    }
 /*!
 \brief Load promoter maximal production speed by checking the validity of the given string
 \param value The given maximal production
 \param prom The Promoter reaction
 \return Return true if succed and false if value parameter is invalid.
    */
 private bool loadPromoterProductionMax(string value, Promoter prom)
 {
     if (String.IsNullOrEmpty(value))
       {
     Debug.Log("Error: Empty productionMax field");
     return false;
       }
     prom.setBeta(float.Parse(value.Replace(",", ".")));
     return true;
 }
 /*!
 \brief Load promoter terminator factor by checking the validity of the given string
 \param value The given terminator factor
 \param prom The Promoter reaction
 \return Return true if succed and false if value parameter is invalid.
    */
 private bool loadPromoterTerminatorFactor(string value, Promoter prom)
 {
     if (String.IsNullOrEmpty(value))
       {
     Debug.Log("Error: Empty TerminatorFactor field");
     return false;
       }
     prom.setTerminatorFactor(float.Parse(value.Replace(",", ".")));
     return true;
 }
        /// <summary>
        /// 6/21/2012
        /// Links to Parts Registry pages and parses source code in order to obtain general information for a 
        /// particular part
        /// @ Nicole Francisco & Veronica Lin
        /// </summary>
        /// <param name="link">Particular extension of URL specific to this page</param>

        public RegDataSheet(string link)
        {
            _name = "";
            _type = "";
            _none = true;
            _terminator = new Terminators();
            _promoter = new Promoter();
            _rbs = new RBS();
            _gene = new Gene();
            _basicInfo = new BasicInfo();
            _description = new Description();
            //_protocol = new Protocol();
            _reference = new Reference();

            bool linkValid = true;

            #region HTML Web Request
            //the first link was set to -1 if no results showed up
            if (link.Equals("http://partsregistry.org/-1"))
            {
                linkValid = false;
            }

            if (linkValid)
            {
                try
                {

                    //Open a connection to PubMed publication page to get the information
                    Uri uri = new Uri(link);
                    // used to build entire input
                    StringBuilder sb = new StringBuilder();

                    // used on each read operation
                    byte[] buf = new byte[8192];

                    // prepare the web page we will be asking for
                    HttpWebRequest request =
                        (HttpWebRequest)WebRequest.Create(uri);

                    // execute the request
                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                    // we will read data via the response stream
                    Stream resStream = response.GetResponseStream();
                    string tempString = null;
                    int count = 0;

                    do
                    {
                        // fill the buffer with data
                        count = resStream.Read(buf, 0, buf.Length);

                        // make sure we read some data
                        if (count != 0)
                        {
                            // translate from bytes to ASCII text
                            tempString = Encoding.ASCII.GetString(buf, 0, count);

                            // continue building the string
                            sb.Append(tempString);
                        }
                    }
                    while (count > 0); // any more data to read?

            #endregion

                    String htmlText = sb.ToString(); //keep original to have objects parse through and find
                    //specific information
                    String tempText = sb.ToString(); //will be parsed through in this top-level method to find name and type of part
                    String sourceText = sb.ToString(); //will be parsed for sections of source code each class needs
                    int index = 0;
    

                    //find name of page
                    string pageTitle = "<h1 class='firstHeading'>"; //length: 25
                    string typeImg = "<img style='padding-top:0px' src='http://partsregistry.org/images/partbypart/icon_";
                    string partLead = "Part:";

                    //strings needed for each big class
                    string descriptionText = "";
                    string referenceText = "";

                    string categoriesBox = "";
                    string parametersBox = "";

                    if (sourceText.Contains("Designed by"))
                    {
                        index = sourceText.IndexOf("Designed by ");
                        sourceText = sourceText.Substring(index);
                        referenceText = sourceText.Substring(0, sourceText.IndexOf("</div>"));
                    }

                    if (sourceText.Contains("Assembly Compatibility:<UL>"))
                    {
                        index = sourceText.IndexOf("Assembly Compatibility:<UL>");
                        sourceText = sourceText.Substring(index);
                        descriptionText = sourceText.Substring(0, sourceText.IndexOf("<DIV id='reviews'>"));
                    }

                    if (sourceText.Contains("<div style='border:1px solid #aaa;'>"))
                    {
                        index = sourceText.IndexOf("<div style='border:1px solid #aaa;'>");
                        sourceText = sourceText.Substring(index);
                        categoriesBox = sourceText.Substring(0, sourceText.IndexOf("</div>"));
                    }

                    if (sourceText.Contains("<div id='parameters'>"))
                    {
                        index = sourceText.IndexOf("<div id='parameters'>");
                        sourceText = sourceText.Substring(index);
                        parametersBox = sourceText.Substring(0, sourceText.IndexOf("<!--"));
                    }

                    if (tempText.Contains(typeImg)) //checks if this page is a parts page
                    {
                        //Find type of the part
                        index = tempText.IndexOf(typeImg) + typeImg.Length;
                        tempText = tempText.Substring(index);
                        string temp = tempText.Substring(0, tempText.IndexOf("'>"));


                        //first case, where the type of the part is RBS
                        if (htmlText.Contains("rbs"))
                        {
                            //if (temp == "rbs.png" || htmlText.Contains("//rbs/prokaryote/regulated/issacs"))
                            //{
                                _type = "rbs";
                                _rbs = new RBS(categoriesBox);
                            //}
                            //Console.WriteLine("RBS!");
                        }
                        //second case, where the type of the part is promoter (different images for
                        //different types of promoters)
                        else if (htmlText.Contains("//promoter"))
                        {
                                _type = "promoter";
                                _promoter = new Promoter(categoriesBox + " " + parametersBox);
                                //Console.WriteLine("PROMOTER!");
                        
                        //if (temp == "regulatory.png" || temp == "reporter.png" ||
                        //    temp == "generator.png" || temp == "signalling.png" ||
                        //    temp == "intermediate.png" || temp == "composite.png")
                        //{
                            

                        }
                        //third case, where the type of the part is terminator
                        else if (temp == "terminator.png")
                        {
                            _type = "terminator";
                            _terminator = new Terminators(parametersBox);
                            //Console.WriteLine("TERMINATOR!");
                        }
                        //fourth case, where the type of the part is gene or protein coding sequence
                        else if (temp == "coding.png")
                        {
                            _type = "gene";
                            _gene = new Gene(categoriesBox);
                            //Console.WriteLine("GENE!");
                        }
                    }
                    //last case, where type of part is none of the 4 classified parts above
                    else
                    {
                        _none = false;
                    }

                    //Finding page title

                    //case where page is not a parts page
                    if (_none == false)
                    {
                        index = tempText.IndexOf("<h1 class=\"firstHeading\">") + "<h1 class=\"firstHeading\">".Length;
                        tempText = tempText.Substring(index);
                        _name = tempText.Substring(0, tempText.IndexOf("</h1>"));
                    }
                    //case where page is a parts page
                    else
                    {
                        index = tempText.IndexOf(pageTitle) + pageTitle.Length + partLead.Length;
                        tempText = tempText.Substring(index);
                        _name = tempText.Substring(0, tempText.IndexOf("</h1>"));
                    }

                    //string protocolLink = "http://partsregistry.org/cgi/partsdb/related.cgi?part=" + _name;

                    //if the page is a parts page
                    if (_none)
                    {
                        _basicInfo = new BasicInfo(htmlText, _type, _name);
                        //Console.WriteLine(_basicInfo); 
                        _description = new Description(descriptionText);
                        //Console.WriteLine(_description); 
                        //_protocol = new Protocol(protocolLink);
                        //Console.WriteLine(_protocol); 
                        _reference = new Reference(referenceText);
                        //Console.WriteLine(_reference); 
                    }

                    resStream.Close();
                    response.Close();
                }
                catch (Exception ex)
                {
                    Console.Write("Exception : " + ex.Message);
                }
            }
        }
 public RegDataSheet()
 {
     _name = "test";
     _type = "test";
     _none = true;
     _terminator = new Terminators();
     _promoter = new Promoter();
     _rbs = new RBS();
     _gene = new Gene();
     _basicInfo = new BasicInfo();
     _description = new Description();
     //_protocol = new Protocol();
     _reference = new Reference();
 }
Beispiel #42
0
    private float _terminatorFactor; //! Determine the fiability of the terminator (0-1 wich correspond to 0% to 100%)

    #endregion Fields

    #region Methods

    public static IReaction buildPromoterFromProps(PromoterProprieties props)
    {
        PromoterParser parser = new PromoterParser();
        Promoter reaction = new Promoter();

        reaction.setName(props.name);
        reaction.setBeta(props.beta);
        reaction.setTerminatorFactor(props.terminatorFactor);
        TreeNode<PromoterNodeData> formula = parser.Parse(props.formula);
        reaction.setFormula(formula);
        Product newProd;
        foreach (Product p in props.products)
          {
        newProd = new Product(p);
        reaction.addProduct(newProd);
          }
        return reaction;
    }