//Getting control values and assigning values to Student object private StudentProperty GetValuesFromControls() { StudentProperty objStudentProp = new StudentProperty(); objStudentProp.DOB = dtpDOB.Value; decimal decGPA; //Checking whether the GPA value is a decimal value bool blnGPA = decimal.TryParse(txtGPA.Text, out decGPA); if (blnGPA) { objStudentProp.GradePointAvg = decimal.Parse(txtGPA.Text); } else { MessageBox.Show("Invalid GPA"); txtGPA.Focus(); txtGPA.Text = "0.0"; } objStudentProp.Name = txtName.Text; objStudentProp.StudentID = lblStudentID.Text; objStudentProp.Active = chkActive.Checked; return(objStudentProp); }
//Reading values in the data grid and assigning values to student object private List <StudentProperty> GetValuesFromDataGridView() { List <StudentProperty> objStudentPropertyList = new List <StudentProperty>(); for (int i = 0; i <= gvStudentDetails.Rows.Count - 1; i++) { StudentProperty objStudentProperty = new StudentProperty(); objStudentProperty.Active = Convert.ToBoolean(gvStudentDetails.Rows[i].Cells[4].Value.ToString()); objStudentProperty.DOB = Convert.ToDateTime(gvStudentDetails.Rows[i].Cells[2].Value.ToString()); objStudentProperty.GradePointAvg = (decimal)gvStudentDetails.Rows[i].Cells[3].Value; objStudentProperty.Name = gvStudentDetails.Rows[i].Cells[1].Value.ToString(); objStudentProperty.StudentID = gvStudentDetails.Rows[i].Cells[0].Value.ToString(); //Adding sdtudent objects to list objStudentPropertyList.Add(objStudentProperty); } return(objStudentPropertyList); }
public static void AddControl(this TableLayoutPanel tlp, StudentProperty studentProperty) { tlp.RowStyles.Add(new RowStyle(SizeType.Absolute, 30)); if (tlp.RowCount == 1) { // Refresh data. _lblCurrentGroup = null; var lblGroup = CreateLabel("Group", ContentAlignment.MiddleCenter); tlp.Controls.Add(lblGroup, 0, tlp.RowCount - 1); var lblParameterName = CreateLabel("Parameter", ContentAlignment.MiddleCenter); tlp.Controls.Add(lblParameterName, 1, tlp.RowCount - 1); var lblValue = CreateLabel("Value", ContentAlignment.MiddleCenter); tlp.Controls.Add(lblValue, 2, tlp.RowCount - 1); var lblUnit = CreateLabel("Unit", ContentAlignment.MiddleCenter); tlp.Controls.Add(lblUnit, 3, tlp.RowCount - 1); } tlp.RowCount++; if (_lblCurrentGroup == null || _lblCurrentGroup.Text != studentProperty.Group.GroupName) { _lblCurrentGroup = CreateLabel(studentProperty.Group.GroupName, ContentAlignment.MiddleCenter); _lblCurrentGroup.Margin = new Padding(0); tlp.Controls.Add(_lblCurrentGroup, 0, tlp.RowCount - 1); _groupItemCount = 1; } else { _groupItemCount++; tlp.SetRowSpan(_lblCurrentGroup, _groupItemCount); } // Label { var labParameterName = CreateLabel(studentProperty.PropertyName, ContentAlignment.MiddleLeft); tlp.Controls.Add(labParameterName, 1, tlp.RowCount - 1); } // Value { var ctrlValue = new Control(); if (studentProperty.DataType == InputType.Label) { ctrlValue = CreateLabel(studentProperty.Text, ContentAlignment.MiddleLeft); } else if (studentProperty.DataType == InputType.Text) { ctrlValue = CreateTextBox(studentProperty.Text, studentProperty.ReadOnly); } else if (studentProperty.DataType == InputType.Check) { ctrlValue = CreateCheckBox(studentProperty.PropertyName, (bool)studentProperty.Text, studentProperty.ReadOnly); } else if (studentProperty.DataType == InputType.Select) { ctrlValue = CreateComboBox(studentProperty.Data); } tlp.Controls.Add(ctrlValue, 2, tlp.RowCount - 1); } // Unit { var unit = CreateLabel(studentProperty.UnitName, ContentAlignment.MiddleLeft); tlp.Controls.Add(unit, 3, tlp.RowCount - 1); } }
get => (PO.Student)GetValue(StudentProperty); set => SetValue(StudentProperty, value);
set => SetValue(StudentProperty, value);
private string GetPropVal(StudentProperty propEnum, Student s) { string pval = string.Empty; switch (propEnum) { case StudentProperty.Aadhaar: pval = s.Aadhar; break; case StudentProperty.Name: pval = s.Name; break; case StudentProperty.FatherName: pval = s.FatherName; break; case StudentProperty.MotherName: pval = s.MotherName; break; case StudentProperty.Dob: pval = s.Dob.ToString("dd/MM/yyyy"); break; case StudentProperty.Gender: if (s.Sex == "M") { pval = "1"; } else if (s.Sex == "F") { pval = "2"; } break; case StudentProperty.SocialCat: if (s.SocialCategory == "GEN") { pval = "1"; } else if (s.SocialCategory == "SC") { pval = "2"; } else if (s.SocialCategory == "ST") { pval = "3"; } else if (s.SocialCategory.Contains("OBC")) { pval = "4"; } break; case StudentProperty.Religion: pval = s.Religion; break; case StudentProperty.MotherTongue: pval = "Bengali"; break; case StudentProperty.Locality: pval = s.PstAddrLane2 + ", " + s.PstAddrDist + ", " + s.PstAddrPin; break; case StudentProperty.DoA: pval = string.Empty; break; case StudentProperty.AdmNo: pval = string.Empty; break; case StudentProperty.IsBpl: pval = (s.IsBpl) ? "1" : "2"; break; case StudentProperty.IsDisadvantaged: pval = string.Empty; break; case StudentProperty.GettingFreeEdu: pval = string.Empty; break; case StudentProperty.CurrYearClass: pval = ClassToNumber(s.StudyingClass); break; case StudentProperty.PrevYearClass: int currClass = Convert.ToInt32(ClassToNumber(s.StudyingClass)); pval = (currClass - 1).ToString(); break; case StudentProperty.IfClassOne: pval = string.Empty; break; case StudentProperty.DaysAttended: pval = string.Empty; break; case StudentProperty.InstrMedium: pval = "Bengali"; break; case StudentProperty.DisabilityType: pval = s.PhType; break; case StudentProperty.CWSNFacility: pval = string.Empty; break; case StudentProperty.FacilityUniform: pval = "0"; break; case StudentProperty.FacilityBooks: pval = string.Empty; break; case StudentProperty.FacilityTransport: pval = string.Empty; break; case StudentProperty.FacilityEscort: pval = string.Empty; break; case StudentProperty.FacilityBicycle: pval = string.Empty; break; case StudentProperty.FacilityHostel: pval = "0"; break; case StudentProperty.FacilityTraining: pval = "0"; break; case StudentProperty.IsHomeLess: pval = string.Empty; break; case StudentProperty.LastExamResult: pval = string.Empty; break; case StudentProperty.LastExamPercentage: pval = string.Empty; break; case StudentProperty.CurrSchoolingStatus: break; case StudentProperty.HsStream: if (s.StudyingClass == "XI" || s.StudyingClass == "XII") { pval = s.Stream; } else { pval = string.Empty; } break; case StudentProperty.VocSector: pval = string.Empty; break; case StudentProperty.VocJobRoll: pval = string.Empty; break; case StudentProperty.VocCompNSQF: pval = string.Empty; break; case StudentProperty.VocOptedFor: pval = string.Empty; break; case StudentProperty.VocPlament: pval = string.Empty; break; case StudentProperty.VocSalaryOffered: pval = string.Empty; break; case StudentProperty.BankAcc: pval = s.BankAcc; break; case StudentProperty.IFSC: pval = s.Ifsc; break; case StudentProperty.Mobile: pval = s.Mobile; break; case StudentProperty.Email: pval = s.Email; break; default: break; } return(pval); }
public UDiseProperty(string nm, StudentProperty sp) { PropertyName = nm; PropEnum = sp; }