예제 #1
0
        private void Vnesi_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(username1.Text))
            {
                MessageBox.Show("Внесете корисничко име");
            }
            else if (string.IsNullOrWhiteSpace(password.Text))
            {
                MessageBox.Show("Внесете лозинка");
            }
            else
            {
                SHA1   sha  = new SHA1CryptoServiceProvider();
                var    hash = sha.ComputeHash(ASCIIEncoding.ASCII.GetBytes(password.Text));
                string pass = BitConverter.ToString(hash);
                pass = pass.Replace("-", "");
                string upit = " select * from proba_apteka.doktori where username_d = '" + username1.Text + "' and password_d = '" + pass + "'";

                DBConnect connection = new DBConnect();
                connection.openConnection();
                int id = connection.Login(upit);
                if (id != 0)
                {
                    LoginInfo.doktor_id = id;
                    this.Hide();
                    pacient p = new pacient();
                    p.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Невалидна комбинација.Обидете се пак!");
                }
            }
        }
        /// <summary>
        /// Converts this instance of <see cref="pacient"/> to an instance of <see cref="pacientDto"/>.
        /// </summary>
        /// <param name="entity"><see cref="pacient"/> to convert.</param>
        public static pacientDto ToDTO(this pacient entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new pacientDto();

            dto.v_PersonId     = entity.v_PersonId;
            dto.i_IsDeleted    = entity.i_IsDeleted;
            dto.i_InsertUserId = entity.i_InsertUserId;
            dto.d_InsertDate   = entity.d_InsertDate;
            dto.i_UpdateUserId = entity.i_UpdateUserId;
            dto.d_UpdateDate   = entity.d_UpdateDate;
            dto.i_UpdateNodeId = entity.i_UpdateNodeId;

            entity.OnDTO(dto);

            return(dto);
        }
        /// <summary>
        /// Converts this instance of <see cref="pacientDto"/> to an instance of <see cref="pacient"/>.
        /// </summary>
        /// <param name="dto"><see cref="pacientDto"/> to convert.</param>
        public static pacient ToEntity(this pacientDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new pacient();

            entity.v_PersonId     = dto.v_PersonId;
            entity.i_IsDeleted    = dto.i_IsDeleted;
            entity.i_InsertUserId = dto.i_InsertUserId;
            entity.d_InsertDate   = dto.d_InsertDate;
            entity.i_UpdateUserId = dto.i_UpdateUserId;
            entity.d_UpdateDate   = dto.d_UpdateDate;
            entity.i_UpdateNodeId = dto.i_UpdateNodeId;

            dto.OnEntity(entity);

            return(entity);
        }
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="pacient"/> converted from <see cref="pacientDto"/>.</param>
 static partial void OnEntity(this pacientDto dto, pacient entity);
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="pacientDto"/> converted from <see cref="pacient"/>.</param>
 static partial void OnDTO(this pacient entity, pacientDto dto);