private void BindGridControlsOnSearch() { gridStudent.DataSource = null; gridFine.DataSource = null; studentFineModel = new StudentFineViewModel(); fineSettings = new FineSettings(); studentFineModel.ClassID = Convert.ToInt16(ddlCurrentClass.SelectedValue); studentFineModel.SectionID = Convert.ToInt16(ddlCurrentSection.SelectedValue); studentFineModel.FineDate = Common.Convert_String_To_Date(datePickerReport.Text); // DateTime.ParseExact(datePickerReport.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture); studentFineModel.FineTypeID = Convert.ToInt16(ddlFeeType.SelectedValue); studentFineModel = fineSettings.GetStudentFineDetails(studentFineModel, out ISBillPaid); BindStudentGrid(studentFineModel.ListStudent); BindFineGrid(studentFineModel.ListStudentFine); if (ISBillPaid == 1) { btnSave.Enabled = false; btnMoveLeft.Enabled = false; btnMoveRight.Enabled = false; lblError.Visible = true; } else { btnSave.Enabled = true; btnMoveLeft.Enabled = true; btnMoveRight.Enabled = true; lblError.Visible = false; } }
private void BindDropDownControls() { fineSettings = new FineSettings(); listFineType = fineSettings.GetFineType(); classSection = new ClassSection(); listSection = classSection.GetSectionDetails(); classType = new ClassType(); listClass = classType.GetClassDetails(); if (listSection != null) { listSection.Add(new ClassSectionModel { ClassSectionID = 0, SectionName = "Select" }); ddlCurrentSection.DataSource = listSection.OrderBy(x => x.ClassSectionID).ToList(); ddlCurrentSection.DisplayMember = "SectionName"; ddlCurrentSection.ValueMember = "ClassSectionID"; } if (listFineType != null) { listFineType.Add(new FineTypeModel { FineTypeID = 0, FineType = "Select" }); ddlFeeType.DataSource = listFineType.OrderBy(x => x.FineTypeID).ToList(); ddlFeeType.DisplayMember = "FineType"; ddlFeeType.ValueMember = "FineTypeID"; } if (listClass != null) { listClass.Add(new ClassTypeModel { ClassID = 0, ClassName = "Select", Active = true }); ddlCurrentClass.DataSource = listClass.OrderBy(x => x.ClassID).ToList(); ddlCurrentClass.DisplayMember = "ClassName"; ddlCurrentClass.ValueMember = "ClassID"; } datePickerReport.Format = DateTimePickerFormat.Custom; datePickerReport.Value = DateTime.Now; datePickerReport.CustomFormat = "dd.MM.yyyy"; }
private void btnSave_Click(object sender, EventArgs e) { if (gridFineValidation()) { fineSettings = new FineSettings(); string studentFineXML = ConvertGridToXML(ConvertFineGridToList()); short result = fineSettings.SaveStudentFine(studentFineXML); switch (result) { case 1: ShowMessage("Record Saved Successfully."); BindGridControlsOnSearch(); btnSave.Enabled = false; break; case -1: ShowMessage("Error: Please Contact To Admin."); break; } } }