// for get refractory Id by refractory brand
        public async Task <DTORefractory> GetRefractoryByBrand(string refBrand)
        {
            Refractory refractory = (await _uow.Refractory.SelectAll(x => x.RefractoryBrand == refBrand)).FirstOrDefault();

            if (refractory == null)
            {
                throw new ArgumentException("Refractory not exist");
            }
            return(AutoMapper.Mapper.Map <Refractory, DTORefractory>(refractory));
        }
        public async Task UnblockRefractory(int refId)
        {
            if (refId > 0)
            {
                Refractory refractory = await _uow.Refractory.SelectById(refId);

                refractory.IsBlocked = false;
                await _uow.Refractory.Update(refractory);
            }
            else
            {
                throw new ArgumentException("Wrong data");
            }
        }
        public async Task BlockRefractory(int refId, string userName)
        {
            if (refId > 0 && userName != null && userName.Length > 3)
            {
                Refractory refractory = await _uow.Refractory.SelectById(refId);

                refractory.IsBlocked = true;
                await _uow.Refractory.Update(refractory);
            }
            else
            {
                throw new ArgumentException("Wrong data");
            }
        }
示例#4
0
        public override void Init()
        {
            try
            {
                emotionEngine = Utils.GetPluginStorableById(containingAtom, "EmotionEngine") as EmotionEngine;

                hipAction = Utils.GetPluginStorableById(containingAtom, "HipThrust") as HipThrust;

                breatheAction = Utils.GetPluginStorableById(containingAtom, "Breathe") as Breathe;

                gaze = Utils.GetPluginStorableById(containingAtom, "Gaze") as Gaze;

                oMeter = Utils.GetPluginStorableById(containingAtom, "OMeter") as OMeter;

                gaze.SetReference(containingAtom.name, "eyeTargetControl");
                gaze.SetLookAtPlayer(-0.10f * Vector3.up);
                gaze.SetGazeDuration(0.2f);

                idle       = new Idle(this);
                sex        = new Sex(this);
                climax     = new Climax(this);
                refractory = new Refractory(this);

                hipState = new StateMachine();

                JSONStorableString debugState = new JSONStorableString("debugState", "");
                CreateTextField(debugState);

                hipState.onStateChanged += (State previous, State next) =>
                {
                    debugState.val = next.ToString();
                };

                hipState.Switch(idle);
            }
            catch (Exception e)
            {
                SuperController.LogError("Exception caught: " + e);
            }
        }
示例#5
0
        protected override void Seed(ApplicationDbContext db)
        {
            var userManager = new ApplicationUserManager(new CustomUserStore(db));

            var roleManager = new ApplicationRoleManager(new CustomRoleStore(db));

            var role1 = new CustomRole("user");
            var role2 = new CustomRole("moderator");
            var role3 = new CustomRole("admin");

            roleManager.Create(role1);
            roleManager.Create(role2);
            roleManager.Create(role3);

            var admin = new ApplicationUser()
            {
                Email    = "*****@*****.**",
                UserName = "******",
                UserInfo = new UserInfo()
                {
                    Name = "Mикола", LastName = "Петрович", Login = "******", UserAvatar = "mmm.png", Position = "Зам. начальника АСУТП", IsBlocked = false, DateRegistration = DateTime.Now
                }
            };
            var result = userManager.Create(admin, "111111");

            var moder = new ApplicationUser()
            {
                Email    = "*****@*****.**",
                UserName = "******",
                UserInfo = new UserInfo()
                {
                    Name = "Костянтин", LastName = "Левко", Login = "******", UserAvatar = "kkk.png", Position = "Зам. начальника ТO", IsBlocked = false, DateRegistration = DateTime.Now
                }
            };
            var result2 = userManager.Create(moder, "222222"); // min 6 characters

            var user1 = new ApplicationUser()
            {
                Email    = "*****@*****.**",
                UserName = "******",
                UserInfo = new UserInfo()
                {
                    Name = "Дмитро", LastName = "Дорн", Login = "******", UserAvatar = "jjj.png", Position = "Майстер розливки цеху №2", IsBlocked = false, DateRegistration = DateTime.Now
                }
            };
            var result3 = userManager.Create(user1, "333333");

            var user2 = new ApplicationUser()
            {
                Email    = "*****@*****.**",
                UserName = "******",
                UserInfo = new UserInfo()
                {
                    Name = "Степан", LastName = "Лом", Login = "******", UserAvatar = "sss.png", Position = "Майстер розливки цеху №3", IsBlocked = false, DateRegistration = DateTime.Now
                }
            };
            var result4 = userManager.Create(user2, "444444");

            db.SaveChanges();

            var ref1 = new Refractory()
            {
                RefractoryBrand       = "RefraTech 345P",
                RefractoryDescription = "Периклазо-вуглецеий кирпич для робочої стіни сталь ковша. Має високу стійкість, що досягає 50 і більше плавок.",
                UserInfoId            = 3,
                RefractoryPicture     = "111.png",
                DateCreate            = DateTime.Now,
                RefractoryType        = "#Робоча стiна",
                Density            = 2.3f,
                MaxWorkTemperature = 1650.0f,
                Lime     = 1.0f,
                Alumina  = 0.1f,
                Silica   = 1.1f,
                Magnesia = 77.5f,
                Carbon   = 15.0f,
                Price    = 1200.5f
            };

            db.Refractory_.Add(ref1);
            db.SaveChanges();

            var comment = new Comment()
            {
                CommentBody = "Кирпич добре себе показав у ході компанії від 20.01.2019 на броні №22. Стійкість склала 55 плавок", UserInfoId = 3, DateCreation = DateTime.Now, RefractoryId = 1
            };
            var comment2 = new Comment()
            {
                CommentBody = "25.01.2019 на броні №23 стійкість склала 50 плавок", UserInfoId = 4, DateCreation = DateTime.Now, RefractoryId = 1
            };

            db.Comment_.Add(comment);
            db.Comment_.Add(comment2);
            db.SaveChanges();

            if (result.Succeeded && result2.Succeeded && result3.Succeeded && result4.Succeeded)
            {
                userManager.AddToRole(admin.Id, role3.Name);
                userManager.AddToRole(admin.Id, role2.Name);
                userManager.AddToRole(moder.Id, role2.Name);
                userManager.AddToRole(user1.Id, role1.Name);
                userManager.AddToRole(user2.Id, role1.Name);
            }
            db.SaveChanges();
        }