Esempio n. 1
0
        /// <summary>
        /// 보내기 버튼 클릭시 발생하는 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">버튼 클릭</param>
        private void btn_send_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show(lbl_email.Text + "로 보내시겠습니까?", "메일", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (result == DialogResult.OK)
            {
                // mail 보내기
                // 보내는 메일주소
                MailAddress fromAddr = new MailAddress("*****@*****.**", "'JinTeam'", Encoding.UTF8);

                // 받는 메일주소
                var toAddr = new MailAddress("*****@*****.**", lbl_name.Text, Encoding.UTF8);
                //var toAddr = new MailAddress(lbl_email.Text, lbl_name.Text, Encoding.UTF8);
                // 얘로 나중에 바꿔야함


                // smtp.naver.com
                // Smtp 프로토콜 객체 생성
                // 이메일 보내기 허용 프로토콜 SmtpClient
                SmtpClient smtp = new SmtpClient("smtp.naver.com", 587);
                smtp.EnableSsl = true;  // SSL(Secure Service Line)

                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                smtp.Credentials    = new NetworkCredential("gss0053", "thwjdals0053");

                // 메일 메세지 객체 생성
                MailMessage msg = new MailMessage(fromAddr, toAddr);
                msg.Subject         = lbl_title.Text;
                msg.Body            = txt_body.Text;
                msg.BodyEncoding    = Encoding.UTF8;
                msg.SubjectEncoding = Encoding.UTF8;

                // 메일 보내기
                smtp.Send(msg);


                // DB업데이트
                Inquire_Admin_Vo ia_sub = new Inquire_Admin_Vo()
                {
                    Inquire_no = Int32.Parse(selectedRows[0].Cells[0].Value.ToString()),
                    //Cus_or_sell = selectedRows[0].Cells[5].Value.ToString(),
                    Re_body = txt_body.Text
                };


                if (new Admin_Dao().Update_state_ob(ia_sub, "inq"))
                {
                    MessageBox.Show("메일 발송완료");
                    Inquire_Admin_Detail iad = (Inquire_Admin_Detail)Owner;
                    iad.Temp = true;
                }
            }
            else
            {
                MessageBox.Show("취소 하셨습니다.");
            }
            Close();
        }
