private void btn_save_Click(object sender, EventArgs e) { try { if (!CustomeRepository.CheckExistancePumperForNozzel(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), commonFunctions.ToInt(cmb_Nozzels.SelectedValue.ToString()), commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()))) { MessageBox.Show("Pumper is already assigned for this nozzel in this day.", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!ValidateInput()) { return; } Roster type = new Roster(); type.Id = int.Parse(lbl_id.Text.Trim()); type.NozzelID = commonFunctions.ToInt(cmb_Nozzels.SelectedValue.ToString()); type.PumperID = commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()); type.ShiftID = commonFunctions.ToInt(cmb_Shifts.SelectedValue.ToString()); type.DayStartID = commonFunctions.ToInt(cmb_days.SelectedValue.ToString()); type.ActualEndH = commonFunctions.ToInt(cmb_starth.Text.Trim()); type.AcutalEndM = commonFunctions.ToInt(cmb_startm.Text.Trim()); type.PlanStartH = commonFunctions.ToInt(cmb_endsH.Text.Trim()); type.PlanStartM = commonFunctions.ToInt(cmb_endsM.Text.Trim()); type.ShiftName = txt_name.Text.Trim(); type.TotalNoOfWorkigH = 0; if (MessageBox.Show("Do you want to insert this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { repo.Save(type); GetData(); } } catch (Exception ex) { MessageBox.Show("Error Has found when Saving data. Please forword following details to technical" + Environment.NewLine + "[" + ex.Message + Environment.NewLine + ex.Source + "]", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }