Пример #1
0
        public LogResponse[] UpdateStatus(UpdateStatusRequest request, int C_ID)
        {
            using (var connection = OpenConnection())
            {
                var E_ID1  = request.E_ID1;
                var E_ID2  = request.E_ID2;
                var Status = request.Status;
                var temp   = connection.Execute(ScriptProvider.Get("UpdateElementsStatus"),
                                                new
                {
                    E_ID1,
                    E_ID2,
                    Status
                });

                var temp2 = connection.Execute(ScriptProvider.Get("UpdateLog"),
                                               new
                {
                    C_ID,
                    E_ID1,
                    E_ID2,
                    Status
                });
                var result = connection.Query <LogResponse>(ScriptProvider.Get("GetLog"));
                return(result.ToArray());
            }
        }
Пример #2
0
        public ParametersResponse[] IncrementAndGetParameter(double temp, int lvl, int i)
        {
            try
            {
                using (var connection = OpenConnection())
                {
                    var optimalParameters = connection.Query <GetOptimalParameters>(ScriptProvider.Get("GetOptimalParameters")).ToArray();

                    var optimalTemp = optimalParameters[0].Optimal_value;
                    var optimalLvl  = optimalParameters[1].Optimal_value;

                    var ll = 5;
                    var l  = lvl + 5;

                    if (lvl > (optimalLvl - 6))
                    {
                        ll = 1;
                    }

                    if (lvl < 6)
                    {
                        ll = 1;
                    }



                    double T    = temp;
                    double Ts   = optimalTemp;
                    int    time = optimalTemp;
                    var    k    = 0.005;

                    //for (int i = 0; i < time + 1; i++)
                    //{
                    T = Ts + (T - Ts) * Math.Exp(-k * i);
                    //}


                    var result = connection.Query <ParametersResponse>(ScriptProvider.Get("IncrementAndGetParameter"),
                                                                       new
                    {
                        optimalTemp,
                        optimalLvl,
                        temp,
                        ll,
                        T,
                        lvl
                    });
                    return(result.ToArray());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #3
0
 public int[] EditOptimalParameters(int level, double temperature)
 {
     using (var connection = OpenConnection())
     {
         var result = connection.Query <int>(ScriptProvider.Get("EditOptimalParameters"),
                                             new
         {
             temperature,
             level
         });
         return(result.ToArray());
     }
 }
Пример #4
0
 public LogResponse[] GetLog()
 {
     try
     {
         using (var connection = OpenConnection())
         {
             var result = connection.Query <LogResponse>(ScriptProvider.Get("GetLog"));
             return(result.ToArray());
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Пример #5
0
        public GetOptimalParameters[] GetOptimalParameters()
        {
            try
            {
                using (var connection = OpenConnection())
                {
                    var result = connection.Query <GetOptimalParameters>(ScriptProvider.Get("GetOptimalParameters"));

                    return(result.ToArray());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #6
0
        public StarterRequest[] GetProcessParameters()
        {
            try
            {
                using (var connection = OpenConnection())
                {
                    var result = connection.Query <StarterRequest>(ScriptProvider.Get("GetStarterInfo"));

                    return(result.ToArray());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #7
0
 public CustomerInfo GetCustomerInfo(int C_ID)
 {
     try
     {
         using (var connection = OpenConnection())
         {
             var result = connection.QueryFirst <CustomerInfo>(ScriptProvider.Get("testScript"),
                                                               new
             {
                 C_ID
             });
             return(result);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Пример #8
0
        public LoginDetails GetCustomersByLogin(string Login)
        {
            try
            {
                using (var connection = OpenConnection())
                {
                    var result = connection.QueryFirstOrDefault <LoginDetails>(ScriptProvider.Get("SelectCustomerByLogin"),
                                                                               new
                    {
                        Login
                    });

                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #9
0
        public string CheckAccess(int ID)
        {
            try
            {
                using (var connection = OpenConnection())
                {
                    var result = connection.QueryFirstOrDefault <string>(ScriptProvider.Get("CheckAccess"),
                                                                         new
                    {
                        ID
                    });

                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #10
0
        public int?InsertCustomer(RegisterCustomerRequest customer, string passwordHash)
        {
            try
            {
                using (var connection = OpenConnection())
                {
                    var result = connection.QueryFirstOrDefault <int?>(ScriptProvider.Get("InsertCustomer"),
                                                                       new
                    {
                        FirstName     = customer.FirstName,
                        LastName      = customer.LastName,
                        CustomerLogin = customer.Login,
                        PasswordHash  = passwordHash,
                        CustomerType  = customer.Type
                    });

                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }