예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AlcoholizeDialog billDialog = new AlcoholizeDialog();

            if (billDialog.ShowDialog() == DialogResult.OK)
            {
                DataRow row = masterTable.NewRow();
                row["BILLDATE"] = billDialog.BillDate;
                row["BILLTYPE"] = "002";
                row["BILLNAME"] = "���ⵥ";
                row["SCHEDULENO"] = billDialog.ScheduleNo;
                row["ORIBILLNO"] = billDialog.ScheduleCode;
                row["STATUS"] = "0";
                row["STATE"] = "1";
                row["STATEDESC"] = "����";
                row["OPERATER"] = UserID;
                row["USERNAME"] = UserName;
                row["OPERATEDATE"] = SysDate;
                try
                {
                    billDal.AddBill(row, billDialog.DetailTable, billDialog.ProductState, "C", billDialog.BillDate);
                    masterTable.Rows.InsertAt(row, 0);
                    bsMain.Position = 0;
                }
                catch (Exception exp)
                {
                    THOKUtil.ShowInfo("���������ⵥ��ʧ�ܣ�ԭ��" + exp.Message);
                }
            }
        }
예제 #2
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (dgvMaster.CurrentRow != null)
            {
                DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
                string billNo = masterRow["BILLNO"].ToString();

                DataTable table = billDal.GetDetail(billNo, UserID);

                AlcoholizeDialog billDialog = new AlcoholizeDialog(billNo,
                                                    masterRow["BILLDATE"].ToString(),
                                                    masterRow["SCHEDULENO"].ToString(),
                                                    table,
                                                    masterRow["STATE"].ToString().Trim() == "1");
                if (billDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        //masterRow["OPERATER"] = UserID;
                        //masterRow["USERNAME"] = UserName;
                        //masterRow["OPERATEDATE"] = SysDate;
                        masterRow["SCHEDULENO"] = billDialog.ScheduleNo.ToString();
                        billDal.SaveAlcoholizeBill(masterRow, billDialog.DetailTable, billDialog.ProductState, UserID);
                        detailTable = billDal.GetDetail(billNo);
                        bsDetail.DataSource = detailTable;
                    }
                    catch (Exception exp)
                    {
                        THOKUtil.ShowInfo("���洼���ⵥ��ʧ�ܣ�ԭ��" + exp.Message);
                    }
                }
                else
                    detailTable.RejectChanges();
            }
        }