Ejemplo n.º 1
0
        public CounselMemo(object v1)
        {
            if (v1 != null)
            {
                this.id = ((Counsel_table)v1).ID;
                mind    = new MindController();
                Crypt crypt = mind.GetCrypt();

                InitializeComponent();

                this.counsel_Table = mind.GetCounsel_Table(id);
                this.client        = mind.GetMember(counsel_Table.ClientID);
                this.counselor     = mind.GetMember(counsel_Table.MemberID);

                // 피내담자(고객)
                this.txt_clientID.Text    = client.GetID().ToString();
                this.txt_clientName.Text  = client.GetName().ToString();
                this.txt_clientPhone.Text = client.GetPhone().ToString();

                // 상담자
                this.txt_counselorID.Text    = counselor.GetID().ToString();
                this.txt_counselorName.Text  = counselor.GetName().ToString();
                this.txt_counselorPhone.Text = counselor.GetPhone().ToString();

                // 내용
                this.txt_clientSubject.Text = counsel_Table.Subject;
                this.txt_clientMemo.Text    = counsel_Table.Memo;
                this.lbl_firstdate.Text     = counsel_Table.Firstdate.ToString();

                // 코멘트
                this.txt_Comment.Text = crypt.Decrypt(counsel_Table.Comment.ToString());
                this.lbl_comdate.Text = counsel_Table.Comdate.ToString();
            }
        }
