private void txtBoxNumber_TextChanged(object sender, EventArgs e) { TextBox oTxt = sender as TextBox; if (oTxt != null && formloaded) { if (oTxt.Text.Length > 0) { using (var context = new TTI2Entities()) { var BoxDetails = context.TLCSV_StockOnHand.Where(x => x.TLSOH_BoxNumber == txtBoxNumber.Text).FirstOrDefault(); if (BoxDetails != null) { if (BoxDetails.TLSOH_Picked) { MessageBox.Show("This Box has already been picked. No further modification allowed"); btnSave.Enabled = false; return; } btnSave.Enabled = true; txtStyle.Text = context.TLADM_Styles.Find(BoxDetails.TLSOH_Style_FK).Sty_Description; txtColour.Text = context.TLADM_Colours.Find(BoxDetails.TLSOH_Colour_FK).Col_Display; txtSize.Text = context.TLADM_Sizes.Find(BoxDetails.TLSOH_Size_FK).SI_Description; txtBoxedQty.Text = BoxDetails.TLSOH_BoxedQty.ToString(); SOH = BoxDetails; } } } } }
private void frmBoxStyleAdjustment_Load(object sender, EventArgs e) { FormLoaded = false; using (var context = new TTI2Entities()) { cmboStyle.DataSource = context.TLADM_Styles.OrderBy(x => x.Sty_Description).ToList(); cmboStyle.ValueMember = "Sty_Id"; cmboStyle.DisplayMember = "Sty_Description"; cmboStyle.SelectedIndex = -1; } FormLoaded = true; oStockOH = null; radStyle.Checked = true; }
private void oBoxNumber_TextChanged(object sender, EventArgs e) { TextBox oTBox = sender as TextBox; if (oTBox != null && FormLoaded) { using (var context = new TTI2Entities()) { var SOH = context.TLCSV_StockOnHand.Where(x => x.TLSOH_BoxNumber == oTBox.Text).FirstOrDefault(); if (SOH != null) { FormLoaded = false; oStockOH = SOH; txtStyle.Text = context.TLADM_Styles.Find(oStockOH.TLSOH_Style_FK).Sty_Description; txtColour.Text = context.TLADM_Colours.Find(oStockOH.TLSOH_Colour_FK).Col_Description; txtSize.Text = context.TLADM_Sizes.Find(oStockOH.TLSOH_Size_FK).SI_Description; cmboStyle.SelectedValue = oStockOH.TLSOH_Style_FK; FormLoaded = true; } } } }
private void btnSave_Click(object sender, EventArgs e) { Button oBtn = sender as Button; if (oBtn != null && FormLoaded) { var Selected = (TLADM_WhseStore)cmboWarehouses.SelectedItem; if (Selected == null) { MessageBox.Show("Please select a warehouse from the combobox provided"); return; } using (var context = new TTI2Entities()) { foreach (DataGridViewRow Row in dataGridView1.Rows) { if (Row.Cells[0].Value == null) { continue; } var RWComplete = core.RowComplete(Row, MandatoryFields); var cnt = RWComplete.Where(x => x == false).Count(); if (cnt == MandatoryFields.Length) { continue; } if (cnt != 0) { var errorM = core.returnMessage(RWComplete, true, MandatoryFields); if (!string.IsNullOrEmpty(errorM)) { MessageBox.Show(errorM, "Error Message for Line No" + (Row.Index + 1).ToString()); return; } } TLCSV_StockOnHand SOH = new TLCSV_StockOnHand(); var Style_FK = (int)Row.Cells[1].Value; var Colour_FK = (int)Row.Cells[2].Value; var Size_FK = (int)Row.Cells[3].Value; TLADM_Styles Styles = context.TLADM_Styles.Find(Style_FK); TLADM_Colours Colours = context.TLADM_Colours.Find(Colour_FK); TLADM_Sizes Sizes = context.TLADM_Sizes.Find(Size_FK); SOH.TLSOH_PastelNumber = Styles.Sty_PastelNo + Colours.Col_FinishedCode + "NG" + Sizes.SI_PastelNo; SOH.TLSOH_BoxNumber = Row.Cells[0].Value.ToString(); SOH.TLSOH_Style_FK = (int)Row.Cells[1].Value; SOH.TLSOH_Colour_FK = (int)Row.Cells[2].Value; SOH.TLSOH_Size_FK = (int)Row.Cells[3].Value; SOH.TLSOH_CMT_FK = (int)Row.Cells[4].Value; SOH.TLSOH_Weight = (decimal)Row.Cells[5].Value; SOH.TLSOH_BoxedQty = Convert.ToInt32(Row.Cells[6].Value.ToString()); SOH.TLSOH_Grade = Row.Cells[7].Value.ToString().ToUpper().Trim(); SOH.TLSOH_BoxType = 1; SOH.TLSOH_DateIntoStock = dtpTransdate.Value; SOH.TLSOH_WareHouse_FK = Selected.WhStore_Id; if (SOH.TLSOH_Grade.Contains("A")) { SOH.TLSOH_Is_A = true; } var Cwork = context.TLCMT_CompletedWork.Where(x => x.TLCMTWC_BoxNumber == SOH.TLSOH_BoxNumber).FirstOrDefault(); if (Cwork != null) { SOH.TLSOH_CutSheet_FK = Cwork.TLCMTWC_CutSheet_FK; } var Already = context.TLCSV_StockOnHand.Where(x => x.TLSOH_BoxNumber == SOH.TLSOH_BoxNumber).FirstOrDefault(); if (Already != null) { if (!Already.TLSOH_Write_Off) { continue; } } context.TLCSV_StockOnHand.Add(SOH); } try { context.SaveChanges(); MessageBox.Show("Data successfully save to the database"); cmboWarehouses.SelectedItem = -1; dataGridView1.Rows.Clear(); frmStockTakeOn_Load(this, null); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } } }
private void btnSubmit_Click(object sender, EventArgs e) { Button oBtn = (Button)sender; if (oBtn != null && Formloaded) { using (var context = new TTI2Entities()) { string BoxNumber = txtBoxNumber.Text.ToString(); TLCSV_StockOnHand SOH = context.TLCSV_StockOnHand.Where(x => x.TLSOH_BoxNumber == BoxNumber).FirstOrDefault(); if (SOH != null) { frmBoxView_Load(this, null); txtWareHouse.Text = context.TLADM_WhseStore.Find(SOH.TLSOH_WareHouse_FK).WhStore_Description; txtColour.Text = context.TLADM_Colours.Find(SOH.TLSOH_Colour_FK).Col_Display; txtGrade.Text = SOH.TLSOH_Grade; txtSize.Text = context.TLADM_Sizes.Find(SOH.TLSOH_Size_FK).SI_Description; txtStyle.Text = context.TLADM_Styles.Find(SOH.TLSOH_Style_FK).Sty_Description; txtPickingList.Text = SOH.TLSOH_WareHousePickList + " / " + SOH.TLSOH_PickListNo; txtDeliveryNote.Text = SOH.TLSOH_WareHouseDeliveryNo + " / " + SOH.TLSOH_DNListNo; txtGrade.Text = SOH.TLSOH_Grade; txtBoxedQty.Text = SOH.TLSOH_BoxedQty.ToString(); TLCSV_PurchaseOrder POOrder = context.TLCSV_PurchaseOrder.Find(SOH.TLSOH_POOrder_FK); if (POOrder != null) { txtPoOrder.Text = POOrder.TLCSVPO_PurchaseOrder; txtCustomer.Text = context.TLADM_CustomerFile.Find(POOrder.TLCSVPO_Customer_FK).Cust_Description; } if (!SOH.TLSOH_Write_Off) { chkInStock.Checked = true; if (SOH.TLSOH_Picked && SOH.TLSOH_DNListNo == 0) { chkPicked.Checked = SOH.TLSOH_Picked; } if (SOH.TLSOH_Picked && SOH.TLSOH_DNListNo != 0) { chkInStock.Checked = false; chkDelivered.Checked = true; } if (SOH.TLSOH_Returned) { chkInStock.Checked = true; chkPicked.Checked = SOH.TLSOH_Picked; chkReturned.Checked = SOH.TLSOH_Returned; } } else { chkWriteOff.Checked = true; } } else { MessageBox.Show("No data matching the text as entered found"); frmBoxView_Load(this, null); } } } }
private void btnSave_Click(object sender, EventArgs e) { Button oBtn = sender as Button; if (oBtn != null && formloaded) { if (SOH == null) { MessageBox.Show("Please enter a box number to write off"); return; } if (txtReasons.Text.Length == 0) { MessageBox.Show("Please enter a reason for this transaction"); return; } if (txtAuthorisedBy.Text.Length == 0) { MessageBox.Show("Please enter the authorising person"); return; } using (var context = new TTI2Entities()) { TLCSV_Movement Move = new TLCSV_Movement(); Move.TLMV_ToWhse_FK = SOH.TLSOH_WareHouse_FK; //======================================================= //Transaction No if Written on = 1;Written off = 2;Adjustment = 3 //================================================================ if (chkWriteOff.Checked) { Move.TLMV_TransactionNumber = 2; } else { Move.TLMV_TransactionNumber = 3; } //================================================================== Move.TLMV_TransDate = dtpTransDate.Value; Move.TLMV_OriginalNumber = txtTransNumber.Text; Move.TLMV_NoOfBoxes = 1; Move.TLMV_Reasons = txtReasons.Text; Move.TLMV_AuthorisedBy = txtAuthorisedBy.Text; Move.TLMV_BoxNumber = SOH.TLSOH_BoxNumber; Move.TLMV_BoxedQty = SOH.TLSOH_BoxedQty; Move.TLMV_AjustedBoxQty = Convert.ToInt32(txtBoxedQty.Text); context.TLCSV_Movement.Add(Move); try { var soh = context.TLCSV_StockOnHand.Find(SOH.TLSOH_Pk); if (soh != null) { soh.TLSOH_BoxedQty = Convert.ToInt32(txtBoxedQty.Text); if (chkWriteOff.Checked) { soh.TLSOH_Write_Off = true; } var CompletedWork = context.TLCMT_CompletedWork.Find(soh.TLSOH_CMT_FK); if (CompletedWork != null) { CompletedWork.TLCMTWC_Qty = Convert.ToInt32(txtBoxedQty.Text); } } context.SaveChanges(); txtBoxedQty.Text = string.Empty; txtBoxNumber.Text = string.Empty; txtColour.Text = string.Empty; txtBoxNumber.Text = string.Empty; txtSize.Text = string.Empty; chkWriteOff.Checked = false; SOH = null; } catch (Exception ex) { MessageBox.Show(ex.Message); return; } /* * //------------------------------------------------------- * // * //----------------------------------------------------------- * string Mach_IP = Dns.GetHostEntry(Dns.GetHostName()) * .AddressList.First(f => f.AddressFamily == AddressFamily.InterNetwork) * .ToString(); * * var Dept = context.TLADM_Departments.Where(x => x.Dep_ShortCode.Contains("CUT")).FirstOrDefault(); * * TLADM_DailyLog DailyLog = new TLADM_DailyLog(); * DailyLog.TLDL_IPAddress = Mach_IP; * DailyLog.TLDL_Dept_Fk = Dept.Dep_Id; * DailyLog.TLDL_Date = DateTime.Now; * DailyLog.TLDL_TransDetail = "Customer Sevices Stock Adjustment"; * DailyLog.TLDL_AuthorisedBy = txtAuthorisedBy.Text; ; * DailyLog.TLDL_Comments = txtReasons.Text; * context.TLADM_DailyLog.Add(DailyLog); * * try * { * context.SaveChanges(); * MessageBox.Show("data successfully saved to database"); * * frmCSViewRep vRep = new frmCSViewRep(12, Move.TLMV_Pk); * int h = Screen.PrimaryScreen.WorkingArea.Height; * int w = Screen.PrimaryScreen.WorkingArea.Width; * vRep.ClientSize = new Size(w, h); * vRep.ShowDialog(this); * * } * catch (Exception ex) * { * MessageBox.Show(ex.Message); * } */ } } }
private void button1_Click(object sender, EventArgs e) { Button oBtn = sender as Button; if (oBtn != null && formloaded) { var selected = (TLCSV_BoxSelected)cmboWareHouse.SelectedItem; if (selected == null) { MessageBox.Show("Please select a Delivery Note from the drop down box"); return; } var RecCount = dataGridView1.Rows.Cast <DataGridViewRow>().Where(x => (bool)x.Cells[1].Value == true).Count(); if (RecCount == 0) { MessageBox.Show("Please select a least one record to process"); return; } using (var context = new TTI2Entities()) { TLCSV_Movement move = new TLCSV_Movement(); move.TLMV_FromCMT_Fk = selected.TLCSV_From_FK; move.TLMV_ToWhse_FK = selected.TLCSV_To_FK; move.TLMV_TransactionNumber = 1; move.TLMV_TransDate = dtpTransDate.Value; move.TLMV_BoxSelected_FK = selected.TLCSV_Pk; move.TLMV_NoOfBoxes = 0; move.TLMV_BoxedQty = 0; move.TLMV_OriginalNumber = selected.TLCSV_DNDeails; var moveDetails = context.TLCMT_CompletedWork.Where(x => x.TLCMTWC_DepatchedList_FK == selected.TLCSV_Pk).ToList(); if (moveDetails != null) { move.TLMV_NoOfBoxes = moveDetails.Count; move.TLMV_BoxedQty = moveDetails.Sum(x => x.TLCMTWC_Qty); } context.TLCSV_Movement.Add(move); try { context.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } foreach (DataGridViewRow row in dataGridView1.Rows) { bool isChecked = (bool)row.Cells[1].Value; if (isChecked) { TLCSV_StockOnHand OnHand = new TLCSV_StockOnHand(); OnHand.TLSOH_WareHouse_FK = selected.TLCSV_To_FK; OnHand.TLSOH_CMT_FK = (int)row.Cells[0].Value; OnHand.TLSOH_BoxSelected_FK = selected.TLCSV_Pk; OnHand.TLSOH_Movement_FK = move.TLMV_Pk; OnHand.TLSOH_DateIntoStock = dtpTransDate.Value; TLCMT_CompletedWork comWork = context.TLCMT_CompletedWork.Find((int)row.Cells[0].Value); if (comWork != null) { comWork.TLCMTWC_BoxReceiptedWhse = true; var Already = context.TLCSV_StockOnHand.Where(x => x.TLSOH_BoxNumber == comWork.TLCMTWC_BoxNumber).FirstOrDefault(); if (Already != null) { continue; } OnHand.TLSOH_BoxedQty = comWork.TLCMTWC_Qty; OnHand.TLSOH_Style_FK = comWork.TLCMTWC_Style_FK; OnHand.TLSOH_Colour_FK = comWork.TLCMTWC_Colour_FK; OnHand.TLSOH_Size_FK = comWork.TLCMTWC_Size_FK; OnHand.TLSOH_BoxNumber = comWork.TLCMTWC_BoxNumber; OnHand.TLSOH_Weight = comWork.TLCMTWC_Weight; OnHand.TLSOH_PastelNumber = comWork.TLCMTWC_PastelNumber; OnHand.TLSOH_CutSheet_FK = comWork.TLCMTWC_CutSheet_FK; if (comWork.TLCMTWC_PastelNumber.Length == 0) { OnHand.TLSOH_PastelNumber = context.TLADM_Styles.Find(comWork.TLCMTWC_Style_FK).Sty_PastelNo.ToString(); OnHand.TLSOH_PastelNumber += context.TLADM_Colours.Find(comWork.TLCMTWC_Colour_FK).Col_FinishedCode; OnHand.TLSOH_PastelNumber += "NG"; OnHand.TLSOH_PastelNumber += context.TLADM_Sizes.Find(comWork.TLCMTWC_Size_FK).SI_PastelNo; } OnHand.TLSOH_BoxType = comWork.TLCMTWC_BoxType_FK; OnHand.TLSOH_Grade = comWork.TLCMTWC_Grade; if (!comWork.TLCMTWC_Grade.Contains("A")) { var Assoc = context.TLADM_WareHouseAssociation.Where(X => X.TLWA_PrimaryWareHouse == selected.TLCSV_To_FK).FirstOrDefault(); if (Assoc != null) { OnHand.TLSOH_WareHouse_FK = (int)Assoc.TLWA_SecondaryWareHouse; } } else { OnHand.TLSOH_Is_A = true; } } context.TLCSV_StockOnHand.Add(OnHand); } } var Existing = context.TLCSV_BoxSelected.Where(x => x.TLCSV_DNTransNumber == selected.TLCSV_DNTransNumber).ToList(); foreach (var row in Existing) { TLCSV_BoxSelected Box = new TLCSV_BoxSelected(); Box = context.TLCSV_BoxSelected.Find(row.TLCSV_Pk); if (Box != null) { Box.TLCSV_Receipted = true; Box.TLCSV_DateReceipted = dtpTransDate.Value; } } try { context.SaveChanges(); MessageBox.Show("Data saved successfully to database"); dataGridView1.Rows.Clear(); cmboWareHouse.DataSource = null; cmboWareHouse.DataSource = context.TLCSV_BoxSelected.Where(x => !x.TLCSV_Receipted).GroupBy(g => new { g.TLCSV_DNTransNumber }).Select(s => s.FirstOrDefault()).ToList(); cmboWareHouse.ValueMember = "TLCSV_Pk"; cmboWareHouse.DisplayMember = "TLCSV_DNDeails"; cmboWareHouse.SelectedValue = -1; frmCSViewRep vRep = new frmCSViewRep(3, selected.TLCSV_Pk); int h = Screen.PrimaryScreen.WorkingArea.Height; int w = Screen.PrimaryScreen.WorkingArea.Width; vRep.ClientSize = new Size(w, h); vRep.ShowDialog(this); } catch (Exception ex) { var exceptionMessages = new StringBuilder(); do { exceptionMessages.Append(ex.Message); ex = ex.InnerException; }while (ex != null); MessageBox.Show(exceptionMessages.ToString()); } } } }
private void btnSave_Click(object sender, EventArgs e) { Button oBtn = sender as Button; TLCSV_StockOnHand SOH = null; if (oBtn != null && formloaded) { var SingleRow = (from Rows in dataGridView1.Rows.Cast <DataGridViewRow>() where (string)Rows.Cells[4].Value == String.Empty && (int)Rows.Cells[2].Value != 0 select Rows).FirstOrDefault(); if (SingleRow != null) { MessageBox.Show("There is a record with no grade assigned. Row No " + SingleRow.Index.ToString(), "error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var Total = this.dataGridView1.Rows.Cast <DataGridViewRow>() .Sum(x => Convert.ToInt32(x.Cells[2].Value.ToString())); var OriginalQty = Convert.ToInt32(txtOriginalBoxQty.Text); if (Total > OriginalQty) { MessageBox.Show("New quantity greater than original qty" + Environment.NewLine + "Please correct"); return; } if (OriginalQty - Total != 0 && !_WhseStore.WhStore_RePack) { MessageBox.Show("The total split must be equal to original qty"); return; } if (txtAuthorised.Text.Length == 0) { MessageBox.Show("Please complete the Authorised by"); return; } using (var context = new TTI2Entities()) { var MainIndex = (int)_CurrentRow.Cells[0].Value; TLADM_LastNumberUsed LNU = null; decimal number; var Dept = context.TLADM_Departments.Where(x => x.Dep_ShortCode.Contains("CSV")).FirstOrDefault(); if (Dept != null) { LNU = context.TLADM_LastNumberUsed.Where(x => x.LUN_Department_FK == Dept.Dep_Id).FirstOrDefault(); } SOH = context.TLCSV_StockOnHand.Find(MainIndex); foreach (DataGridViewRow row in this.dataGridView1.Rows) { if ((int)row.Cells[2].Value == 0) { continue; } TLCSV_BoxSplit BoxSplit = new TLCSV_BoxSplit(); bool Add = true; var index = 0; if (row.Cells[0].Value != null) { index = (int)row.Cells[0].Value; BoxSplit = context.TLCSV_BoxSplit.Find(index); if (BoxSplit == null) { BoxSplit = new TLCSV_BoxSplit(); } else { Add = false; } } BoxSplit.TLCMTBS_BoxNo = row.Cells[1].Value.ToString(); BoxSplit.TLCMTBS_AuthorisedBy = this.txtAuthorised.Text; BoxSplit.TLCMTBS_Completed_FK = MainIndex; BoxSplit.TLCMTBS_Grade = row.Cells[4].Value.ToString().ToUpper(); BoxSplit.TLCMTBS_Qty = (int)row.Cells[2].Value; number = Decimal.Parse(row.Cells[3].Value.ToString()); BoxSplit.TLCMTBS_Weight = number; BoxSplit.TLCMTBS_AdjustmentNo = LNU.col1; if (Add) { context.TLCSV_BoxSplit.Add(BoxSplit); } //now we need to add the box to the Stock on Hand table //------------------------------------------------------------------ if (SOH != null) { TLCSV_StockOnHand SplitB = new TLCSV_StockOnHand(); SplitB.TLSOH_BoxSelected_FK = SOH.TLSOH_BoxSelected_FK; SplitB.TLSOH_CMT_FK = SOH.TLSOH_CMT_FK; SplitB.TLSOH_Customer_Fk = SOH.TLSOH_Customer_Fk; SplitB.TLSOH_DateIntoStock = SOH.TLSOH_DateIntoStock; SplitB.TLSOH_DNListDate = SOH.TLSOH_DNListDate; SplitB.TLSOH_DNListNo = SOH.TLSOH_DNListNo; SplitB.TLSOH_MoveAdjust_FK = SOH.TLSOH_MoveAdjust_FK; SplitB.TLSOH_Movement_FK = SOH.TLSOH_Movement_FK; SplitB.TLSOH_Notes = SOH.TLSOH_Notes; SplitB.TLSOH_PastelNumber = SOH.TLSOH_PastelNumber; SplitB.TLSOH_Picked = SOH.TLSOH_Picked; SplitB.TLSOH_PickListDate = SOH.TLSOH_PickListDate; SplitB.TLSOH_PickListNo = SOH.TLSOH_PickListNo; SplitB.TLSOH_POOrder_FK = SOH.TLSOH_POOrder_FK; SplitB.TLSOH_POOrderDetail_FK = SOH.TLSOH_POOrderDetail_FK; SplitB.TLSOH_QtyAdjusted = SOH.TLSOH_QtyAdjusted; SplitB.TLSOH_Returned = SOH.TLSOH_Returned; SplitB.TLSOH_ReturnedBoxQty = SOH.TLSOH_ReturnedBoxQty; SplitB.TLSOH_ReturnedDate = SOH.TLSOH_ReturnedDate; SplitB.TLSOH_ReturnedWeight = SOH.TLSOH_ReturnedWeight; SplitB.TLSOH_ReturnNumber = SOH.TLSOH_ReturnNumber; SplitB.TLSOH_Size_FK = SOH.TLSOH_Size_FK; SplitB.TLSOH_Sold = SOH.TLSOH_Sold; SplitB.TLSOH_SoldDate = SOH.TLSOH_SoldDate; SplitB.TLSOH_Style_FK = SOH.TLSOH_Style_FK; SplitB.TLSOH_Transfered = SOH.TLSOH_Transfered; SplitB.TLSOH_TransferNotes = SOH.TLSOH_TransferNotes; SplitB.TLSOH_WareHouse_FK = SOH.TLSOH_WareHouse_FK; SplitB.TLSOH_WareHouseDeliveryNo = SOH.TLSOH_WareHouseDeliveryNo; SplitB.TLSOH_WareHousePickList = SOH.TLSOH_WareHousePickList; SplitB.TLSOH_Colour_FK = SOH.TLSOH_Colour_FK; SplitB.TLSOH_CutSheet_FK = SOH.TLSOH_CutSheet_FK; SplitB.TLSOH_BoxedQty = BoxSplit.TLCMTBS_Qty; SplitB.TLSOH_BoxNumber = BoxSplit.TLCMTBS_BoxNo; SplitB.TLSOH_Split = false; SplitB.TLSOH_Weight = number; SplitB.TLSOH_Grade = BoxSplit.TLCMTBS_Grade; if (row.Cells[5].Value != null) { SplitB.TLSOH_BoxType = (int)row.Cells[5].Value; } else { SplitB.TLSOH_BoxType = 1; } context.TLCSV_StockOnHand.Add(SplitB); } } try { if (SOH != null) { SOH.TLSOH_BoxedQty = OriginalQty - Total; if (!_WhseStore.WhStore_RePack) { SOH.TLSOH_Split = true; } else if (SOH.TLSOH_BoxedQty == 0) { SOH.TLSOH_Split = true; } } LNU.col1 += 1; context.SaveChanges(); MessageBox.Show("Data saved successfully to database"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }