Пример #1
0
        private bool Check_Control(ENROLL_TYPE type)
        {
            switch (type)
            {
            case ENROLL_TYPE.COMPANY:
                if (string.IsNullOrEmpty(tbCompanyName.Text))
                {
                    tbCompanyName.Focus();
                    return(false);
                }

                break;
            }

            return(true);
        }
Пример #2
0
        private void Enroll_Data(ENROLL_TYPE etype)
        {
            MySql  mysql = MySql.Instance;
            string query = "";

            try
            {
                switch (etype)
                {
                case ENROLL_TYPE.COMPANY:
                    if (!Check_Control(ENROLL_TYPE.COMPANY))
                    {
                        return;
                    }

                    query = string.Format("INSERT INTO t_company(name, area_main, area_sub) VALUES('{0}', '{1}', '{2}');", tbCompanyName.Text, cbAreaMain.Text, cbAreaSub.Text);
                    mysql.Set_SqlQuery(query);
                    lblStatusCompany.Text = string.Format("Finished enroll the '{0}'...", tbCompanyName.Text);
                    tbCompanyName.Text    = "";

                    Console.WriteLine("Insert a data in t_company");
                    break;
                }
            }
            catch (MySqlException)
            {
                if (etype == ENROLL_TYPE.COMPANY)
                {
                    MessageBox.Show(string.Format("'{0}'은(는) 이미 등록 되어있습니다.", tbCompanyName.Text));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }