コード例 #1
0
        public ShowRecordForm(int id)
        {
            this.id = id;
            InitializeComponent();
            Model.AmbulatorRecord record = PostgresConnector.GetRecord(id);
            Model.AmbulatorCard   card   = PostgresConnector.GetAmbulatorCard(record.ToCard);

            Breeder.Text      = card.Breeder;
            Adress.Text       = card.Address;
            Phone.Text        = card.Phone;
            KindOfAnimal.Text = card.KindOfAnimal;
            Breed.Text        = card.Breed;
            PetName.Text      = card.PetName;
            DateTime birth = card.DateOfBirth;

            Birth.Text = birth.ToLongDateString();
            TimeSpan AgeSpan = DateTime.Now - birth;

            Age.Text       = String.Format("{0} лет {1} месяцев {2} дней", AgeSpan.Days / 365, (AgeSpan.Days % 365) / 30, (AgeSpan.Days % 365) % 30);
            IsMale.Text    = (card.IsMale) ? "Мужская" : "Женская";
            Visit.Text     = record.DateVisit.ToString();
            PayBox.Text    = record.Payment.ToString();
            Anamnesis.Text = record.anamnesis;
            Clinic.Text    = record.assignments;
            Epicrisis.Text = record.epicrisis;
            Debt.Text      = record.Debt.ToString();
        }
コード例 #2
0
        public static int UpdateCard(Model.AmbulatorCard value, int card)
        {
            Model.AmbulatorCard oldValue = GetAmbulatorCard(card);
            if (value == oldValue)
            {
                return(2);
            }
            connector.Open();
            QueryString = string.Format("UPDATE clientbase SET breeder = @Breeder, address = @Address, phone = @Phone, kindofanimal = @kindofanimal, breed = @Breed, petname = @Name, dateofbirth = @DateOfBirth, gender = @IsMale WHERE id = { 0 }; ", card);

            NpgsqlCommand Command = new NpgsqlCommand(QueryString, connector);

            Command.Parameters.Add("@Breeder", NpgsqlTypes.NpgsqlDbType.Varchar).Value      = value.Breeder;
            Command.Parameters.Add("@Address", NpgsqlTypes.NpgsqlDbType.Varchar).Value      = value.Address;
            Command.Parameters.Add("@Phone", NpgsqlTypes.NpgsqlDbType.Varchar).Value        = value.Phone;
            Command.Parameters.Add("@kindofanimal", NpgsqlTypes.NpgsqlDbType.Varchar).Value = value.KindOfAnimal;
            Command.Parameters.Add("@Breed", NpgsqlTypes.NpgsqlDbType.Varchar).Value        = value.Breeder;
            Command.Parameters.Add("@Name", NpgsqlTypes.NpgsqlDbType.Varchar).Value         = value.PetName;
            Command.Parameters.Add("@DateOfBirth", NpgsqlTypes.NpgsqlDbType.Date).Value     = value.DateOfBirth;
            Command.Parameters.Add("@IsMale", NpgsqlTypes.NpgsqlDbType.Varchar).Value       = value.IsMale ? "Мужская" : "Женская";
            Command.Parameters.Add("@First", NpgsqlTypes.NpgsqlDbType.Timestamp).Value      = DateTime.Now;

            Command.ExecuteNonQuery();
            connector.Close();
            return(1);
        }
コード例 #3
0
        public NewRecordForm(int id)
        {
            this.id = id;
            InitializeComponent();
            Model.AmbulatorCard card = PostgresConnector.GetAmbulatorCard(id);
            Breeder.Text      = card.Breeder;
            Adress.Text       = card.Address;
            Phone.Text        = card.Phone;
            KindOfAnimal.Text = card.KindOfAnimal;
            Breed.Text        = card.Breed;
            PetName.Text      = card.PetName;
            DateTime birth = card.DateOfBirth;

            Birth.Text = birth.ToLongDateString();
            TimeSpan AgeSpan = DateTime.Now - birth;

            Age.Text    = String.Format("{0} лет {1} месяцев {2} дней", AgeSpan.Days / 365, (AgeSpan.Days % 365) / 30, (AgeSpan.Days % 365) % 30);
            IsMale.Text = (card.IsMale) ? "Мужская" : "Женская";
        }