Esempio n. 2
0
        /// <summary>
        /// 메인 그리드뷰 에서 셀및 헤드라인 컬럼 클릭시 각각에 대한 이벤트
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">셀 클릭 및 해드라인 컬럼 클릭</param>
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Pro_Temp = false;
            //MessageBox.Show(e.RowIndex.ToString());
            if (e.ColumnIndex > -1)
            {
                if (e.RowIndex == -1)
                {
                    if (gb_pro.Visible)
                    {
                        // 0 상품 번호 4 가격 2 판매자 번호 9 추천수

                        if (main_GV.Columns[e.ColumnIndex].Index == 4)
                        {
                            main_GV.DataSource = null;
                            if (!switch_pro)
                            {
                                pro_lst.Sort(delegate(Products_Vo A, Products_Vo B)
                                {
                                    int a_value = Int32.Parse(A.Pro_Price.Replace(",", ""));
                                    int b_value = Int32.Parse(B.Pro_Price.Replace(",", ""));
                                    if (a_value > b_value)
                                    {
                                        return(-1);
                                    }
                                    else if (a_value < b_value)
                                    {
                                        return(1);
                                    }
                                    return(0);
                                });
                                switch_pro = true;
                            }
                            else
                            {
                                pro_lst.Sort(delegate(Products_Vo A, Products_Vo B)
                                {
                                    int a_value = Int32.Parse(A.Pro_Price.Replace(",", ""));
                                    int b_value = Int32.Parse(B.Pro_Price.Replace(",", ""));
                                    if (a_value > b_value)
                                    {
                                        return(1);
                                    }
                                    else if (a_value < b_value)
                                    {
                                        return(-1);
                                    }
                                    return(0);
                                });
                                switch_pro = false;
                            }
                            pro_GV();
                        }
                        else if (main_GV.Columns[e.ColumnIndex].Index == 2)
                        {
                            main_GV.DataSource = null;
                            if (!switch_pro)
                            {
                                pro_lst.Sort(delegate(Products_Vo A, Products_Vo B)
                                {
                                    if (A.Seller_NO > B.Seller_NO)
                                    {
                                        return(-1);
                                    }
                                    else if (A.Seller_NO < B.Seller_NO)
                                    {
                                        return(1);
                                    }
                                    return(0);
                                });
                                switch_pro = true;
                            }
                            else
                            {
                                pro_lst.Sort(delegate(Products_Vo A, Products_Vo B)
                                {
                                    if (A.Seller_NO > B.Seller_NO)
                                    {
                                        return(1);
                                    }
                                    else if (A.Seller_NO < B.Seller_NO)
                                    {
                                        return(-1);
                                    }
                                    return(0);
                                });
                                switch_pro = false;
                            }
                            pro_GV();
                            //MessageBox.Show(dataGridView1.Columns[e.ColumnIndex].HeaderText);
                        }
                        else if (main_GV.Columns[e.ColumnIndex].Index == 9)
                        {
                            main_GV.DataSource = null;
                            if (!switch_pro)
                            {
                                pro_lst.Sort(delegate(Products_Vo A, Products_Vo B)
                                {
                                    if (A.Pro_Like > B.Pro_Like)
                                    {
                                        return(-1);
                                    }
                                    else if (A.Pro_Like < B.Pro_Like)
                                    {
                                        return(1);
                                    }
                                    return(0);
                                });
                                switch_pro = true;
                            }
                            else
                            {
                                pro_lst.Sort(delegate(Products_Vo A, Products_Vo B)
                                {
                                    if (A.Pro_Like > B.Pro_Like)
                                    {
                                        return(1);
                                    }
                                    else if (A.Pro_Like < B.Pro_Like)
                                    {
                                        return(-1);
                                    }
                                    return(0);
                                });
                                switch_pro = false;
                            }
                            pro_GV();
                        }
                    }
                    else if (gb_seller.Visible)
                    {
                        // 0 번호
                        if (main_GV.Columns[e.ColumnIndex].Index == 0)
                        {
                            //MessageBox.Show(dataGridView1.Columns[e.ColumnIndex].Index + "");
                            main_GV.DataSource = null;
                            if (!switch_pro)
                            {
                                sell_lst.Sort(delegate(Seller_Vo A, Seller_Vo b)
                                {
                                    if (A.Seller_NO > b.Seller_NO)
                                    {
                                        return(-1);
                                    }
                                    else if (A.Seller_NO < b.Seller_NO)
                                    {
                                        return(1);
                                    }
                                    return(0);
                                });
                                switch_pro = true;
                            }
                            else
                            {
                                sell_lst.Sort(delegate(Seller_Vo A, Seller_Vo b)
                                {
                                    if (A.Seller_NO > b.Seller_NO)
                                    {
                                        return(1);
                                    }
                                    else if (A.Seller_NO < b.Seller_NO)
                                    {
                                        return(-1);
                                    }
                                    return(0);
                                });
                                switch_pro = false;
                            }
                            sell_GV();
                        }
                    }
                    else if (gb_cus.Visible) // gb_cus.visible
                    {
                        //MessageBox.Show(dataGridView1.Columns[e.ColumnIndex].Index + "");
                        // 0 번호 8 나이
                        if (main_GV.Columns[e.ColumnIndex].Index == 0)
                        {
                            //MessageBox.Show(dataGridView1.Columns[e.ColumnIndex].Index + "");
                            main_GV.DataSource = null;
                            if (!switch_pro)
                            {
                                cus_lst.Sort(delegate(Customers_Vo A, Customers_Vo b)
                                {
                                    if (A.Cus_no > b.Cus_no)
                                    {
                                        return(-1);
                                    }
                                    else if (A.Cus_no < b.Cus_no)
                                    {
                                        return(1);
                                    }
                                    return(0);
                                });
                                switch_pro = true;
                            }
                            else
                            {
                                cus_lst.Sort(delegate(Customers_Vo A, Customers_Vo b)
                                {
                                    if (A.Cus_no > b.Cus_no)
                                    {
                                        return(1);
                                    }
                                    else if (A.Cus_no < b.Cus_no)
                                    {
                                        return(-1);
                                    }
                                    return(0);
                                });
                                switch_pro = false;
                            }
                            cus_GV();
                        }
                        else if (main_GV.Columns[e.ColumnIndex].Index == 8)
                        {
                            main_GV.DataSource = null;
                            if (!switch_pro)
                            {
                                cus_lst.Sort(delegate(Customers_Vo A, Customers_Vo b)
                                {
                                    if (A.Cus_age > b.Cus_age)
                                    {
                                        return(-1);
                                    }
                                    else if (A.Cus_age < b.Cus_age)
                                    {
                                        return(1);
                                    }
                                    return(0);
                                });
                                switch_pro = true;
                            }
                            else
                            {
                                cus_lst.Sort(delegate(Customers_Vo A, Customers_Vo b)
                                {
                                    if (A.Cus_age > b.Cus_age)
                                    {
                                        return(1);
                                    }
                                    else if (A.Cus_age < b.Cus_age)
                                    {
                                        return(-1);
                                    }
                                    return(0);
                                });
                                switch_pro = false;
                            }
                            cus_GV();
                        }
                    }
                    else if (tax_switch)
                    {
                        // 0 번호 5 가격 6 수량
                        if (main_GV.Columns[e.ColumnIndex].Index == 0)
                        {
                            main_GV.DataSource = null;
                            if (!switch_pro)
                            {
                                tax_lst.Sort(delegate(TaxBill_Vo A, TaxBill_Vo B)
                                {
                                    if (A.Pay_ID > B.Pay_ID)
                                    {
                                        return(-1);
                                    }
                                    else if (A.Pay_ID < B.Pay_ID)
                                    {
                                        return(1);
                                    }
                                    return(0);
                                });
                                switch_pro = true;
                            }
                            else
                            {
                                tax_lst.Sort(delegate(TaxBill_Vo A, TaxBill_Vo B)
                                {
                                    if (A.Pay_ID > B.Pay_ID)
                                    {
                                        return(1);
                                    }
                                    else if (A.Pay_ID < B.Pay_ID)
                                    {
                                        return(-1);
                                    }
                                    return(0);
                                });
                                switch_pro = false;
                            }
                            pay_GV();
                        }
                        else if (main_GV.Columns[e.ColumnIndex].Index == 5)
                        {
                            main_GV.DataSource = null;
                            if (!switch_pro)
                            {
                                tax_lst.Sort(delegate(TaxBill_Vo A, TaxBill_Vo B)
                                {
                                    var a_value = Int32.Parse(A.Pay_price.Replace(",", ""));
                                    var b_value = Int32.Parse(B.Pay_price.Replace(",", ""));
                                    if (a_value > b_value)
                                    {
                                        return(-1);
                                    }
                                    else if (a_value < b_value)
                                    {
                                        return(1);
                                    }
                                    return(0);
                                });
                                switch_pro = true;
                            }
                            else
                            {
                                tax_lst.Sort(delegate(TaxBill_Vo A, TaxBill_Vo B)
                                {
                                    var a_value = Int32.Parse(A.Pay_price.Replace(",", ""));
                                    var b_value = Int32.Parse(B.Pay_price.Replace(",", ""));
                                    if (a_value > b_value)
                                    {
                                        return(1);
                                    }
                                    else if (a_value < b_value)
                                    {
                                        return(-1);
                                    }
                                    return(0);
                                });
                                switch_pro = false;
                            }

                            pay_GV();
                        }
                        else if (main_GV.Columns[e.ColumnIndex].Index == 6)
                        {
                            main_GV.DataSource = null;
                            if (!switch_pro)
                            {
                                tax_lst.Sort(delegate(TaxBill_Vo A, TaxBill_Vo B)
                                {
                                    if (A.Pay_count > B.Pay_count)
                                    {
                                        return(-1);
                                    }
                                    else if (A.Pay_count < B.Pay_count)
                                    {
                                        return(1);
                                    }
                                    return(0);
                                });
                                switch_pro = true;
                            }
                            else
                            {
                                tax_lst.Sort(delegate(TaxBill_Vo A, TaxBill_Vo B)
                                {
                                    if (A.Pay_count > B.Pay_count)
                                    {
                                        return(1);
                                    }
                                    else if (A.Pay_count < B.Pay_count)
                                    {
                                        return(-1);
                                    }
                                    return(0);
                                });
                                switch_pro = false;
                            }

                            pay_GV();
                        }
                    }
                    else if (gb_inq.Visible)
                    {
                    }
                }
                else
                {
                    if (gb_seller.Visible)
                    {
                        Seller_Detail sd = new Seller_Detail(sell_lst[e.RowIndex]);
                        sd.Owner = this;
                        sd.ShowDialog();
                        //sell_GV();
                    }
                    else if (gb_pro.Visible)
                    {
                        Pro_Detail pd = new Pro_Detail(pro_lst[e.RowIndex], pro_temp);
                        pd.Owner = this;
                        pd.ShowDialog();
                        //dataGridView1.Columns["pro_state"].

                        //pro_GV();
                    }
                    else if (gb_cus.Visible)        // gb_cus.visible
                    {
                        Cus_Detail cd = new Cus_Detail(cus_lst[e.RowIndex]);
                        cd.ShowDialog();
                        //cus_GV();
                    }
                    else if (tax_switch)
                    {
                        Tax_Ex te = new Tax_Ex(tax_lst[e.RowIndex]);
                        te.Owner = this;
                        te.ShowDialog();
                    }
                    else if (gb_inq.Visible)
                    {
                        //main_GV.SelectedRows
                        Inquire_Admin_Detail iad = new Inquire_Admin_Detail(main_GV.SelectedRows);
                        iad.Owner = this;
                        iad.ShowDialog();
                        //MessageBox.Show("Test");
                    }

                    if (Pro_Temp)
                    {
                        btn_Refresh_Click(null, null);
                    }
                }
            }
        }