Esempio n. 1
0
 public vIndustryBusiness(Industry model)
 {
     DB db = new DB();
     this.ID = model.ID;
     this.IndustryName = model.IndustryName;
     this.Businesses = db.Businesses.Where(c => c.Industry == model.IndustryName).Take(6).ToList();
 }
Esempio n. 2
0
 public vIndustryGroup(Industry model)
 {
     DB db = new DB();
     this.ID = model.ID;
     this.IndustryName = model.IndustryName;
     this.UserGroups = db.UserGroups.Where(c => c.Industry == model.IndustryName).Take(6).ToList();
 }
Esempio n. 3
0
 public Stock(
     Code code,
     Symbol symbol,
     String name,
     Board board,
     Industry industry,
     double prevPrice,
     double openPrice,
     double lastPrice,
     double highPrice,
     double lowPrice,
     // TODO: CRITICAL LONG BUG REVISED NEEDED.
     long volume,
     double changePrice,
     double changePricePercentage,
     int lastVolume,
     double buyPrice,
     int buyQuantity,
     double sellPrice,
     int sellQuantity,
     double secondBuyPrice,
     int secondBuyQuantity,
     double secondSellPrice,
     int secondSellQuantity,
     double thirdBuyPrice,
     int thirdBuyQuantity,
     double thirdSellPrice,
     int thirdSellQuantity,
     SimpleDate calendar
     )
 {
     this.code = code;
     this.symbol = symbol;
     this.name = name;
     this.board = board;
     this.industry = industry;
     this.prevPrice = prevPrice;
     this.openPrice = openPrice;
     this.lastPrice = lastPrice;
     this.highPrice = highPrice;
     this.lowPrice = lowPrice;
     this.volume = volume;
     this.changePrice = changePrice;
     this.changePricePercentage = changePricePercentage;
     this.lastVolume = lastVolume;
     this.buyPrice = buyPrice;
     this.buyQuantity = buyQuantity;
     this.sellPrice = sellPrice;
     this.sellQuantity = sellQuantity;
     this.secondBuyPrice = secondBuyPrice;
     this.secondBuyQuantity = secondBuyQuantity;
     this.secondSellPrice = secondSellPrice;
     this.secondSellQuantity = secondSellQuantity;
     this.thirdBuyPrice = thirdBuyPrice;
     this.thirdBuyQuantity = thirdBuyQuantity;
     this.thirdSellPrice = thirdSellPrice;
     this.thirdSellQuantity = thirdSellQuantity;
     this.calendar = calendar;
 }
Esempio n. 4
0
        // GET: Industries/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Industry industry = db.Industries.Find(id);

            if (industry == null)
            {
                return(HttpNotFound());
            }
            return(View(industry));
        }
Esempio n. 5
0
        public void EmployerNewJobAdTestsInitialize()
        {
            Resolve <IDbConnectionFactory>().DeleteAllTestData();

            _previewButton = new HtmlButtonTester(Browser, "preview");
            _saveButton    = new HtmlButtonTester(Browser, "save");

            _publishButton = new HtmlButtonTester(Browser, "publish");
            _reopenButton  = new HtmlButtonTester(Browser, "reopen");
            _repostButton  = new HtmlButtonTester(Browser, "repost");
            _editButton    = new HtmlButtonTester(Browser, "edit");

            _titleTextBox                   = new HtmlTextBoxTester(Browser, "Title");
            _positionTitleTextBox           = new HtmlTextBoxTester(Browser, "PositionTitle");
            _externalReferenceIdTextBox     = new HtmlTextBoxTester(Browser, "ExternalReferenceId");
            _bulletPoint1TextBox            = new HtmlTextBoxTester(Browser, "BulletPoint1");
            _bulletPoint2TextBox            = new HtmlTextBoxTester(Browser, "BulletPoint2");
            _bulletPoint3TextBox            = new HtmlTextBoxTester(Browser, "BulletPoint3");
            _summaryTextBox                 = new HtmlTextAreaTester(Browser, "Summary");
            _contentTextBox                 = new HtmlTextAreaTester(Browser, "Content");
            _emailAddressTextBox            = new HtmlTextBoxTester(Browser, "EmailAddress");
            _secondaryEmailAddressesTextBox = new HtmlTextBoxTester(Browser, "SecondaryEmailAddresses");
            _phoneNumberTextBox             = new HtmlTextBoxTester(Browser, "PhoneNumber");
            _faxNumberTextBox               = new HtmlTextBoxTester(Browser, "FaxNumber");
            _countryIdDropDownList          = new HtmlDropDownListTester(Browser, "CountryId");
            _locationTextBox                = new HtmlTextBoxTester(Browser, "Location");
            _firstNameTextBox               = new HtmlTextBoxTester(Browser, "FirstName");
            _lastNameTextBox                = new HtmlTextBoxTester(Browser, "LastName");
            _salaryLowerBoundTextBox        = new HtmlTextBoxTester(Browser, "SalaryLowerBound");
            _salaryUpperBoundTextBox        = new HtmlTextBoxTester(Browser, "SalaryUpperBound");
            _packageTextBox                 = new HtmlTextBoxTester(Browser, "Package");
            _companyNameTextBox             = new HtmlTextBoxTester(Browser, "CompanyName");
            _hideCompanyCheckBox            = new HtmlCheckBoxTester(Browser, "HideCompany");
            _residencyRequiredCheckBox      = new HtmlCheckBoxTester(Browser, "ResidencyRequired");
            _industryIdsListBox             = new HtmlListBoxTester(Browser, "IndustryIds");
            _fullTimeCheckBox               = new HtmlCheckBoxTester(Browser, "FullTime");
            _partTimeCheckBox               = new HtmlCheckBoxTester(Browser, "PartTime");
            _contractCheckBox               = new HtmlCheckBoxTester(Browser, "Contract");
            _tempCheckBox                   = new HtmlCheckBoxTester(Browser, "Temp");
            _jobShareCheckBox               = new HtmlCheckBoxTester(Browser, "JobShare");
            _expiryTimeTextBox              = new HtmlTextBoxTester(Browser, "ExpiryTime");
            _hideContactDetailsCheckBox     = new HtmlCheckBoxTester(Browser, "HideContactDetails");

            _baseFeaturePack = new HtmlRadioButtonTester(Browser, "BaseFeaturePack");
            _featurePack1    = new HtmlRadioButtonTester(Browser, "FeaturePack1");
            _featurePack2    = new HtmlRadioButtonTester(Browser, "FeaturePack2");

            _accounting     = _industriesQuery.GetIndustry("Accounting");
            _administration = _industriesQuery.GetIndustry("Administration");
        }
        public IHttpActionResult DeleteIndustry(int id)
        {
            Industry industry = db.Industries.Find(id);

            if (industry == null)
            {
                return(NotFound());
            }

            db.Industries.Remove(industry);
            db.SaveChanges();

            return(Ok(industry));
        }
Esempio n. 7
0
        /// <summary>
        /// 编辑行业
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="description">描述</param>
        public static bool UpdateIndustry(string id, string name, string description)
        {
            bool flag = new IndustryDAL().UpdateIndustry(id, name, description);

            //处理缓存
            if (flag)
            {
                Industry industry = IndustryBusiness.Industrys.Find(m => m.IndustryID == id);
                industry.Name        = name;
                industry.Description = description;
            }

            return(flag);
        }
        private void InsertOrUpdateIndustry(string name, GlobalDataContext context)
        {
            var industry = context.Industries.SingleOrDefault(x => x.Name == name);

            if (industry == null)
            {
                industry = new Industry()
                {
                    Name = name
                };

                context.Industries.Add(industry);
            }
        }
Esempio n. 9
0
        // GET: Industries/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Industry industry = await db.Industrys.FindAsync(id);

            if (industry == null)
            {
                return(HttpNotFound());
            }
            return(View(industry));
        }
Esempio n. 10
0
 public ActionResult Edit([Bind(Include = "industries_id,industries_title,industries_content,industries_img,industries_url")] Industry industry)
 {
     if (!Check_Admin())
     {
         return(RedirectToAction("Index", "Login"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(industry).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(industry));
 }
Esempio n. 11
0
    private string FormattedIndustryString(Industry industry)
    {
        switch (industry)
        {
        case Industry.BanksAndFinance:
            return("Banks & Finance");

        case Industry.OilAndGas:
            return("Oil & Gas");

        default:
            return(industry.ToString());
        }
    }
Esempio n. 12
0
        public static bool BelongTo(this Industry industry, Industry upIndustry)
        {
            //未定义不包含任何其它地区
            if (upIndustry == Industry.无)
            {
                return(false);
            }

            if (upIndustry.IsIndustryCategory()) //行业分类
            {
                return((int)industry >= (int)upIndustry &&
                       (int)industry <= ((int)upIndustry | IndustryMask));
            }
            return(industry == upIndustry);
        }
Esempio n. 13
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Industry = await _context.Industries.FirstOrDefaultAsync(m => m.Id == id);

            if (Industry == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Esempio n. 14
0
        public static int updateIndustry(Industry industry)
        {
            DatabaseContext db             = new DatabaseContext();
            Industry        updateIndustry = db.Industrys.Single(x => x.IndustryId == industry.IndustryId);

            if (updateIndustry == null)
            {
                throw new ArgumentOutOfRangeException("Web Service");
            }

            db.Entry(updateIndustry).CurrentValues.SetValues(industry);  //更新实体
            int result = db.SaveChanges();

            return(result);
        }
Esempio n. 15
0
        // GET: Industries/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Industry industry = await db.Industrys.FindAsync(id);

            if (industry == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IndustryTypeID = new SelectList(db.IndustryTypes, "IndustryTypeID", "Type", industry.IndustryTypeID);
            return(View(industry));
        }
Esempio n. 16
0
        public async Task <ActionResult <bool> > EditIndustry(Industry industry)
        {
            if (!await _unitOfWork.MastersRepository.IndustryExistsById(industry.Id))
            {
                return(BadRequest());
            }

            _unitOfWork.MastersRepository.EditIndustry(industry);

            if (await _unitOfWork.Complete())
            {
                return(true);
            }
            return(BadRequest("Failed to update the industry name"));
        }
Esempio n. 17
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ImgUrl,IsDeleted,DeletedOn,CreatedOn,ModifiedOn")] Industry industry)
        {
            if (id != industry.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                await _industryServices.UpdateIndustry(industry.Id, industry.Name, industry.ImgUrl);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(industry));
        }
Esempio n. 18
0
 public List <Industry> lookingForJob(List <Industry> inds)
 {
     inds.Sort(new IndustrySortPerJob());
     foreach (Industry ind in inds)
     {
         // Debug.Log (this.name + " looking at " + ind.name + " //  available : " + ind.availableJobs);
         if (ind.availableJobs > 0 && ind.neededJob == this.type)
         {
             this.workplace = ind;
             ind.addPop(this);
             // Debug.Log (this.name + " found a job at " + ind.name);
             break;
         }
     }
     return(inds);
 }
Esempio n. 19
0
        public async Task Industry_ShouldCreateRecords(string name)
        {
            var type = new Industry {
                Name = name
            };

            await using var context = new NewsDbContext();

            var industry = await context.Industry.AddAsync(type);

            await context.SaveChangesAsync();

            Assert.True(industry.Entity.Id > 0);

            context.Industry.Remove(industry.Entity);
        }
        private bool IsAuthorizedToSellIndustry(string industryId, IUser user)
        {
            var userAma   = new User(_database.getJObjectAsync(user.Id.ToString(), "users").Result);
            var industry  = new Industry(_database.getJObjectAsync(industryId, "industries").Result);
            var companies = _companyService.findEmployee(user).Result.ToList();

            foreach (var x in companies)
            {
                if (x.id.Equals(industryId))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 21
0
 // GET: Department/Edit/5
 public ActionResult Edit(int id)
 {
     try
     {
         Industry industry = new Industry();
         using (var db = new TalentContext())
         {
             industry = db.Industries.Find(id);
         }
         return(View(industry));
     }
     catch
     {
         return(View("Error"));
     }
 }
Esempio n. 22
0
        public async Task IndustryListAsync()
        {
            Collection <string> IDs = await _dataBaseService.getIDs("industries");

            var embed = new EmbedBuilder().WithTitle("List of Industries").WithDescription("This is a list of all industries").WithColor(Color.Blue);

            foreach (string id in IDs)
            {
                Industry industry = new Industry(await _dataBaseService.getJObjectAsync(id, "industries"));

                EmbedFieldBuilder embedField = new EmbedFieldBuilder().WithName(industry.id).WithValue($"Resource Produced: {industry.Type}. Yearly output: {industry.MonthlyOutput}. Belongs to {industry.CompanyId} on planet {industry.Planet}.");
                embed.AddField(embedField);
            }

            await ReplyAsync("", false, embed.Build());
        }
 /// <summary>
 /// Mapping User Activity Log DTO to Action
 /// </summary>
 /// <param name="></param>
 /// <param name="></param>
 /// <returns></returns>
 public Industry MappingIndustryupdateDTOToIndustry(Industry industry, GradeUpdateDTO IndustryUpdateDTO)
 {
     #region Declare Return Var with Intial Value
     Industry Industry = industry;
     #endregion
     try
     {
         if (IndustryUpdateDTO.IndustryId > default(int))
         {
             Industry.IndustryId   = IndustryUpdateDTO.IndustryId;
             Industry.IndustryName = IndustryUpdateDTO.IndustryName;
         }
     }
     catch (Exception exception) {}
     return(Industry);
 }
        public async Task <Unit> Handle(CreateIndustryCommand request, CancellationToken cancellationToken)
        {
            var industry = new Industry
            {
                Name      = request.Name,
                Possition = request.Possition,
                CreatedOn = DateTime.UtcNow,
                IsDeleted = false
            };

            this.context.Industries.Add(industry);

            await this.context.SaveChangesAsync(cancellationToken);

            return(Unit.Value);
        }
Esempio n. 25
0
        public static int deleteIndustry(Industry industry)
        {
            // Industrys b = new Industrys() { IndustrysId = 2, FirstName = "a", LastName = "Tingting", Email = "zhangtingting.code@gmail", telephone = "1111111111", Role = "admin" };
            using (DatabaseContext db = new DatabaseContext())
            {
                var removeIndustry = db.Industrys.FirstOrDefault(row => row.IndustryId == industry.IndustryId);

                if (removeIndustry != null)
                {
                    db.Industrys.Remove(removeIndustry);
                }

                int result = db.SaveChanges();
                return(result);
            }
        }
Esempio n. 26
0
        private void Save(Industry entity)
        {
            entity.Name   = Name;
            entity.SortId = SortId;
            entity.Status = Status;

            if (entity.IndustryId == 0)
            {
                m_FTISService.CreateIndustry(entity);
            }
            else
            {
                m_FTISService.UpdateIndustry(entity);
            }

            LoadEntity(entity.IndustryId);
        }
Esempio n. 27
0
        public ActionResult Create([Bind(Include = "industries_id,industries_title,industries_content,industries_url")] Industry industry, HttpPostedFileBase industries_img)
        {
            if (ModelState.IsValid)
            {
                string file_name = DateTime.Now.ToString("MMddyyyyfffttHHssmm") + Path.GetFileName(industries_img.FileName);
                string file_path = Path.Combine(Server.MapPath("~/Uploads/"), file_name);
                industries_img.SaveAs(file_path);
                industry.industries_img = file_name;


                db.Industries.Add(industry);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(industry));
        }
Esempio n. 28
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Industry = await _context.Industries.FindAsync(id);

            if (Industry != null)
            {
                _context.Industries.Remove(Industry);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
 /// <summary>
 /// Mapping user Action Actitvity Log
 /// </summary>
 /// <param name="></param>
 /// <returns>Task<Industry></returns>
 public Industry MappingIndustryAddDTOToIndustry(GradeAddDTO IndustryAddDTO)
 {
     #region Declare a return type with initial value.
     Industry Industry = null;
     #endregion
     try
     {
         Industry = new Industry
         {
             IndustryName = IndustryAddDTO.IndustryName,
             CreationDate = DateTime.Now,
             IsDeleted    = (byte)DeleteStatusEnum.NotDeleted
         };
     }
     catch (Exception exception)  {}
     return(Industry);
 }
Esempio n. 30
0
 /// <summary>
 /// Maps and Industry Model from an existing Entity
 /// </summary>
 /// <param name="industry">The target Industry Entity</param>
 /// <returns>Industry Model</returns>
 public static IndustryModel MapModelFromEntity(Industry industry)
 {
     return(new IndustryModel
     {
         Id = industry.Id,
         Name = industry.Name,
         ImgUrl = industry.ImgUrl,
         CreatedOn = industry.CreatedOn,
         ModifiedOn = industry.ModifiedOn,
         IsDeleted = industry.IsDeleted,
         DeletedOn = industry.DeletedOn,
         Reports = industry.Reports.Select(r => ReportMapper.MapModelFromEntity(r)).ToList(),
         ReportsCount = industry.Reports.Count(),
         SubscriptionsCount = industry.SubscribedUsers.Count,
         SubscribedUsers = industry.SubscribedUsers.Select(ui => ui.User.Email)
     });
 }
        private static Industry ReadIndustry(XmlReader xmlReader)
        {
            var industry = new Industry();

            while (xmlReader.Read())
            {
                switch (xmlReader.NodeType)
                {
                case XmlNodeType.Element:
                    if (string.Compare(xmlReader.Name, "id", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        var readSubtree = xmlReader.ReadSubtree();
                        industry.Id = ReadText(readSubtree);
                        readSubtree.Close();
                    }
                    else if (string.Compare(xmlReader.Name, "name", StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        var readSubtree = xmlReader.ReadSubtree();
                        industry.Name = ReadText(readSubtree);
                        readSubtree.Close();
                    }
                    break;

                case XmlNodeType.Whitespace:
                    //not required for this implementation
                    break;

                case XmlNodeType.Text:
                    //not required for this implementation
                    break;

                case XmlNodeType.CDATA:
                    //not required for this implementation
                    break;

                case XmlNodeType.EntityReference:
                    //not required for this implementation
                    break;

                case XmlNodeType.EndElement:
                    //not required for this implementation
                    break;
                }
            }
            return(industry);
        }
Esempio n. 32
0
        public void ThenTheAddResultShouldBeAIndustryIdCheckExistsGetByIdEditAndDeleteWithHttpResponseReturns()
        {
            //did we get a good result
            Assert.IsTrue(_addItem != null && _addItem.Id > 0);

            //set the returned AddID to current Get
            _addedIdValue  = _addItem.Id;
            _getIdValue    = _addedIdValue;
            _existsIdValue = _getIdValue;

            //check that the item exists
            var itemReturned = Exists(_existsIdValue);

            Assert.IsTrue(itemReturned);

            //use the value used in exists check
            _getIdValue = _addItem.Id;
            Assert.IsTrue(_getIdValue == _addedIdValue);

            //pull the item by Id
            var resultGet = GetById <Industry>(_getIdValue);

            Assert.IsNotNull(resultGet);
            _getIdValue = resultGet.Id;
            Assert.IsTrue(_getIdValue == _addedIdValue);

            //Now, let's Edit the newly added item
            _editIdValue = _getIdValue;
            _editItem    = resultGet;
            Assert.IsTrue(_editIdValue == _addedIdValue);

            //do an update
            var updateResponse = Update(_editIdValue, _editItem);

            Assert.IsNotNull(updateResponse);

            //pass the item just updated
            _deletedIdValue = _editIdValue;
            Assert.IsTrue(_deletedIdValue == _addedIdValue);

            //delete this same item
            var deleteResponse = Delete(_deletedIdValue);

            Assert.IsNotNull(deleteResponse);
        }
        public IActionResult Update(UpdateCustomerModel model)
        {
            var customerResult = _customerRepository
                                 .GetById(model.Id)
                                 .ToResult("Customer with such Id is not found: " + model.Id);

            var industryResult = Industry.Get(model.Industry);
            var result         = Result.Combine(customerResult, industryResult);

            if (result.IsFailure)
            {
                return(Error(result.Error));
            }

            customerResult.Value.UpdateIndustry(industryResult.Value);

            return(Ok());
        }
        private static void IndustryChoiceAdapterPropertiesWork()
        {
            var re = new Industry();

            Assert.Null(re.Item);
            Assert.Null(re.ConstructionYear);
            re.ConstructionYear = 1900;
            Assert.Equal(1900, re.Item);
            Assert.Equal(1900, re.ConstructionYear);
            re.ConstructionYear = null;
            Assert.Null(re.ConstructionYear);
            Assert.True(re.ConstructionYearUnknown);
            re.ConstructionYearUnknown = true;
            Assert.IsType<bool>(re.Item);
            Assert.True((bool)re.Item);
            Assert.Null(re.ConstructionYear);

            Assert.Null(re.Item1);
            Assert.Null(re.HeatingType);
            Assert.Null(re.HeatingTypeEnev2014);
            re.HeatingType = HeatingType.STOVE_HEATING;
            Assert.IsType<HeatingType>(re.Item1);
            Assert.Equal(HeatingType.STOVE_HEATING, re.Item1);
            re.HeatingTypeEnev2014 = HeatingTypeEnev2014.FLOOR_HEATING;
            Assert.IsType<HeatingTypeEnev2014>(re.Item1);
            Assert.Equal(HeatingTypeEnev2014.FLOOR_HEATING, re.Item1);
            Assert.Null(re.HeatingType);

            Assert.Null(re.Item2);
            Assert.Null(re.FiringTypes);
            Assert.Null(re.EnergySourcesEnev2014);
            re.FiringTypes = new FiringTypes();
            Assert.IsType<FiringTypes>(re.Item2);
            Assert.Null(re.EnergySourcesEnev2014);
            re.EnergySourcesEnev2014 = new EnergySourcesEnev2014();
            Assert.IsType<EnergySourcesEnev2014>(re.Item2);
            Assert.Null(re.FiringTypes);
        }
 public virtual void DeleteIndustry(Industry entity)
 {
     entityDao.DeleteIndustry(entity);
 }
Esempio n. 36
0
 public AggregateResult( Dictionary<string, Dictionary<String, double?>> results, Industry industry = null )
 {
     Sector = new Result( );
     Industry = new Result( );
     Companies = new HashSet<Result>( );
     CompanyNames = new HashSet<string>( );
     IndustryInfo = industry;
     int i = 0;
     foreach ( KeyValuePair<string, Dictionary<string, double?>> kvp in results )
     {
         if ( i == 0 )
         {
             Sector = new Result( kvp.Key, kvp.Value, AggregateType.Sector );
             i++;
             if ( kvp.Key == "Conglomerates" ) // special case sector with no industry
             {
                 Industry = Sector;
                 i++;
             }
         }
         else if ( i == 1 )
         {
             Industry = new Result( kvp.Key, kvp.Value, AggregateType.Industry );
             i++;
         }
         else
         {
             var r = new Result( kvp.Key, kvp.Value, AggregateType.Company );
             Companies.Add( r );
             CompanyNames.Add( r.Name );
         }
     }
 }
Esempio n. 37
0
        public void SeedData()
        {
            var countries = new string[]
              {
                        "Afghanistan",
                        "Albania",
                        "Algeria",
                        "Argentina",
                        "Armenia",
                        "Australia",
                        "Austria",
                        "Azerbaijan",
                        "Bahamas",
                        "Bahrain",
                        "Bangladesh",
                        "Barbados",
                        "Belarus",
                        "Belgium",
                        "Bolivia",
                        "Bosnia and Herzegovina",
                        "Botswana",
                        "Bouvet Island",
                        "Brazil",
                        "Bulgaria",
                        "Cambodia",
                        "Canada",
                        "Chad",
                        "Chile",
                        "China",
                        "Colombia",
                        "Congo",
                        "Costa Rica",
                        "Croatia",
                        "Czech Republic",
                        "Denmark",
                        "Djibouti",
                        "Dominica",
                        "Dominican Republic",
                        "Ecuador",
                        "Egypt",
                        "Estonia",
                        "Ethiopia",
                        "Finland",
                        "France",
                        "Gabon",
                        "Gambia",
                        "Georgia",
                        "Germany",
                        "Ghana",
                        "Gibraltar",
                        "Greece",
                        "Greenland",
                        "Grenada",
                        "Guadeloupe",
                        "Guam",
                        "Guatemala",
                        "Guinea",
                        "Guyana",
                        "Haiti",
                        "Honduras",
                        "Hong Kong",
                        "Hungary",
                        "Iceland",
                        "India",
                        "Indonesia",
                        "Iraq",
                        "Ireland",
                        "Israel",
                        "Italy",
                        "Jamaica",
                        "Japan",
                        "Jordan",
                        "Kazakhstan",
                        "Kenya",
                        "Kyrgyzstan",
                        "Latvia",
                        "Lebanon",
                        "Lithuania",
                        "Luxembourg",
                        "Mexico",
                        "Monaco",
                        "Namibia",
                        "Nauru",
                        "Nepal",
                        "Netherlands",
                        "Netherlands Antilles",
                        "New Caledonia",
                        "New Zealand",
                        "Nicaragua",
                        "Niger",
                        "Nigeria",
                        "Niue",
                        "Norfolk Island",
                        "Northern Mariana Islands",
                        "Norway",
                        "Oman",
                        "Pakistan",
                        "Palau",
                        "Palestinian Territory, Occupied",
                        "Panama",
                        "Papua New Guinea",
                        "Paraguay",
                        "Peru",
                        "Philippines",
                        "Pitcairn",
                        "Poland",
                        "Portugal",
                        "Puerto Rico",
                        "Qatar",
                        "Reunion",
                        "Romania",
                        "Russia",
                        "Saudi Arabia",
                        "Serbia and Montenegro",
                        "Singapore",
                        "Slovenia",
                        "South Africa",
                        "Spain",
                        "Sri Lanka",
                        "Sudan",
                        "Sweden",
                        "Switzerland",
                        "Taiwan, Province of China",
                        "Tajikistan",
                        "Thailand",
                        "Togo",
                        "Trinidad and Tobago",
                        "Turkey",
                        "Turkmenistan",
                        "Uganda",
                        "Ukraine",
                        "United Arab Emirates",
                        "United Kingdom",
                        "United States",
                        "Uruguay",
                        "Uzbekistan",
                        "Vanuatu",
                        "Venezuela",
                        "Viet Nam",
                        "Zambia",
                        "Zimbabwe",
              };

            var industries = new string[]
            {
                    "Agriculture",
                    "Coatings & Adhesives",
                    "Environmental Sciences",
                    "Food Ingredients",
                    "Household & Industrial Cleaning",
                    "Mining",
                    "Oil & Gas",
                    "Personal Care",
                    "Pharma Ingredients",
                    "Water Treatment"
            };

            var hazards = new string[]
            {
                "Not Classified",
                "Explosives",
                "Gases",
                "Flammable Liquids",
                "Flammable Solids",
                "Oxidizing Substances",
                "Toxic & Infectious Substances",
                "Radioactive Material",
                "Corrosives",
                "Miscellaneous Dangerous Goods"
            };

            if (!this.context.Countries.Any())
            {
                foreach (var countryName in countries)
                {
                    var newCountry = new Country()
                    {
                        Name = countryName
                    };

                    this.context.Countries.Add(newCountry);
                }

                this.context.SaveChanges();
            }

            if (!this.context.Industries.Any())
            {
                foreach (var industryName in industries)
                {
                    var newIndustry = new Industry()
                    {
                        Name = industryName
                    };

                    this.context.Industries.Add(newIndustry);
                }

                this.context.SaveChanges();
            }

            if (!this.context.HazardClassifications.Any())
            {
                foreach (var hazard in hazards)
                {
                    var newHazard = new HazardClassification()
                    {
                        Class = hazard
                    };

                    this.context.HazardClassifications.Add(newHazard);
                }

                this.context.SaveChanges();
            }

            if (!this.context.TransportModes.Any())
            {
                var sea = new TransportMode()
                {
                    Mode = "sea freight"
                };

                var air = new TransportMode()
                {
                    Mode = "air freight"
                };

                this.context.TransportModes.Add(sea);
                this.context.TransportModes.Add(air);

                this.context.SaveChanges();
            }

            // Producers
            if (!this.context.Producers.Any())
            {
                var inputCountries = this.context.Countries.ToList();
                SeedProducers(inputCountries);
            }

            if (!this.context.Products.Any())
            {

                // Images
                var images = new List<Image>();
                var directory = AssemblyHelpers.GetDirectoryForAssembyl(Assembly.GetExecutingAssembly());
                var files = Directory.GetFiles(directory + "/Images/", "*.*");
                foreach (var file in files)
                {
                    var byteArray = File.ReadAllBytes(file);
                    var image = new Image
                    {
                        Content = byteArray,
                        FileExtension = file.Substring(file.LastIndexOf(".") + 1)
                    };

                    images.Add(image);
                }

                // Products
                var producers = this.context.Producers.ToList();
                var classifications = this.context.HazardClassifications.ToList();
                var industryType = this.context.Industries.ToList();
                var products = new List<Product>
            {
                new Product
                {
                     Name = "ACETIC ACID",
                     Description = "An organic compound with the chemical formula CH3COOH (also written as CH3CO2H or C2H4O2). It is a colourless liquid that when undiluted is also called glacial acetic acid. Vinegar is roughly 3–9% acetic acid by volume, making acetic acid the main component of vinegar apart from water. Acetic acid has a distinctive sour taste and pungent smell. Besides its production as household vinegar, it is mainly produced as a precursor to polyvinylacetate and cellulose acetate. Although it is classified as a weak acid, concentrated acetic acid is corrosive and can attack the skin.",
                     Price = 22.49M,
                     Quantity = 10M,
                     ProductType = ProductType.Liquid,
                     DateAdded = DateTime.Now
                },
                  new Product
                {
                     Name = "AMMONIUM BISULPHITE",
                     Description = "A white, crystalline solid with formula (NH4)HSO4. It is the product of the half-neutralization of sulfuric acid by ammonia.",
                     Price = 15.50M,
                     Quantity = 5M,
                     ProductType = ProductType.Powder,
                     DateAdded = DateTime.Now
                },
                new Product
                {
                     Name = "AMMONIUM CHLORIDE",
                     Description = "An inorganic compound with the formula NH4Cl, is a white crystalline salt, highly soluble in water. Solutions of ammonium chloride are mildly acidic. Sal ammoniac is a name of the natural, mineralogical form of ammonium chloride. The mineral is commonly formed on burning coal dumps, due to condensation of coal-derived gases. It is also found around some types of volcanic vents. It is mainly used as fertilizer and a flavouring agent in some types of liquorice. It is the product from the reaction of hydrochloric acid and ammonia.",
                     Price = 14.44M,
                     Quantity = 6M,
                     ProductType = ProductType.Powder,
                     DateAdded = DateTime.Now
                },
                new Product
                {
                     Name = "Baryte",
                     Description = "A mineral consisting of barium sulfate.The baryte group consists of baryte, celestine, anglesite and anhydrite. Baryte is generally white or colorless, and is the main source of barium. Baryte and celestine form a solid solution (Ba,Sr)SO4",
                     Price = 16.99M,
                     Quantity = 7M,
                     ProductType = ProductType.Powder,
                     DateAdded = DateTime.Now
                },
                 new Product
                {
                     Name = "HYDRATED ALUMINIUM SILICATE",
                     Description = "Aluminium silicate is a type of fibrous material made of aluminium oxide and silicon dioxide, (such materials are also called aluminosilicate fibres). These are glassy solid solutions rather than chemical compounds. The compositions are often described in terms of % weight of alumina, Al2O3 and silica, SiO2. Temperature resistance increases as the % alumina increases. These fibrous materials can be encountered as loose wool, blanket, felt, paper or boards.",
                     Price = 16.89M,
                     Quantity = 5.5M,
                     ProductType = ProductType.Powder,
                     DateAdded = DateTime.Now
                },
                 new Product
                {
                     Name = "CALCIUM CARBONATE",
                     Description = "A chemical compound with the formula CaCO3. It is a common substance found in rocks as the minerals calcite and aragonite (most notably as limestone), and is the main component of shells of marine organisms, snails, pearls, and eggshells. Calcium carbonate is the active ingredient in agricultural lime, and is created when calcium ions in hard water react with carbonate ions creating limescale. It is commonly used medicinally as a calcium supplement or as an antacid, but excessive consumption can be hazardous.",
                     Price = 16.89M,
                     Quantity = 6M,
                     ProductType = ProductType.Powder,
                     DateAdded = DateTime.Now
                },
                  new Product
                {
                     Name = "CITRIC ACID",
                     Description = "A weak organic tribasic acid. It occurs naturally in citrus fruits. In biochemistry, it is an intermediate in the citric acid cycle, which occurs in the metabolism of all aerobic organisms.More than a million tons of citric acid are manufactured every year. It is used widely as an acidifier, as a flavoring, and as a chelating agent.",
                     Price = 22M,
                     Quantity = 9M,
                     ProductType = ProductType.Liquid,
                     DateAdded = DateTime.Now
                },
                new Product
                {
                     Name = "CITRIC ACID",
                     Description = "A weak organic tribasic acid. It occurs naturally in citrus fruits. In biochemistry, it is an intermediate in the citric acid cycle, which occurs in the metabolism of all aerobic organisms.More than a million tons of citric acid are manufactured every year. It is used widely as an acidifier, as a flavoring, and as a chelating agent.",
                     Price = 22M,
                     Quantity = 9M,
                     ProductType = ProductType.Liquid,
                     DateAdded = DateTime.Now
                },
                new Product
                {
                     Name = "GLUTARALDEHYDE",
                     Description = "An organic compound with the formula CH2(CH2CHO)2. A pungent colorless oily liquid, glutaraldehyde is used to sterilise medical and dental equipment. It is also used for industrial water treatment and as a preservative. It is mainly available as an aqueous solution, and in these solutions the aldehyde groups are hydrated.",
                     Price = 23.99M,
                     Quantity = 8M,
                     ProductType = ProductType.Liquid,
                     DateAdded = DateTime.Now
                },
                new Product
                {
                     Name = "GLUTARALDEHYDE",
                     Description = "A clear, colorless, highly pungent solution of hydrogen chloride (HCl) in water. It is a highly corrosive, strong mineral acid with many industrial uses. Hydrochloric acid is found naturally in gastric acid. When it reacts with an organic base it forms a hydrochloride salt",
                     Price = 10.99M,
                     Quantity = 6M,
                     ProductType = ProductType.Liquid,
                     DateAdded = DateTime.Now
                },
                 new Product
                {
                     Name = "ISO-BUTANOL",
                     Description = "An organic compound with the formula (CH3)2CHCH2OH (sometimes represented as i-BuOH). This colorless, flammable liquid with a characteristic smell is mainly used as a solvent. Its isomers, the other butanols, include n-butanol, 2-butanol, and tert-butanol, all of which are important industrially.",
                     Price = 9.95M,
                     Quantity = 7M,
                     ProductType = ProductType.Liquid,
                     DateAdded = DateTime.Now
                },
                new Product
                {
                     Name = "Starch",
                     Description = "A carbohydrate consisting of a large number of glucose units joined by glycosidic bonds. This polysaccharide is produced by most green plants as an energy store. It is the most common carbohydrate in human diets and is contained in large amounts in staple foods such as potatoes, wheat, maize (corn), rice, and cassava. Pure starch is a white, tasteless and odorless powder that is insoluble in cold water or alcohol. It consists of two types of molecules: the linear and helical amylose and the branched amylopectin.Depending on the plant, starch generally contains 20 to 25 % amylose and 75 to 80 % amylopectin by weight.",
                     Price = 25M,
                     Quantity = 10M,
                     ProductType = ProductType.Powder,
                     DateAdded = DateTime.Now
                },
                 new Product
                {
                     Name = "SODIUM CHLORIDE",
                     Description = "An ionic compound with the chemical formula NaCl, representing a 1:1 ratio of sodium and chloride ions. Sodium chloride is the salt most responsible for the salinity of seawater and of the extracellular fluid of many multicellular organisms. In the form of edible or table salt it is commonly used as a condiment and food preservative. Large quantities of sodium chloride are used in many industrial processes, and it is a major source of sodium and chlorine compounds used as feedstocks for further chemical syntheses. A second major consumer of sodium chloride is de-icing of roadways in sub-freezing weather.",
                     Price = 21M,
                     Quantity = 10M,
                     ProductType = ProductType.Powder,
                     DateAdded = DateTime.Now
                }
            };

                for (int i = 0; i < products.Count; i++)
                {
                    products[i].ProducerId = producers[generator.Next(0, producers.Count())].Id;
                    products[i].HazardClassificationId = classifications[generator.Next(0, classifications.Count())].Id;
                    products[i].Industries.Add(industryType[generator.Next(0, industryType.Count())]);
                    products[i].Image = images[i];

                    this.context.Products.Add(products[i]);
                }

                this.context.SaveChanges();
            }
        }
Esempio n. 38
0
 // I didn't make this construcotr private. As I would like to make user able
 // to construct Stock either through this constructor or Builder.
 public Stock(Stock stock)
 {
     this.code = stock.code;
     this.symbol = stock.symbol;
     this.name = stock.name;
     this.board = stock.board;
     this.industry = stock.industry;
     this.prevPrice = stock.prevPrice;
     this.openPrice = stock.openPrice;
     this.lastPrice = stock.lastPrice;
     this.highPrice = stock.highPrice;
     this.lowPrice = stock.lowPrice;
     this.volume = stock.volume;
     this.changePrice = stock.changePrice;
     this.changePricePercentage = stock.changePricePercentage;
     this.lastVolume = stock.lastVolume;
     this.buyPrice = stock.buyPrice;
     this.buyQuantity = stock.buyQuantity;
     this.sellPrice = stock.sellPrice;
     this.sellQuantity = stock.sellQuantity;
     this.secondBuyPrice = stock.secondBuyPrice;
     this.secondBuyQuantity = stock.secondBuyQuantity;
     this.secondSellPrice = stock.secondSellPrice;
     this.secondSellQuantity = stock.secondSellQuantity;
     this.thirdBuyPrice = stock.thirdBuyPrice;
     this.thirdBuyQuantity = stock.thirdBuyQuantity;
     this.thirdSellPrice = stock.thirdSellPrice;
     this.thirdSellQuantity = stock.thirdSellQuantity;
     this.calendar = stock.calendar;
 }
Esempio n. 39
0
 /// <summary>
 /// 获取 [行业 的 父行业] 的 [行业] 集合
 /// </summary>
 public static List<Industry> GetParentID_Industrys(Zippy.Data.IDalProvider db, Industry entity)
 {
     if (entity.IndustryID.HasValue)
            return db.Take<Industry>("ParentID=@ParentID", db.CreateParameter("ParentID", entity.IndustryID));
     return new List<Industry>();
 }
Esempio n. 40
0
 /**
  * @param industry the industry to set
  */
 public Builder industry(Industry industry)
 {
     this._industry = industry;
     return this;
 }
Esempio n. 41
0
 public int Add(Industry industry)
 {
     this.industries.Add(industry);
     this.industries.SaveChanges();
     return industry.Id;
 }
Esempio n. 42
0
 public void Update(Industry industry, string name)
 {
     industry.Name = name;
     this.industries.SaveChanges();
 }
 /// <summary>
 /// Downloads all available company quotes of a special industry.
 /// </summary>
 /// <param name="industyID">The ID of the industry</param>
 /// <param name="rankedBy">The property the list is ranked by</param>
 /// <param name="rankDir">The direction of ranking</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public Base.Response<MarketQuotesResult> DownloadCompanyQuotes(Industry industyID, MarketQuoteProperty rankedBy = MarketQuoteProperty.Name, System.ComponentModel.ListSortDirection rankDir = System.ComponentModel.ListSortDirection.Ascending)
 {
     return this.Download(new MarketQuotesDownloadSettings() { Industry = industyID, RankedBy = rankedBy, RankDirection = rankDir });
 }
Esempio n. 44
0
 public static int Update(Zippy.Data.IDalProvider db, Industry entity)
 {
     return db.Update(entity);
 }
Esempio n. 45
0
 /// <summary>
 /// 表示 [父行业] 对应的实体
 /// </summary>
 public static Industry GetParentIDEntity(Zippy.Data.IDalProvider db, Industry entity)
 {
     return db.FindUnique<Industry>("IndustryID=@IndustryID", db.CreateParameter("IndustryID", entity.ParentID));
 }
 public virtual void CreateIndustry(Industry entity)
 {
     Create(entity);
 }
Esempio n. 47
0
 public static int Insert(Zippy.Data.IDalProvider db, Industry entity)
 {
     int rtn = db.Insert(entity);
     return rtn;
 }
 public virtual void UpdateIndustry(Industry entity)
 {
     Update(entity);
 }
Esempio n. 49
0
            public static AggregateResult Industry( Industry industry )
            {
                string requestURL = baseURL + industry.Value.ToString( ) + "coname" + 'u' + endURL;
                string qResult = string.Empty;

                try
                { // attempt a request...
                    qResult = client.DownloadString( requestURL );
                }
                catch
                { // if the request returns nothing, then the function will terminate here, returning an empty container
                    return new AggregateResult( );
                }

                // split the raw response string into an array of strings, which were expected to be delimited by '\n'
                string [] stringSeparator = new string [] { "\n" };
                var resultLines = qResult.Split( stringSeparator, StringSplitOptions.RemoveEmptyEntries );

                // parse/sanitize the header columns
                string [] columns = resultLines [ 0 ].Split( ',' );
                string [] cols = new string [ columns.Length - 1 ];
                for ( int i = 1; i < columns.Length; i++ )
                    cols [ i - 1 ] = columns [ i ].Replace( "\\", "" ).Replace( "\"", "" );

                Dictionary<string, Dictionary<string, double?>> results = new Dictionary<string, Dictionary<string, double?>>( );
                int offset = 0;

                // Map each row, identified by the company name, which is expected to be either in row[0] or in row[0], row[1], ... row[n]
                // and each column with its respective identifying column header
                // - for the column -> data mappings,
                for ( int i = 1; i < resultLines.Length - 1; i++ )
                {

                    var rows = resultLines [ i ].Replace( "\"", "" ).Replace( "\\", "" ).Split( ',' );

                    // offset is used to 'offset' company names that corrupt the expected format of the csv response
                    // , by setting this value to the number of csv 'columns' that a given iteration's
                    // result exceeds the expected amount
                    if ( rows.Length > 10 ) offset = rows.Length - 10;
                    else
                        offset = 0;

                    Dictionary<string, double?> industryData = new Dictionary<string, double?>( );

                    // % formatted cases: (1) 1-Day Price Chg % (2) ROE % (3) Div. Yield % (4) Net Profit Margin (mrq)
                    industryData.Add( cols [ 0 ].Replace( "\"", "" ).Replace( "\\", "" ), rows [ 1 + offset ] != "NA" ? Convert.ToDouble( rows [ 1 + offset ] ) / 100 : default( double? ) );
                    industryData.Add( cols [ 3 ].Replace( "\"", "" ).Replace( "\\", "" ), rows [ 4 + offset ] != "NA" ? Convert.ToDouble( rows [ 4 + offset ] ) / 100 : default( double? ) );
                    industryData.Add( cols [ 4 ].Replace( "\"", "" ).Replace( "\\", "" ), rows [ 5 + offset ] != "NA" ? Convert.ToDouble( rows [ 5 + offset ] ) / 100 : default( double? ) );
                    industryData.Add( cols [ 7 ].Replace( "\"", "" ).Replace( "\\", "" ), rows [ 8 + offset ] != "NA" ? Convert.ToDouble( rows [ 8 + offset ] ) / 100 : default( double? ) );
                    // standard numeric cases: (1) P/E (2) Debt to Equity (3) Price to Book (4) Price To Free Cash Flow (mrq)
                    industryData.Add( cols [ 2 ].Replace( "\"", "" ).Replace( "\\", "" ), rows [ 3 + offset ] != "NA" ? Convert.ToDouble( rows [ 3 + offset ] ) : default( double? ) );
                    industryData.Add( cols [ 5 ].Replace( "\"", "" ).Replace( "\\", "" ), rows [ 6 + offset ] != "NA" ? Convert.ToDouble( rows [ 6 + offset ] ) : default( double? ) );
                    industryData.Add( cols [ 6 ].Replace( "\"", "" ).Replace( "\\", "" ), rows [ 7 + offset ] != "NA" ? Convert.ToDouble( rows [ 7 + offset ] ) : default( double? ) );
                    industryData.Add( cols [ 8 ].Replace( "\"", "" ).Replace( "\\", "" ), rows [ 9 + offset ] != "NA" ? Convert.ToDouble( rows [ 9 + offset ] ) : default( double? ) );
                    // special numeric case: * Market Cap -- contains 'B" to represent a billion
                    if ( rows [ 2 ] != "NA" )
                    {
                        string tempValue = rows [ 2 + offset ].Substring( 0, rows [ 2 + offset ].Length - 1 );
                        if ( tempValue != "N" )
                            industryData.Add( cols [ 1 ], rows [ 2 ].Contains( "B" ) ? Convert.ToDouble( tempValue ) * billion : Convert.ToDouble( tempValue ) * million );
                    }
                    else
                    {
                        industryData.Add( cols [ 1 ], default( double? ) );
                    }

                    if ( offset == 0 )
                    {
                        if ( !results.ContainsKey( rows [ 0 ] ) )
                        {
                            results.Add( rows [ 0 ], industryData );
                        }
                    }
                    else
                    {
                        StringBuilder mysteryCompanyName = new StringBuilder( );
                        for ( int j = 0; j < offset; j++ )
                            mysteryCompanyName.Append( rows [ j ] );
                        if ( !results.ContainsKey( mysteryCompanyName.ToString( ) ) )
                            results.Add( mysteryCompanyName.ToString( ), industryData );
                    }
                }
                return new AggregateResult( results, industry );
            }
 public virtual void DeleteIndustry(Industry entity)
 {
     Delete(entity);
 }
        private static void IndustryChoiceAdapterPropertiesWork()
        {
            var re = new Industry();

            Assert.Null(re.Item);
            Assert.Null(re.ConstructionYear);
            re.ConstructionYear = 1900;
            Assert.Equal(1900, re.Item);
            Assert.Equal(1900, re.ConstructionYear);
            re.ConstructionYear = null;
            Assert.Null(re.ConstructionYear);
            Assert.True(re.ConstructionYearUnknown);
            re.ConstructionYearUnknown = true;
            Assert.IsType<bool>(re.Item);
            Assert.True((bool)re.Item);
            Assert.Null(re.ConstructionYear);
        }
Esempio n. 52
0
        static void LoadIndustries()
        {
            using(var session = GetStore().OpenSession())
            {
                var tech = new Industry { Id = "industries/tech", Name = "Technology" };
                var healthCare = new Industry { Id = "industries/health", Name = "Health Care" };
                var banking = new Industry { Id = "industries/bank", Name = "Banking" };
                var advertising = new Industry { Id = "industries/advert", Name = "Advertising" };
                var chemical = new Industry { Id = "industries/chem", Name = "Chemicals" };
                var natres = new Industry { Id = "industries/natres", Name = "Natural resources" };
                var industrial = new Industry { Id = "industries/industrial", Name = "Industrial" };
                var retail = new Industry { Id = "industries/retail", Name = "Retail" };
                var communication = new Industry { Id = "industries/comm", Name = "Communications" };

                session.Store(tech);
                session.Store(healthCare);
                session.Store(banking);
                session.Store(advertising);
                session.Store(chemical);
                session.Store(natres);
                session.Store(industrial);
                session.Store(retail);
                session.Store(communication);

                session.SaveChanges();
            }
        }
 public virtual void CreateIndustry(Industry entity)
 {
     entityDao.CreateIndustry(entity);
 }
    /// <summary>
    ///gets all the existing industries
    /// </summary>
    /// <returns> returen a list of industries</returns>
    public List<Industry> GetAllIndustries()
    {
        List<SqlParameter> paraList = new List<SqlParameter>();
        List<Industry> names = new List<Industry>();
        try
        {
            SqlDataReader dr = ActivateStoredProc("GetAllIndustries", paraList);
            while (dr.Read())
            {// Read till the end of the data into a row
                // read first field from the row into the list collection
                Industry n = new Industry();
                n.Name = dr["Name"].ToString();
                n.ID = Convert.ToInt32(dr["IndusryId"]);
                names.Add(n);
            }
        }
        catch (Exception ex)
        {
            // write to log
            throw (ex);

        }
        finally
        {
            closeConnection();
        }
        return names;
    }
Esempio n. 55
0
 public ActionResult SearchGys()
 {
     try
     {
         int skip = 1;
         if (!string.IsNullOrWhiteSpace(Request.QueryString["skip"]))
         {
             skip = int.Parse(Request.QueryString["skip"]);
         }
         string status = Request.QueryString["status"];//1、已入库供应商,2、待入库供应商
         string province = Request.QueryString["province"];
         string city = Request.QueryString["city"];
         string area = Request.QueryString["area"];
         string industry = Request.QueryString["factory"];
         string name = Request.QueryString["name"];
         IMongoQuery query = null;
         if (!string.IsNullOrWhiteSpace(province))
         {
             query = query.And(Query<供应商>.Matches(m => m.所属地域.省份, new BsonRegularExpression(string.Format("/{0}/i", province))));
         }
         if (!string.IsNullOrWhiteSpace(city))
         {
             query = query.And(Query<供应商>.Matches(m => m.所属地域.城市, new BsonRegularExpression(string.Format("/{0}/i", city))));
         }
         if (!string.IsNullOrWhiteSpace(area))
         {
             query = query.And(Query<供应商>.Matches(m => m.所属地域.区县, new BsonRegularExpression(string.Format("/{0}/i", area))));
         }
         if (!string.IsNullOrWhiteSpace(industry))
         {
             query = query.And(Query<供应商>.Matches(m => m.企业基本信息.所属行业, new BsonRegularExpression(string.Format("/{0}/i", industry))));
         }
         if (!string.IsNullOrWhiteSpace(name))
         {
             query = query.And(Query<供应商>.Matches(m => m.企业基本信息.企业名称, new BsonRegularExpression(string.Format("/{0}/i", name))));
         }
         if (status == "1")
         {
             query = query.And(Query<供应商>.Where(m => m.供应商用户信息.入库级别 == 供应商.入库级别.成都军区库 || m.供应商用户信息.入库级别 == 供应商.入库级别.全军库));
         }
         else if (status == "2")
         {
             query = query.And(Query<供应商>.Where(m =>m.入网审核数据.审核状态== 审核状态.审核通过&&m.审核数据.审核状态== 审核状态.审核通过&&m.供应商用户信息.入库级别 != 供应商.入库级别.成都军区库 && m.供应商用户信息.入库级别 != 供应商.入库级别.全军库));
         }
         else
         {
             query = query.And(Query<供应商>.Where(m => m.供应商用户信息.入库级别 == 供应商.入库级别.成都军区库 || m.供应商用户信息.入库级别 == 供应商.入库级别.全军库));
         }
         IEnumerable<供应商> user = 用户管理.查询用户<供应商>(20 * (skip - 1), 20,query);
         List<Industry> gys = new List<Industry>();
         foreach (var item in user)
         {
             Industry a = new Industry();
             a.Name = item.企业基本信息.企业名称;
             a.Id = item.Id;
             gys.Add(a);
         }
         long pCount = 用户管理.计数用户<供应商>(0, 0,query) / 20;
         if (用户管理.计数用户<供应商>(0, 0, query) % 20 > 0)
         {
             pCount++;
         }
         JsonResult json = new JsonResult() { Data = new { u = gys, p = pCount } };
         return Json(json, JsonRequestBehavior.AllowGet);
     }
     catch
     {
         List<Industry> gys = new List<Industry>();
         JsonResult json = new JsonResult() { Data = new { u = gys } };
         return Json(json, JsonRequestBehavior.AllowGet);
     }
 }
 public virtual void UpdateIndustry(Industry entity)
 {
     entityDao.UpdateIndustry(entity);
 }