コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txt_excel_title.Text == null || txt_excel_title.ToString().Equals("") || txt_excel_title.Text.ToString().Length == 0)
                {
                    MessageBox.Show("[엑셀제목] 을 입력해주세요.");
                    return;
                }



                if (lbl_input_gubun.Text == null || !lbl_input_gubun.Text.ToString().Equals("1") || lbl_input_gubun.Text.ToString().Length == 0)
                {
                    bool isValue = false;
                    for (int i = 0; i < BillGrid.Rows.Count; i++)
                    {
                        if ((bool)BillGrid.Rows[i].Cells["선택"].Value == true)
                        {
                            isValue = true;
                        }
                        else
                        {
                            BillGrid.Rows.RemoveAt(i);
                            i--;
                        }
                    }
                    if (!isValue)
                    {
                        MessageBox.Show("최소 하나이상의 항목을 선택하여주십시오.");
                        return;
                    }

                    wnDm wDm   = new wnDm();
                    int  rsNum = wDm.insert_Excel_input(
                        txt_publish_date.Text.ToString()
                        , txt_excel_title.Text.ToString()
                        , cmb_vat_gubun.SelectedValue.ToString()
                        , BillGrid
                        );

                    if (rsNum == 0)
                    {
                        resetSetting();
                    }
                    else if (rsNum == 1)
                    {
                        MessageBox.Show("저장에 실패하였습니다");
                        LoadBillGrid();
                    }
                    else
                    {
                        MessageBox.Show("sql 에러");
                    }
                }

                else
                {
                    wnDm wDm   = new wnDm();
                    int  rsNum = wDm.Update_Excel_input(
                        txt_publish_date.Text.ToString()
                        , txt_publish_cd.Text.ToString()
                        , txt_excel_title.Text.ToString()
                        );

                    if (rsNum == 0)
                    {
                        resetSetting();
                    }
                    else if (rsNum == 1)
                    {
                        MessageBox.Show("저장에 실패하였습니다");
                    }
                    else
                    {
                        MessageBox.Show("sql 에러");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception 오류");
                Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
                return;
            }
        }