private void Copy_Previous_Academic_Year_Setting() { try { string Selected_Academic_Year = ((KeyValuePair <int, string>)ddlAcademicYear.SelectedItem).Value; string[] arr = Selected_Academic_Year.Split('-'); int Previous_Academic_Year = Convert.ToInt32(Convert.ToString(Convert.ToInt16(arr[0]) - 1) + Convert.ToString(Convert.ToInt16(arr[1]) - 1)); List <FeeSettingModel> _listFeeSettingModel = _feeSetting.GetFeeSetting(Previous_Academic_Year); if (_listFeeSettingModel != null) { _listFeeSettingModel.Select(x => { x.FeeSettingID = 0; return(x); }).ToList(); BindGridContols(_listFeeSettingModel); MessageBox.Show("Below table contains copied data of previous academic year.\nPlease edit & click on save button to save recods for this academic year.", "Fee Setting", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No Record Found For Previous Year.\n Please Add New Record.", "Fee Setting", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch { MessageBox.Show("Error! Please contact to support team.", "Fee Setting", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BindFeeTypeDropDownList() { _feeType = new FeeType(); List <FeeTypeModel> _listFeeList = _feeType.GetFeeType(); /*----Display only those fee type those are map in fee seeting form----------------------------------------------------------*/ FeeSetting _feeSetting = new FeeSetting(); List <FeeSettingModel> _listFeeSetting = _feeSetting.GetFeeSetting(Convert.ToInt32(ddlAcademicYear.SelectedValue)); if (_listFeeList != null && _listFeeSetting != null) { _listFeeList = _listFeeList.Where(p => _listFeeSetting.Any(p2 => p2.FeeTypeID == p.FeeTypeID)).ToList(); } /*--------------------------------------------------------------------------------------------------------------------------*/ if (_listFeeList != null) { _listFeeList.Add(new FeeTypeModel { FeeTypeID = 0, FeeType = "Select" }); ddlFeeType.DataSource = _listFeeList.OrderBy(x => x.FeeTypeID).ToList(); ddlFeeType.DisplayMember = "FeeType"; ddlFeeType.ValueMember = "FeeTypeID"; } }
private void BindFeeSettingGrid(int Academic_Year) { _feeSetting = new FeeSetting(); List <FeeSettingModel> _listFeeSettingModel = _feeSetting.GetFeeSetting(Academic_Year); if (_listFeeSettingModel != null && _listFeeSettingModel.Count > 0) { // gridFeeSetting.DataSource = bindingSource; //_listFeeSettingModel.ToList(); BindGridContols(_listFeeSettingModel); } else { DialogResult dResult = MessageBox.Show("There is no record for this academic year.\nDo you want to copy previous academic year data?", "Fee Setting", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dResult == DialogResult.Yes) { Copy_Previous_Academic_Year_Setting(); } } }