public ActionResult Demo()
        {
            //OxyConverterLib.Calculate ocl = new OxyConverterLib.Calculate();
            OxyConverterDB _db = new OxyConverterDB();

            if (_db.Variants.Where(l => l.Owner.ID_User == _users.CurrentUser.ID_User).FirstOrDefault() == null)
            {
                double _Q = 80;
                double _C = 3;
                double _T = 298;
                double _P = 140000;
                string _NameDefaultVariant = "Шаблон";

                Variants var_default = new Variants
                {
                    NameVariant = _NameDefaultVariant,
                    DateVariant = System.DateTime.Now,
                    Owner       = _users.CurrentUser
                };

                int _ID_Variant_new = _db.Variants.Where(p => p.NameVariant == _NameDefaultVariant && p.Owner.ID_User == _users.CurrentUser.ID_User).First().ID_Variant;
                InputDataVariants inputDataVariants_new = new InputDataVariants
                {
                    ID_Variant = _ID_Variant_new,
                    Q          = _Q,
                    C          = _C,
                    T          = _T,
                    P          = _P,
                    Owner      = _users.CurrentUser
                };

                _inputDataVariants.InsertOrUpdate(inputDataVariants_new);
                _inputDataVariants.Save();
            }
            int _ID_Variant_First = _db.Variants.First(p => p.Owner.ID_User == _users.CurrentUser.ID_User).ID_Variant;

            OxyConverterLib.Calculate ocl = new OxyConverterLib.Calculate();

            #region --- Задать исходные данные для первого найденного варианта

            ocl.Q = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).Q;
            ocl.C = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).C;
            ocl.T = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).T;
            ocl.P = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).P;

            #endregion --- Задать исходные данные для первого найденного варианта

            ViewBag.InputData      = ocl;
            ViewBag.ID_Variant     = new SelectList(_variants.All.Where(t => t.Owner.ID_User == _users.CurrentUser.ID_User), "ID_Variant", "NameVariant");
            ViewBag.NameNewVariant = "Новый вариант";

            return(View());
        }
        public ActionResult Index(InputDataVariants inputDataVariants)
        {
            GasChannelDB _database = new GasChannelDB();

            #region --- Ввод тестовых данных в базу данных

            int _ID_Variant_1 = _database.Variants.Where(p => p.NameVariant == "Вариант 1" && p.Owner.ID_User == _users.CurrentUser.ID_User).First().ID_Variant;
            InputDataVariants inputDataVariants_1 = new InputDataVariants
            {
                ID_Variant        = _ID_Variant_1,
                Kol_prod_gorenija = 19165,
                Ro_0            = 1.28,
                Ro_v            = 1.29,
                H_pechi         = 3.55,
                L_pechi         = 2.15,
                T_fume          = 1223,
                T_fume_v        = 1198,
                L_vert          = 1,
                b_vert          = 0.7,
                H_vert          = 3,
                lambda_vert     = 0.05,
                L_bor_vert_rek  = 11,
                Td_rek_fume_bor = 1176,
                Tv_bor          = 293,
                H_bor           = 2.15,
                L_bor           = 6,
                T_rek           = 450,
                L_rek           = 1.4,
                W_rek           = 2.5,
                d_trub_rek      = 57,
                T_rek_vh        = 1176,
                W0_rek          = 4.8,
                n_trub          = 14,
                T_trub          = 593,
                d_h_diag        = 8,
                fi_s1           = 0.95,
                fi_s2           = 1,
                fi_d            = 1.11,
                fi_t_st         = 1.06,
                Owner           = _users.CurrentUser
            };
            _inputDataVariants.InsertOrUpdate(inputDataVariants_1);
            _inputDataVariants.Save();

            #endregion --- Ввод тестовых данных в базу данных

            return(RedirectToAction("Index"));
        }
Пример #3
0
        public ActionResult Index(InputDataVariants inputDataVariants)
        {
            OxyConverterDB _database = new OxyConverterDB();

            #region --- Ввод тестовых данных в базу данных

            int _ID_Variant_1 = _database.Variants.Where(p => p.NameVariant == "Вариант 1" && p.Owner.ID_User == _users.CurrentUser.ID_User).First().ID_Variant;
            InputDataVariants inputDataVariants_1 = new InputDataVariants
            {
                ID_Variant = _ID_Variant_1,
                Q          = 80,
                C          = 3,
                T          = 298,
                P          = 140000,
                Owner      = _users.CurrentUser
            };
            _inputDataVariants.InsertOrUpdate(inputDataVariants_1);
            _inputDataVariants.Save();

            #endregion --- Ввод тестовых данных в базу данных

            return(RedirectToAction("Index"));
        }
Пример #4
0
        public ActionResult Demo()
        {
            GasChannelDB gcdb = new GasChannelDB();

            if (gcdb.Variants.Where(p => p.Owner.ID_User == _users.CurrentUser.ID_User).FirstOrDefault() == null)
            {
                double _Kol_prod_gorenija = 19165;
                double _Ro_0               = 1.28;
                double _Ro_v               = 1.29;
                double _H_pechi            = 3.55;
                double _L_pechi            = 2.15;
                double _T_fume             = 1223;
                double _T_fume_v           = 1198;
                double _L_vert             = 1;
                double _b_vert             = 0.7;
                double _H_vert             = 3;
                double _lambda_vert        = 0.05;
                double _L_bor_vert_rek     = 11;
                double _Td_rek_fume_bor    = 1176;
                double _Tv_bor             = 293;
                double _T_rek              = 450;
                double _L_rek              = 1.4;
                double _W_rek              = 2.5;
                double _d_trub_rek         = 57;
                double _T_rek_vh           = 1176;
                double _W0_rek             = 4;
                int    _n_trub             = 14;
                double _T_trub             = 593;
                double _d_h_diag           = 8;
                double _fi_s1              = 0.95;
                double _fi_s2              = 1;
                double _fi_d               = 1.11;
                double _fi_t_st            = 1.06;
                string _NameDefaultVariant = "Шаблон";

                Variants var_default = new Variants
                {
                    NameVariant = _NameDefaultVariant,
                    DateVariant = System.DateTime.Now,
                    Owner       = _users.CurrentUser
                };
                _variants.InsertOrUpdate(var_default);
                _variants.Save();

                int _ID_Variant_new = gcdb.Variants.Where(p => p.NameVariant == _NameDefaultVariant && p.Owner.ID_User == _users.CurrentUser.ID_User).First().ID_Variant;
                InputDataVariants inputDataVariants_new = new InputDataVariants
                {
                    ID_Variant        = _ID_Variant_new,
                    Kol_prod_gorenija = _Kol_prod_gorenija,
                    Ro_0            = _Ro_0,
                    Ro_v            = _Ro_v,
                    H_pechi         = _H_pechi,
                    L_pechi         = _L_pechi,
                    T_fume          = _T_fume,
                    T_fume_v        = _T_fume_v,
                    L_vert          = _L_vert,
                    b_vert          = _b_vert,
                    H_vert          = _H_vert,
                    lambda_vert     = _lambda_vert,
                    L_bor_vert_rek  = _L_bor_vert_rek,
                    Td_rek_fume_bor = _Td_rek_fume_bor,
                    Tv_bor          = _Tv_bor,
                    T_rek           = _T_rek,
                    L_rek           = _L_rek,
                    W_rek           = _W_rek,
                    d_trub_rek      = _d_trub_rek,
                    T_rek_vh        = _T_rek_vh,
                    W0_rek          = _W0_rek,
                    n_trub          = _n_trub,
                    T_trub          = _T_trub,
                    d_h_diag        = _d_h_diag,
                    fi_s1           = _fi_s1,
                    fi_s2           = _fi_s2,
                    fi_d            = _fi_d,
                    fi_t_st         = _fi_t_st,
                    Owner           = _users.CurrentUser
                };
                _inputDataVariants.InsertOrUpdate(inputDataVariants_new);
                _inputDataVariants.Save();
            }

            int _ID_Variant_First = gcdb.Variants.First(p => p.Owner.ID_User == _users.CurrentUser.ID_User).ID_Variant;

            GasChannelLib.GasChannelLib gcl = new GasChannelLib.GasChannelLib();

            #region --- Задать исходные данные для первого найденного варианта

            gcl.Kol_prod_gorenija = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).Kol_prod_gorenija;
            gcl.Ro_0            = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).Ro_0;
            gcl.Ro_v            = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).Ro_v;
            gcl.H_pechi         = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).H_pechi;
            gcl.L_pechi         = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).L_pechi;
            gcl.T_fume          = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).T_fume;
            gcl.T_fume_v        = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).T_fume_v;
            gcl.L_vert          = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).L_vert;
            gcl.b_vert          = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).b_vert;
            gcl.H_vert          = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).H_vert;
            gcl.lambda_vert     = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).lambda_vert;
            gcl.L_bor_vert_rek  = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).L_bor_vert_rek;
            gcl.Td_rek_fume_bor = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).Td_rek_fume_bor;
            gcl.Tv_bor          = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).Tv_bor;
            gcl.T_rek           = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).T_rek;
            gcl.L_rek           = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).L_rek;
            gcl.W_rek           = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).W_rek;
            gcl.d_trub_rek      = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).d_trub_rek;
            gcl.T_rek_vh        = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).T_rek_vh;
            gcl.W0_rek          = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).W0_rek;
            gcl.n_trub          = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).n_trub;
            gcl.T_trub          = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).T_trub;
            gcl.d_h_diag        = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).d_h_diag;
            gcl.fi_s1           = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).fi_s1;
            gcl.fi_s2           = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).fi_s2;
            gcl.fi_d            = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).fi_d;
            gcl.fi_t_st         = _inputDataVariants.All.First(p => p.Variants.ID_Variant == _ID_Variant_First && p.Owner.ID_User == _users.CurrentUser.ID_User).fi_t_st;

            #endregion --- Задать исходные данные для первого найденного варианта

            ViewBag.InputData      = gcl;
            ViewBag.ID_Variant     = new SelectList(_variants.All.Where(t => t.Owner.ID_User == _users.CurrentUser.ID_User), "ID_Variant", "NameVariant");
            ViewBag.NameNewVariant = "Новый вариант";

            return(View());
        }