예제 #1
0
파일: FormOsPayment.cs 프로젝트: kyas21/FTB
        private bool savePaymentData(DataGridView dgv)
        {
            int procCnt = 0;

            opd = new OsPaymentData();

            opd = moveCommonData();
            CostReportData crp = new CostReportData();

            for (int i = 0; i < dgv.Rows.Count; i++)
            {
                if (Convert.ToString(dgv.Rows[i].Cells["ItemCode"].Value) == "")
                {
                    continue;
                }

                opd = moveIndividualData(dataGridView1.Rows[i]);
                if (Convert.ToString(dgv.Rows[i].Cells["PaymentID"].Value) == "")
                {
                    if (!opd.InsertPayment())
                    {
                        return(false);
                    }
                    dgv.Rows[i].Cells["PaymentID"].Value = Convert.ToString(opd.OsPaymentID);
                }
                else
                {
                    opd.OsPaymentID = Convert.ToInt32(dgv.Rows[i].Cells["PaymentID"].Value);
                    if (!opd.UpdatePayment())
                    {
                        return(false);
                    }
                }
                procCnt++;
            }

            if (procCnt == 0)
            {
                MessageBox.Show("処理対象のデータはありませんでした!");
                return(false);
            }
            return(true);
        }