private void goodsEntryResetBtn_Click(object sender, EventArgs e) { GoodsEntry goodsEntry = new GoodsEntry(); goodsEntry.Show(); this.Close(); }
//Saving the goods entry details into database; // TRDR_ID;itemSelected;wtSelected;isTransportSetails; will be selected at run time private void goodsEntrySaveBtn_Click(object sender, EventArgs e) { String WT_TXT = wtTxt.Text.ToString(); String WT_BOX_TYPE = wtSelected; String ITEM_NAME = itemSelected; String LOT_1 = lot1_txt.Text.ToString(); String LOT_2 = lot2_txt.Text.ToString(); String LOT_3 = lot3_txt.Text.ToString(); String LOT_4 = lot4_txt.Text.ToString(); String LOT_5 = lot5_txt.Text.ToString(); String SHORT_BOX = shortBoxTxt.Text.ToString(); String QTY_RCVD = totallotCount_txt.Text.ToString(); String ORIGIN = goodEntryOriginTxt.Text.ToString(); String FARE_RATE = fareRateTxt.Text.ToString(); String VEHICLE_NO = vehicleNoTxt.Text.ToString(); String LOGISTIC_DETAILS = isTransportSetails; String TOTAL_FARE = totalFareTxt.Text.ToString(); DateTime date = dateTimePicker.Value; String RECV_DATE = DateHelper.getSqlString(date); String LOT_NO_SHORT = lotNoShortSelected; if (String.IsNullOrEmpty(TRDR_ID) || String.IsNullOrEmpty(TRDR_FNAME_TMARK)) { errorProvider1.SetError(goodsEntryTradercomboBox, "Please Select Trader"); return; } if (String.IsNullOrEmpty(itemSelected)) { errorProvider1.SetError(goodsEntryItemcomboBox, "Please Select Item"); return; } if (String.IsNullOrEmpty(wtSelected)) { errorProvider1.SetError(goodsEntryWtcomboBox, "Please Select Box"); return; } if (String.IsNullOrEmpty(WT_TXT)) { errorProvider1.SetError(wtTxt, "Please Enter Wt"); return; } if (String.IsNullOrEmpty(LOT_1)) { errorProvider1.SetError(lot1_txt, "Please Enter lot"); return; } if (String.IsNullOrEmpty(shortBoxTxt.Text.ToString()) && !(String.IsNullOrEmpty(lotNoShortSelected))) { errorProvider1.SetError(shortBoxTxt, "Enter No of Short Box"); return; } if (!(String.IsNullOrEmpty(shortBoxTxt.Text.ToString())) && (String.IsNullOrEmpty(lotNoShortSelected))) { errorProvider1.SetError(lotNoShortComboBox, "Enter Lot No Shorted."); return; } if (!(String.IsNullOrEmpty(lotNoShortSelected)) && !(String.IsNullOrEmpty(shortBoxTxt.Text.ToString()))) { int val = int.Parse(lotNoShortSelected); if (int.Parse(lotNoShortSelected) == 1) { if (String.IsNullOrEmpty(lot1_txt.Text.ToString())) { errorProvider1.SetError(lot1_txt, "Enter Lot No"); return; } } if (int.Parse(lotNoShortSelected) == 2) { if (String.IsNullOrEmpty(lot2_txt.Text.ToString())) { errorProvider1.SetError(lot2_txt, "Enter Lot No"); return; } } if (int.Parse(lotNoShortSelected) == 3) { if (String.IsNullOrEmpty(lot3_txt.Text.ToString())) { errorProvider1.SetError(lot3_txt, "Enter Lot No"); return; } } if (int.Parse(lotNoShortSelected) == 4) { if (String.IsNullOrEmpty(lot4_txt.Text.ToString())) { errorProvider1.SetError(lot4_txt, "Enter Lot No"); return; } } if (int.Parse(lotNoShortSelected) == 5) { if (String.IsNullOrEmpty(lot5_txt.Text.ToString())) { errorProvider1.SetError(lot5_txt, "Enter Lot No"); return; } } } if (String.Equals(isTransportSetails, "YES")) { if (String.IsNullOrEmpty(ORIGIN)) { errorProvider1.SetError(goodEntryOriginTxt, "Please Enter Origin"); return; } if (String.IsNullOrEmpty(VEHICLE_NO)) { errorProvider1.SetError(vehicleNoTxt, "Please Enter Truck No"); return; } if (String.IsNullOrEmpty(FARE_RATE)) { errorProvider1.SetError(fareRateTxt, "Please Enter Fare Rate"); return; } } GoodsEntryDataLoad goodsEntryDataLoad = new GoodsEntryDataLoad(); if (goodsEntryDataLoad.saveGoodsEntryData(TRDR_ID, ITEM_NAME, WT_BOX_TYPE, WT_TXT, LOT_1, LOT_2, LOT_3, LOT_4, LOT_5, LOGISTIC_DETAILS, SHORT_BOX, QTY_RCVD, ORIGIN, VEHICLE_NO, FARE_RATE, TOTAL_FARE, RECV_DATE, TRDR_FNAME_TMARK, LOT_NO_SHORT)) { MessageBox.Show("Goods Entry Saved Successfully"); GoodsEntry goodsEntry = new GoodsEntry(); goodsEntry.Show(); this.Close(); } else { MessageBox.Show("Goods Entry Not Saved"); } }