public override void SaveBtn_Click(object sender, EventArgs e) { if (NameTxt.Text == "") { NameErrorLable.Visible = true; } else { NameErrorLable.Visible = false; } if (FatherNameTxt.Text == "") { FatherNameErrorLable.Visible = true; } else { FatherNameErrorLable.Visible = false; } if (MotherNameTxt.Text == "") { MotherNameErtrorLable.Visible = true; } else { MotherNameErtrorLable.Visible = false; } if (SrNO_Txt.Text == "") { SrNo_ErrorLable.Visible = true; } else { SrNo_ErrorLable.Visible = false; } if (DOB_TXT.Text == "") { DOB_ErrorLable.Visible = true; } else { DOB_ErrorLable.Visible = false; } if (DOA_TXT.Text == "") { DOA_ErrorLable.Visible = true; } else { DOA_ErrorLable.Visible = false; } if (ClassTxt.Text == "") { ClassErrorLable.Visible = true; } else { ClassErrorLable.Visible = false; } if (SectionTxt.Text == "") { SectionErrorLable.Visible = true; } else { SectionErrorLable.Visible = false; } if (ContactNoTxt.Text == "") { ContactErrorLable.Visible = true; } else { ContactErrorLable.Visible = false; } if (AddressTxt.Text == "") { AddressErrorLable.Visible = true; } else { AddressErrorLable.Visible = false; } if (AdharNoTxt.Text == "") { AdharErrorLable.Visible = true; } else { AdharErrorLable.Visible = false; } if (CastTxt.Text == "") { CastErrorLable.Visible = true; } else { CastErrorLable.Visible = false; } if (ReligionTxt.Text == "") { ReligionErrorLable.Visible = true; } else { ReligionErrorLable.Visible = false; } if (PreSchoolTxt.Text == "") { PreSchoolErrorLable.Visible = true; } else { PreSchoolErrorLable.Visible = false; } if (NameErrorLable.Visible || FatherNameErrorLable.Visible || MotherNameErtrorLable.Visible || SrNo_ErrorLable.Visible || DOB_ErrorLable.Visible || DOA_ErrorLable.Visible || ClassErrorLable.Visible || SectionErrorLable.Visible || ContactErrorLable.Visible || AddressErrorLable.Visible || AdharErrorLable.Visible || CastErrorLable.Visible || ReligionErrorLable.Visible || PreSchoolErrorLable.Visible) { MainClass.ShowMSG("Feilds With * Are Mendatory", "Error...", "Error"); } else { if (edit == 0) { LKG l = new LKG(); l.lk_name = NameTxt.Text; l.lk_motherNmae = MotherNameTxt.Text; l.lk_fatherName = FatherNameTxt.Text; l.lk_SrNo = SrNO_Txt.Text; l.lk_DOB = DOB_TXT.Text; l.lk_DOA = DOA_TXT.Text; l.lk_class = ClassTxt.Text; l.lk_section = SectionTxt.Text; l.lk_contactNo = ContactNoTxt.Text; l.lk_address = AddressTxt.Text; l.lk_adharNo = AdharNoTxt.Text; l.lk_cast = CastTxt.Text; l.lk_religion = ReligionTxt.Text; l.lk_preSchool = PreSchoolTxt.Text; obj.LKGs.InsertOnSubmit(l); obj.SubmitChanges(); MainClass.ShowMSG(NameTxt.Text + " Added Successfully", "Success...", "Success"); MainClass.disable_reset(panel2); loadData(); } if (edit == 1) { var data = obj.LKGs.Single(x => x.lk_id == LKG_ID); data.lk_name = NameTxt.Text; data.lk_motherNmae = MotherNameTxt.Text; data.lk_fatherName = FatherNameTxt.Text; data.lk_SrNo = SrNO_Txt.Text; data.lk_DOB = DOB_TXT.Text; data.lk_DOA = DOA_TXT.Text; data.lk_class = ClassTxt.Text; data.lk_section = SectionTxt.Text; data.lk_contactNo = ContactNoTxt.Text; data.lk_address = AddressTxt.Text; data.lk_adharNo = AdharNoTxt.Text; data.lk_cast = CastTxt.Text; data.lk_religion = ReligionTxt.Text; data.lk_preSchool = PreSchoolTxt.Text; obj.SubmitChanges(); MainClass.ShowMSG(NameTxt.Text + " Updated Successfully", "Success...", "Success"); MainClass.disable_reset(panel2); loadData(); } } }
partial void UpdateLKG(LKG instance);
partial void DeleteLKG(LKG instance);
partial void InsertLKG(LKG instance);