Esempio n. 1
0
        public string AddNewUko(UKOmodel _uko)
        {
            string _ukoId = new GetId().getHash(nullCheck.checkStringNullReturnEmptyString(_uko.Name) + nullCheck.checkStringNullReturnEmptyString(_uko.SecondName) + nullCheck.checkStringNullReturnEmptyString(_uko.FathersName) + _uko.Date);



            try
            {
                SqlCommand cmd = new SqlCommand("AddUKO", con);

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@entitytype", _uko.Type);
                cmd.Parameters.AddWithValue("@ID", _ukoId);
                cmd.Parameters.AddWithValue("@Name", nullCheck.checkStringNull(_uko.Name));
                cmd.Parameters.AddWithValue("@SecondName", nullCheck.checkStringNull(_uko.SecondName));
                cmd.Parameters.AddWithValue("@FathersName", nullCheck.checkStringNull(_uko.FathersName));
                cmd.Parameters.AddWithValue("@DateOffBirth", nullCheck.checkDateTimeNullNotDb(_uko.Date));
                cmd.Parameters.AddWithValue("@FIO", new GetFIO().Fio(nullCheck.checkStringNullReturnEmptyString(_uko.Name), nullCheck.checkStringNullReturnEmptyString(_uko.SecondName), nullCheck.checkStringNullReturnEmptyString(_uko.FathersName)));
                cmd.Parameters.AddWithValue("@Photo", nullCheck.checkStringNull(_uko.Photo));
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();


                return(_ukoId);
            }
            catch
            {
                con.Close();

                throw;
            }
        }