Ejemplo n.º 2
0
        private void Btn_counselSubmit_Click(object sender, EventArgs e)
        {
            Boolean state  = true;
            Crypt   crypt  = mind.GetCrypt();
            string  passwd = crypt.Encrypt(txt_counselorPasswd.Text);

            Counsel_table counsel_Table = new Counsel_table();

            counsel_Table.Subject   = this.txt_clientSubject.Text;
            counsel_Table.Memo      = crypt.Encrypt(this.txt_clientMemo.Text);
            counsel_Table.Firstdate = DateTime.Now;
            counsel_Table.ClientID  = int.Parse(txt_clientID.Text);
            counsel_Table.MemberID  = int.Parse(txt_counselorID.Text);

            //MessageBox.Show(passwd);
            //MessageBox.Show( mind.CheckPassword(passwd).ToString() );

            if (txt_clientSubject.Text.Length == 0)
            {
                MessageBox.Show("제목을 입력하세요\r(Enter the subject)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (txt_clientMemo.Text.Length == 0 &&
                state == true)
            {
                MessageBox.Show("내용을 입력하세요\r(Enter the memo)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (txt_counselorPasswd.Text.Length == 0 &&
                state == true)
            {
                MessageBox.Show("상담자 비밀번호를 입력하세요\r(Enter the counselor password)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (mind.CheckPassword(passwd) == false &&
                state == true)
            {
                MessageBox.Show("비밀번호가 일치하지 않습니다.\r(Mismatch password.)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            // 추가 Query
            if (state == true)
            {
                string query = "INSERT INTO counsel_table(subject, memo, " +
                               "firstdate, comment, comdate, clientID, memberID) VALUES(" +
                               "@subject, @memo, @firstdate, @comment, @comdate, @clientID, @memberID)";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = query;
                cmd.Parameters.Add("@subject", MySqlDbType.VarChar, 50);
                cmd.Parameters.Add("@memo", MySqlDbType.Text);
                cmd.Parameters.Add("@firstdate", MySqlDbType.DateTime);
                cmd.Parameters.Add("@comment", MySqlDbType.Text);
                cmd.Parameters.Add("@comdate", MySqlDbType.DateTime);
                cmd.Parameters.Add("@clientID", MySqlDbType.Int32, 11);
                cmd.Parameters.Add("@memberID", MySqlDbType.Int32, 11);

                cmd.Parameters[0].Value = counsel_Table.Subject;
                cmd.Parameters[1].Value = counsel_Table.Memo;
                cmd.Parameters[2].Value = counsel_Table.Firstdate;
                cmd.Parameters[3].Value = null;
                cmd.Parameters[4].Value = null;
                cmd.Parameters[5].Value = counsel_Table.ClientID;
                cmd.Parameters[6].Value = counsel_Table.MemberID;

                mind.InsertUpdate(cmd);
                MessageBox.Show("성공적으로 등록되었습니다.\r(Successfully registered.)",
                                "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Close();

                var myParent = (MainFrm)this.Owner;
                myParent.ParentMethod();
            }
        }
Ejemplo n.º 3
0
        private void BtnQueries_Click(object sender, EventArgs e)
        {
            Boolean state  = true;
            Member  member = new Member();
            Crypt   crypt  = mind.GetCrypt();

            member.SetName(str_Name.Text);
            member.SetEmail(str_MemEmail.Text);
            member.SetBirthDate(str_MemDateTimePicker.Value);
            member.SetPhone(str_MemPhoneNumber.Text);
            member.SetFamilytype(cmb_MemType.GetItemText(this.cmb_MemType.SelectedItem));
            // this.comboBox1.GetItemText(this.comboBox1.SelectedItem);
            //MessageBox.Show(cmb_MemType.GetItemText(this.cmb_MemType.SelectedItem));

            if (member.GetName().Length == 0)
            {
                MessageBox.Show("이름을 입력하세요\r(Enter the userName)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (member.GetEmail().Length == 0 && state == true)
            {
                MessageBox.Show("이메일을 입력하세요\r(Enter the email)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if ((str_passwd1.Text.Length == 0 ||
                 str_passwd2.Text.Length == 0) &&
                state == true)
            {
                MessageBox.Show("비밀번호를 입력하세요\r(Enter the Password)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if ((str_passwd1.Text != str_passwd2.Text) && state == true)
            {
                MessageBox.Show("비밀번호가 일치하지 않습니다.\r(Mismatch the password)",
                                "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            // state가 true일 때
            if (state == true)
            {
                // 비밀번호 입력 처리(암호화)
                member.SetPasswd(crypt.Encrypt(str_passwd1.Text));

                // 쿼리
                string query = "INSERT INTO member(name, email, " +
                               "birthdate, phone, type, password) " +
                               "VALUES (@name, @email, @birthdate, @phone, " +
                               "@type, @password)";

                MySqlCommand insertCommand = new MySqlCommand();
                insertCommand.CommandText = query;

                insertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 50);
                insertCommand.Parameters.Add("@email", MySqlDbType.VarChar, 100);
                insertCommand.Parameters.Add("@birthdate", MySqlDbType.DateTime);
                insertCommand.Parameters.Add("@phone", MySqlDbType.VarChar, 20);
                insertCommand.Parameters.Add("@type", MySqlDbType.VarChar, 20);
                insertCommand.Parameters.Add("@password", MySqlDbType.Text);

                insertCommand.Parameters[0].Value = member.GetName();
                insertCommand.Parameters[1].Value = member.GetEmail();
                insertCommand.Parameters[2].Value = member.GetBirthDate();
                insertCommand.Parameters[3].Value = member.GetPhone();
                insertCommand.Parameters[4].Value = member.GetFamilytype();
                insertCommand.Parameters[5].Value = member.GetPasswd();

                mind.InsertUpdate(insertCommand);

                MessageBox.Show("등록이 완료되었습니다.\r(Registration is complete)",
                                "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);

                // DatagridView Refresh
                RefreshDataGrid();
            }
        }
Ejemplo n.º 4
0
        private void Btn_counselUpdate_Click(object sender, EventArgs e)
        {
            Boolean       state  = true;
            Counsel_table usrTbl = new Counsel_table();
            Crypt         crypt  = mind.GetCrypt();
            string        passwd = crypt.Encrypt(txt_counselorPasswd.Text);

            usrTbl.ID       = id;
            usrTbl.Subject  = txt_clientSubject.Text;
            usrTbl.Memo     = crypt.Encrypt(txt_clientMemo.Text);
            usrTbl.Comment  = txt_Comment.Text;
            usrTbl.Comdate  = DateTime.Now;
            usrTbl.MemberID = int.Parse(txt_counselorID.Text);

            if (txt_clientSubject.Text.Length == 0)
            {
                MessageBox.Show("제목을 입력하세요\r(Enter the subject)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (txt_clientMemo.Text.Length == 0 &&
                state == true)
            {
                MessageBox.Show("내용을 입력하세요\r(Enter the memo)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (txt_counselorPasswd.Text.Length == 0 &&
                state == true)
            {
                MessageBox.Show("상담자 비밀번호를 입력하세요\r(Enter the counselor password)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (mind.CheckPassword(passwd) == false &&
                state == true)
            {
                MessageBox.Show("비밀번호가 일치하지 않습니다.\r(Mismatch password.)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            // 추가 Query
            if (state == true)
            {
                string query = "UPDATE counsel_table set subject = @subject, " +
                               "memo = @memo, comment = @comment, comdate = @comdate where id = @id";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = query;
                cmd.Parameters.Add("@subject", MySqlDbType.VarChar, 50);
                cmd.Parameters.Add("@memo", MySqlDbType.Text);
                cmd.Parameters.Add("@comment", MySqlDbType.Text);
                cmd.Parameters.Add("@comdate", MySqlDbType.DateTime);
                cmd.Parameters.Add("@id", MySqlDbType.Int32, 11);

                cmd.Parameters[0].Value = usrTbl.Subject;
                cmd.Parameters[1].Value = usrTbl.Memo;
                cmd.Parameters[2].Value = crypt.Encrypt(usrTbl.Comment);
                cmd.Parameters[3].Value = DateTime.Now;
                cmd.Parameters[4].Value = counsel_Table.ID;

                mind.InsertUpdate(cmd);
                MessageBox.Show("성공적으로 수정되었습니다.\r(Successfully updated.)",
                                "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);


                this.Close();
                var myParent = (DetailShowFrm)this.Owner;
                myParent.ParentMethod();
            }
        }
Ejemplo n.º 5
0
        private void Btn_Update_Click(object sender, EventArgs e)
        {
            Boolean state  = true;
            Crypt   crypt  = mind.GetCrypt();
            string  passwd = crypt.Encrypt(txt_strPasswd.Text);

            Member member = new Member();

            member.SetName(txt_Name.Text);
            member.SetEmail(txt_Email.Text);
            member.SetBirthDate(dtp_birthdate.Value);
            member.SetPhone(txt_Phone.Text);
            member.SetFamilytype(cmb_familyType.GetItemText(this.cmb_familyType.SelectedItem));

            if (member.GetName().Length == 0)
            {
                MessageBox.Show("이름을 입력하세요\r(Enter the userName)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (member.GetEmail().Length == 0 && state == true)
            {
                MessageBox.Show("이메일을 입력하세요\r(Enter the email)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (txt_strPasswd.Text.Length == 0 &&
                state == true)
            {
                MessageBox.Show("상담자 비밀번호를 입력하세요\r(Enter the counselor password)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (mind.CheckPassword(passwd) == false &&
                state == true)
            {
                MessageBox.Show("비밀번호가 일치하지 않습니다.\r(Mismatch password.)", "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
                state = false;
            }

            if (state == true)
            {
                string query = "Update member set name = @name, " +
                               "email = @email, " +
                               "birthdate = @birthdate, phone = @phone, " +
                               "type = @type where id = @id and password = @password";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandText = query;

                cmd.Parameters.Add("@name", MySqlDbType.VarChar, 50);
                cmd.Parameters.Add("@email", MySqlDbType.VarChar, 100);
                cmd.Parameters.Add("@birthdate", MySqlDbType.DateTime);
                cmd.Parameters.Add("@phone", MySqlDbType.VarChar, 20);
                cmd.Parameters.Add("@type", MySqlDbType.VarChar, 20);
                cmd.Parameters.Add("@id", MySqlDbType.Int32, 11);
                cmd.Parameters.Add("@password", MySqlDbType.Text);

                cmd.Parameters[0].Value = member.GetName();
                cmd.Parameters[1].Value = member.GetEmail();
                cmd.Parameters[2].Value = member.GetBirthDate();
                cmd.Parameters[3].Value = member.GetPhone();
                cmd.Parameters[4].Value = member.GetFamilytype();
                cmd.Parameters[5].Value = member.GetID();
                cmd.Parameters[6].Value = member.GetPasswd();

                mind.InsertUpdate(cmd);
                MessageBox.Show("성공적으로 수정되었습니다.\r(It has been successfully modified.)",
                                "알림(Alert)", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }