示例#1
0
 public UslugiCategory(JournalUslugiItem item)
 {
     this.Checked = item.Is_Paid;
     this.ShortName = item.UslugaShortName;
     this.Name = item.UslugaName;
     this.Description = item.Description;
     this.ID = item.Id_Uslugi;
     this.Price = item.Price;
 }
示例#2
0
        public static List<JournalUslugiItem> GetJournalUslugiItems(int id)
        {
            List<JournalUslugiItem> journalList = new List<JournalUslugiItem>();
            try
            {
                SqlConnection connection = OpenConnection();
                if ((connection == null) || (connection.State == ConnectionState.Closed))
                    return null;

                SqlCommand ngCommand = connection.CreateCommand();
                ngCommand.CommandType = CommandType.StoredProcedure;
                ngCommand.CommandText = GET_JOURNALUSLUGIITEMS_REGISRTY;
                ngCommand.Parameters.AddWithValue("@journalId", id);
                // ngCommand.CommandTimeout = CommandTimeOut > 2 * connection.ConnectionTimeout ? CommandTimeOut : 2 * connection.ConnectionTimeout;

                ngCommand.ExecuteNonQuery();
                SqlDataReader reader = null;
                if (connection != null)
                {

                    reader = ngCommand.ExecuteReader();
                    while (reader.Read())
                    {
                        JournalUslugiItem newItem = new JournalUslugiItem();

                       // newItem.Date = (DateTime)reader["Date"];
                        newItem.Id_Uslugi = (int)reader["ID_Uslugi"];
                        newItem.Id_Journal = (int)reader["ID_Journal"];
                        newItem.ID_Client = (int)reader["ID_Client"];
                        newItem.ID = (int)reader["ID"];
                        newItem.Price = (double)reader["Price"];
                        newItem.Is_Paid = (bool)reader["IsPaid"];
                        newItem.UslugaName = (string)reader["UslugaName"];
                        newItem.Date = (DateTime)reader["Date"];
                        newItem.UslugaShortName = (string)reader["UslugaShortName"];

                        journalList.Add(newItem);

                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CloseConnection();
                return null;
            }
            CloseConnection();
            return journalList;
        }
示例#3
0
        public static List<JournalUslugiItem> GetClientUslugiItemsExt(int IdJournal)
        {
            List<JournalUslugiItem> itemList = new List<JournalUslugiItem>();
            try
            {
                SqlConnection connection = OpenConnection();
                if ((connection == null) || (connection.State == ConnectionState.Closed))
                    return null;

                SqlCommand ngCommand = connection.CreateCommand();
                ngCommand.CommandType = CommandType.StoredProcedure;
                ngCommand.CommandText = GET_CLIENTSUSLUGIITEMS_REGISRTY;
                ngCommand.Parameters.AddWithValue("@journalID", IdJournal);
                // ngCommand.CommandTimeout = CommandTimeOut > 2 * connection.ConnectionTimeout ? CommandTimeOut : 2 * connection.ConnectionTimeout;

                ngCommand.ExecuteNonQuery();
                SqlDataReader reader = null;
                if (connection != null)
                {

                    reader = ngCommand.ExecuteReader();
                    while (reader.Read())
                    {
                        JournalUslugiItem newItem= new JournalUslugiItem();
                        newItem.UslugaShortName = (string)reader["UslugaShortName"];
                        newItem.Price = (double)reader["Price"];
                        if (!DBNull.Value.Equals(reader["IsAnalize"]))
                            newItem.IsAnalize = (bool)reader["IsAnalize"];
                        else
                            newItem.IsAnalize = false;
                        itemList.Add(newItem);

                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CloseConnection();
                return null;
            }
            CloseConnection();
            return itemList;
        }