Esempio n. 1
0
        public void updateFlatType()
        {
            FlatType flatType = new FlatType();

            flatType.FlatTypeId   = Int32.Parse(flatTypeId.Text);
            flatType.FlatTypeName = flatTypeName.Text;

            using (con = new SqlConnection(getConnection()))
            {
                con.Open();
                using (com = new SqlCommand("flat_type_update", con))
                {
                    com.CommandType = CommandType.StoredProcedure;
                    SqlParameter idParam = new SqlParameter
                    {
                        ParameterName = "@flat_type_id",
                        Value         = flatType.FlatTypeId
                    };
                    SqlParameter nameParam = new SqlParameter
                    {
                        ParameterName = "@flat_type_name",
                        Value         = flatType.FlatTypeName
                    };
                    com.Parameters.Add(idParam);
                    com.Parameters.Add(nameParam);
                    com.ExecuteScalar();
                }
            }
        }
Esempio n. 2
0
        public void setFlatType()
        {
            FlatType flatType = new FlatType();

            flatType.FlatTypeName = flatTypeName.Text;

            using (con = new SqlConnection(getConnection()))
            {
                con.Open();
                using (com = new SqlCommand("flat_type_insert", con))
                {
                    com.CommandType = CommandType.StoredProcedure;
                    SqlParameter nameParam = new SqlParameter
                    {
                        ParameterName = "@flat_type_name",
                        Value         = flatType.FlatTypeName
                    };
                    com.Parameters.Add(nameParam);
                    com.ExecuteScalar();
                }
            }
        }