示例#1
0
        public void SetTypes(Get_or_Set_types type)
        {
            string sqlexpression = "type_insert";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sqlexpression, connection);
                command.CommandType = CommandType.StoredProcedure;

                SqlParameter IdParam = new SqlParameter
                {
                    ParameterName = "@id",
                    Value         = type.Id
                };
                command.Parameters.Add(IdParam);

                /*SqlParameter TypeIdParam = new SqlParameter
                 * {
                 *
                 * };
                 * command.Parameters.Add(TypeIdParam);*/

                SqlParameter TypeNameParam = new SqlParameter
                {
                    ParameterName = "@type",
                    Value         = type.Type
                };
                command.Parameters.Add(TypeNameParam);

                SqlParameter InfoParam = new SqlParameter
                {
                    ParameterName = "@info",
                    Value         = type.Info
                };
                command.Parameters.Add(InfoParam);

                try
                {
                    command.ExecuteNonQuery();
                }
                catch
                {
                }
                connection.Close();
            }
        }
示例#2
0
        public List <Get_or_Set_types> GetTypes()
        {
            List <DishClassLibrary.temp.test.Get_or_Set_types> list = new List <DishClassLibrary.temp.test.Get_or_Set_types>();
            string sqlexpression = "type_get";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sqlexpression, connection);
                // указываем, что команда представляет хранимую процедуру
                command.CommandType = System.Data.CommandType.StoredProcedure;
                var reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Get_or_Set_types type = new Get_or_Set_types();
                    type.Id   = reader.GetInt32(0);
                    type.Type = reader.GetString(1);
                    type.Info = reader.GetString(2);
                    list.Add(type);
                }
                reader.Close();
            }
            return(list);
        }
示例#3
0
 public void SetType(Get_or_Set_types type)
 {
     dal.SetTypes(type);
 }
示例#4
0
 public ActionResult SetType(Get_or_Set_types type)
 {
     bis_log.SetType(type);
     return(RedirectToAction("Mainpage"));
 }
示例#5
0
        public ActionResult SetType()
        {
            Get_or_Set_types type = new Get_or_Set_types();

            return(View(type));
        }