Esempio n. 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            PalletDialog palletDialog = new PalletDialog();
            if (palletDialog.ShowDialog() == DialogResult.OK)
            {
                DataRow row = masterTable.NewRow();

                row["BILLDATE"] = palletDialog.BillDate;
                row["BILLTYPE"] = "001";
                row["BILLNAME"] = "��ⵥ";
                row["WAREHOUSECODE"] = palletDialog.WarehouseCode;
                row["WAREHOUSENAME"] = palletDialog.WarehouseName;
                row["STATUS"] = "0";//�ֹ�����
                row["STATUSNAME"] = "�ֹ�����";
                row["STATE"] = "1";
                row["STATEDESC"] = "����";
                row["USERNAME"] = UserName;
                row["OPERATEDATE"] = SysDate;
                try
                {
                    palletDal.AddBill(row, UserID, palletDialog.DetailTable);
                    masterTable.Rows.InsertAt(row, 0);
                    bsMain.Position = 0;
                }
                catch (Exception exp)
                {
                    THOKUtil.ShowInfo("������ⵥʧ�ܣ�ԭ��" + exp.Message);
                }
            }
        }
Esempio n. 2
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (dgvMaster.CurrentRow != null)
            {
                DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
                PalletDialog palletDialog = new PalletDialog(masterRow["BILLNO"].ToString(),
                                                        masterRow["WAREHOUSECODE"].ToString(),
                                                        masterRow["WAREHOUSENAME"].ToString(),
                                                        detailTable,
                                                        masterRow["STATE"].ToString() == "1");
                if (palletDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        palletDal.SaveBill(masterRow["BILLNO"].ToString(), UserID, palletDialog.DetailTable);
                        masterRow["USERNAME"] = UserName;
                        detailTable = palletDialog.DetailTable;

                    }
                    catch (Exception exp)
                    {
                        THOKUtil.ShowInfo("������ⵥʧ�ܣ�ԭ��" + exp.Message);
                    }
                }
                else
                    detailTable.RejectChanges();
            }
        }