예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                wnDm wDm   = new wnDm();
                int  rsNum = -1;

                DataTable dt       = wDm.fn_Saup_List(Common.p_saupNo);
                string    flagship = "";
                if (dt != null && dt.Rows.Count > 0)
                {
                    flagship = dt.Rows[0]["FLAGSHIP"].ToString();
                }
                else
                {
                    MessageBox.Show("사업자관리에서 사업자 정보를 먼저 작성해주십시오.");
                    return;
                }

                if (SalesGrid.Rows[0].Cells["공급가액"].Value == null || SalesGrid.Rows[0].Cells["공급가액"].Value.ToString().Equals(""))
                {
                    lblMsg.Visible = true;
                    Application.DoEvents();
                    rsNum          = wDm.Insert_Escalation_Card_Soo(txt_Escalation_date.Text, start_date.Text, end_date.Text, SalesGrid, flagship);
                    lblMsg.Visible = false;
                }
                else
                {
                    lblMsg.Visible = true;
                    Application.DoEvents();
                    rsNum          = wDm.Insert_Escalation_Not_Card_Soo(txt_Escalation_date.Text, start_date.Text, end_date.Text, SalesGrid, flagship);
                    lblMsg.Visible = false;
                }

                if (rsNum == 0)
                {
                    MessageBox.Show("성공적으로 등록하였습니다.");
                    SalesGrid.Rows.Clear();
                    SalesDetailGrid.Rows.Clear();
                }
                else if (rsNum == 1)
                {
                    MessageBox.Show("저장에 실패하였습니다");
                }
                else
                {
                    MessageBox.Show("Exception 에러");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception 오류");
                Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
            }
        }