private void btnSave_Click(object sender, EventArgs e) { Convert.ToByte(cbxOrderType.SelectedValue); Convert.ToByte(cbxPaymentStatus.SelectedValue); orderOutBindingSource.EndEdit(); orderOutTableAdapter.Update(farmManageDataSet.OrderOut); var log = new UserLogTableAdapter(); log.Insert(TypeUtil.OrderOut, OrderOutID.ToString(), MainForm.User.UserID, 1, DateTime.Now); DialogResult = DialogUtil.SaveSuccess(); }
private void OutOrderForm_Load(object sender, EventArgs e) { // 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.Customer' table. You can move, or remove it, as needed. this.customerTableAdapter.FillByOrderOutID(this.farmManageDataSet.Customer, this.OrderOutID); // 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.Gene' table. You can move, or remove it, as needed. this.geneTableAdapter.Fill(this.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(this.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(this.farmManageDataSet.Cow); // TODO: This line of code loads data into the 'farmManageDataSet.OrderOut' table. You can move, or remove it, as needed. this.orderOutTableAdapter.FillByPK(this.farmManageDataSet.OrderOut, this.OrderOutID); this.cbxOrderType.Enabled = false; this.cbxTransportType.Enabled = false; this.cbxOrderBy.Enabled = false; this.dtpDate.Enabled = false; this.tbxAmount.ReadOnly = true; this.tbxTransportNO.ReadOnly = true; this.tbxTransportCost.ReadOnly = true; this.tbxTransportIssueBy.ReadOnly = true; if (!MainForm.User.SuperUser) { this.tcMain.TabPages.Remove(this.tabRecord); } else { this.userLogUC.FillEvent(TypeUtil.OrderOut, OrderOutID.ToString()); } var CurrentRow = (FarmManageDataSet.OrderOutRow)((orderOutBindingSource.Current as DataRowView).Row); this.tbxTotalAmount.Text = (CurrentRow.TransportCost + CurrentRow.Amount).ToString("C2"); switch (CurrentRow.PaymentStatus) { case 0: if (CurrentRow.OrderType != 2) { this.cbxPaymentStatus.Enabled = true; this.btnPrintBill.Enabled = false; } break; case 1: if (CurrentRow.OrderType != 2) { 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.tabCowList.Text = "รายการคลอดลูก"; this.btnSave.Visible = false; this.btnCancel.Text = "ปิด"; this.btnPrintBill.Enabled = true; this.tcMain.TabPages.Remove(tabCustomer); this.gbxPayment.Visible = false; return; } Double Earnings = 0, CowOrderInAmount = 0; foreach (DataGridViewRow vRow in this.dataCowList.Rows) { CowOrderInAmount += (Double)vRow.Cells["colCowOrderInAmount"].Value; Earnings += ((Double)vRow.Cells["colCowOrderOutAmount"].Value - (Double)vRow.Cells["colCowOrderInAmount"].Value); } tbxEr.Text = Earnings.ToString("C2"); tbxOrderInAmount.Text = CowOrderInAmount.ToString("C2"); }