コード例 #4
0
        public static int InsertCard(Model.AmbulatorCard value)
        {
            connector.Open();
            QueryString = "INSERT INTO clientbase (breeder, address, phone, kindofanimal, breed, petname, dateofbirth, gender, dateoffirst) " +
                          "VALUES(@Breeder, @Address, @Phone, @kindofanimal, @Breed, @Name, @DateOfBirth, @IsMale, @First);";
            NpgsqlCommand Command = new NpgsqlCommand(QueryString, connector);

            Command.Parameters.Add("@Breeder", NpgsqlTypes.NpgsqlDbType.Varchar).Value      = value.Breeder;
            Command.Parameters.Add("@Address", NpgsqlTypes.NpgsqlDbType.Varchar).Value      = value.Address;
            Command.Parameters.Add("@Phone", NpgsqlTypes.NpgsqlDbType.Varchar).Value        = value.Phone;
            Command.Parameters.Add("@kindofanimal", NpgsqlTypes.NpgsqlDbType.Varchar).Value = value.KindOfAnimal;
            Command.Parameters.Add("@Breed", NpgsqlTypes.NpgsqlDbType.Varchar).Value        = value.Breed;
            Command.Parameters.Add("@Name", NpgsqlTypes.NpgsqlDbType.Varchar).Value         = value.PetName;
            Command.Parameters.Add("@DateOfBirth", NpgsqlTypes.NpgsqlDbType.Date).Value     = value.DateOfBirth;
            Command.Parameters.Add("@IsMale", NpgsqlTypes.NpgsqlDbType.Varchar).Value       = value.IsMale ? "Мужская" : "Женская";
            Command.Parameters.Add("@First", NpgsqlTypes.NpgsqlDbType.Timestamp).Value      = DateTime.Now;

            Command.ExecuteNonQuery();
            connector.Close();
            return(1);
        }
コード例 #5
0
        public ShowCardForm(int id)
        {
            this.id = id;
            InitializeComponent();
            Model.AmbulatorCard model   = PostgresConnector.GetAmbulatorCard(id);
            DataTable           records = PostgresConnector.GetRecordsForCard(id);

            BaseGrid.DataSource = records;
            BreederLabel.Text   = model.Breeder;
            AddressLabel.Text   = model.Address;
            NumLabel.Text       = model.Phone;
            KindOfAnimal.Text   = model.KindOfAnimal;
            Breed.Text          = model.Breed;
            PetName.Text        = model.PetName;
            DateTime birth = model.DateOfBirth;

            Birth.Text = birth.ToLongDateString();
            TimeSpan AgeSpan = DateTime.Now - birth;

            Age.Text    = String.Format("{0} лет {1} месяцев {2} дней", AgeSpan.Days / 365, (AgeSpan.Days % 365) / 30, (AgeSpan.Days % 365) % 30);
            IsMale.Text = (model.IsMale) ? "Мужская" : "Женская";
        }
コード例 #6
0
        //<summary>
        //Выборка одной карты с ID
        //</summary>
        public static Model.AmbulatorCard GetAmbulatorCard(int id)
        {
            Model.AmbulatorCard selector = new Model.AmbulatorCard(id);
            connector.Open();
            QueryString = string.Format("SELECT * FROM clientbase WHERE id={0};", id);
            NpgsqlCommand    Command = new NpgsqlCommand(QueryString, connector);
            NpgsqlDataReader Reader  = Command.ExecuteReader();

            while (Reader.Read())
            {
                selector.Breeder        = Reader["breeder"].ToString();
                selector.IsMale         = selector.StringToGender(Reader["gender"].ToString());
                selector.KindOfAnimal   = Reader["kindofanimal"].ToString();
                selector.Phone          = Reader["phone"].ToString();
                selector.PetName        = Reader["petname"].ToString();
                selector.DateOfBirth    = (DateTime)Reader["dateofbirth"];
                selector.Breed          = Reader["breed"].ToString();
                selector.Address        = Reader["address"].ToString();
                selector.FirstVisitDate = (DateTime)Reader["dateoffirst"];
            }
            connector.Close();
            return(selector);
        }