Beispiel #1
0
        //check  if the name exist
        public bool CheckVisibleName(string name)
        {
            GetConnectionString(connection.server(),
                                connection.database(), connection.username(), connection.password());

            SalesProductModel ldata   = new SalesProductModel();
            string            txt     = "select * from product where name='" + name + "'";
            MySqlCommand      command = new MySqlCommand(txt, Connection);

            Connection.Open();
            MySqlDataReader r = command.ExecuteReader();

            while (r.Read())
            {
                ldata.Id           = r[0].ToString();
                ldata.Name         = r[1].ToString();
                ldata.Serialnumber = Convert.ToInt32(r[2]);
                ldata.Quantity     = Convert.ToInt32(r[4]);
                ldata.Unitprice    = Convert.ToInt32(r[5]);
            }
            Connection.Close();

            if (name != ldata.Name)
            {
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        private void LoadMonthlyData(monthInYear type, int year)
        {
            saleRecordModelBindingSource.Clear();
            SaleReportController controller = new SaleReportController();

            MySqlConnection connection =
                new MySqlConnection("server = " + connectData.server()
                                    + "; database = " + connectData.database()
                                    + "; username = "******"; password="******";");

            string       txt     = "select sum(totalprice) from salesrecord group by year(date)='" + year.ToString() + "'" + ", month(date)='" + type.ToString() + "'";
            MySqlCommand command = new MySqlCommand(txt, connection);

            connection.Open();
            MySqlDataReader r = command.ExecuteReader();

            MonthlyResult monthlyResult = new MonthlyResult((int)type, year);

            while (r.Read())
            {
                int total   = int.Parse(r[0].ToString());
                int monthly = Convert.ToInt32(type);
                //int totalItems = int.Parse(r[1].ToString());

                monthlyResult.LoadData(year, monthly, total);
            }
            monthlyResult.Show();
        }
Beispiel #3
0
 public Login_in()
 {
     connection = new MySqlConnection("server = " + connectionValue.server()
                                      + "; database = " + connectionValue.database() + "; username = "******"; password="******";");
     InitializeComponent();
 }
Beispiel #4
0
 public SalesRecord()
 {
     connectionData = new ConnectionStructor();
     connection     = new MySqlConnection("server =" + connectionData.server()
                                          + ";database =" + connectionData.database() + ";username = "******";password ="******";");
     InitializeComponent();
     _dataGridView = dataGridView1;
 }