private void btnSave_Click(object sender, EventArgs e) { customerBindingSource.EndEdit(); customerTableAdapter.Update(farmManageDataSet.Customer); orderInBindingSource.EndEdit(); orderInTableAdapter.Update(farmManageDataSet.OrderIn); var userLogTableAdapter = new UserLogTableAdapter(); userLogTableAdapter.Insert(TypeUtil.OrderIn, OrderInID.ToString(), MainForm.User.UserID, 1, DateTime.Now); DialogResult = DialogUtil.SaveSuccess(); }
private void InOrderForm_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'farmManageDataSet.UsersView' table. You can move, or remove it, as needed. this.usersViewTableAdapter.Fill(this.farmManageDataSet.UsersView); this.cbxPrename.DataSource = TypeUtil.Prename().ToList(); this.cbxOrderType.DataSource = TypeUtil.InOrderType().ToList(); this.cbxBankType.DataSource = TypeUtil.AccountType().ToList(); this.cbxPaymentType.DataSource = TypeUtil.InPaymentType().ToList(); this.cbxPaymentStatus.DataSource = TypeUtil.InPaymentStatus().ToList(); this.cbxTransportType.DataSource = TypeUtil.InTransportType().ToList(); this.colCowSex.ValueMember = "Key"; this.colCowSex.DisplayMember = "Value"; this.colCowSex.DataSource = TypeUtil.CowSex().ToList(); // TODO: This line of code loads data into the 'farmManageDataSet.Customer' table. You can move, or remove it, as needed. this.customerTableAdapter.FillByOrderInID(this.farmManageDataSet.Customer, this.OrderInID); // TODO: This line of code loads data into the 'farmManageDataSet.PostCode' table. You can move, or remove it, as needed. this.postCodeTableAdapter.Fill(this.farmManageDataSet.PostCode); // TODO: This line of code loads data into the 'farmManageDataSet.City' table. You can move, or remove it, as needed. this.cityTableAdapter.Fill(this.farmManageDataSet.City); // TODO: This line of code loads data into the 'farmManageDataSet.District' table. You can move, or remove it, as needed. this.districtTableAdapter.Fill(this.farmManageDataSet.District); // TODO: This line of code loads data into the 'farmManageDataSet.Province' table. You can move, or remove it, as needed. this.provinceTableAdapter.Fill(this.farmManageDataSet.Province); // TODO: This line of code loads data into the 'farmManageDataSet.Company' table. You can move, or remove it, as needed. this.companyTableAdapter.Fill(this.farmManageDataSet.Company); // TODO: This line of code loads data into the 'farmManageDataSet.UsersView' table. You can move, or remove it, as needed. this.usersViewTableAdapter.Fill(this.farmManageDataSet.UsersView); // TODO: This line of code loads data into the 'farmManageDataSet.Province' table. You can move, or remove it, as needed. this.provinceTableAdapter.Fill(this.farmManageDataSet.Province); // TODO: This line of code loads data into the 'farmManageDataSet.BankAccount' table. You can move, or remove it, as needed. this.bankAccountTableAdapter.Fill(this.farmManageDataSet.BankAccount); // TODO: This line of code loads data into the 'farmManageDataSet.Gene' table. You can move, or remove it, as needed. this.geneTableAdapter.Fill(farmManageDataSet.Gene); // TODO: This line of code loads data into the 'farmManageDataSet.Corral' table. You can move, or remove it, as needed. this.corralTableAdapter.Fill(farmManageDataSet.Corral); // TODO: This line of code loads data into the 'farmManageDataSet.Cow' table. You can move, or remove it, as needed. this.cowTableAdapter.Fill(farmManageDataSet.Cow); // TODO: This line of code loads data into the 'farmManageDataSet.OrderIn' table. You can move, or remove it, as needed. this.orderInTableAdapter.FillByPK(farmManageDataSet.OrderIn, OrderInID); if (!MainForm.User.SuperUser) { this.tcMain.TabPages.Remove(this.tabRecord); } else { this.userLogUC.FillEvent(TypeUtil.OrderIn, OrderInID.ToString()); } var CurrentRow = ((orderInBindingSource.Current as DataRowView).Row as FarmManageDataSet.OrderInRow); tbxTotalAmount.Text = (CurrentRow.TransportCost + CurrentRow.Amount).ToString("C2"); switch (CurrentRow.PaymentStatus) { case 0: this.cbxPaymentStatus.Enabled = true; this.btnPrintBill.Enabled = false; break; case 1: this.cbxBankNO.Enabled = false; this.cbxPaymentStatus.Enabled = false; this.dtpPaymentDate.Enabled = false; this.cbxPaymentBy.Enabled = false; this.cbxPaymentType.Enabled = false; this.btnSave.Visible = false; this.btnCancel.Text = "ปิด"; this.btnPrintBill.Enabled = true; break; } switch (CurrentRow.OrderType) { case 0: break; case 1: break; case 2: this.Text = "รายละเอียดการคลอดลูก"; this.lblTitle.Text = "รายละเอียดการคลอดลูก"; this.tabCow.Text = "รายการคลอดลูก"; this.btnSave.Visible = false; this.btnCancel.Text = "ปิด"; this.btnPrintBill.Enabled = true; this.tcMain.TabPages.Remove(tabCustomer); this.gbxPayment.Visible = false; return; } }