Beispiel #1
0
 public override void DeleteBtn_Click(object sender, EventArgs e)
 {
     if (edit == 1)
     {
         DialogResult dr = MessageBox.Show("Are you sure ?", "Qustion", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             obj.lk_deleteLKG(LKG_ID);
             MainClass.ShowMSG(NameTxt.Text + " Deleted Successfully", "Success...", "Success");
             MainClass.disable_reset(panel2);
             loadData();
         }
     }
 }
Beispiel #2
0
        public override void SaveBtn_Click(object sender, EventArgs e)
        {
            if (NameTxt.Text == "")
            {
                NameErrorLable.Visible = true;
            }
            else
            {
                NameErrorLable.Visible = false;
            }
            if (FathersNameTxt.Text == "")
            {
                FatherNameErorLable.Visible = true;
            }
            else
            {
                FatherNameErorLable.Visible = false;
            }
            if (EPFID_Txt.Text == "")
            {
                EPFID_ErorLable.Visible = true;
            }
            else
            {
                EPFID_ErorLable.Visible = false;
            }
            if (DOB_Txt.Text == "")
            {
                DOB_ErorLable.Visible = true;
            }
            else
            {
                DOB_ErorLable.Visible = false;
            }
            if (DOJ_Txt.Text == "")
            {
                DOJ_ErorLable.Visible = true;
            }
            else
            {
                DOJ_ErorLable.Visible = false;
            }
            if (EmailTxt.Text == "")
            {
                EmailErorLable.Visible = true;
            }
            else
            {
                EmailErorLable.Visible = false;
            }
            if (Phone1_Txt.Text == "")
            {
                Phone1ErorLable.Visible = true;
            }
            else
            {
                Phone1ErorLable.Visible = false;
            }
            if (Phone1_Txt.Text == Phone2Txt.Text)
            {
                MainClass.ShowMSG("Both phone numbers are same", "Error...", "Error");
            }
            if (PostTxt.Text == "")
            {
                PostErorLable.Visible = true;
            }
            else
            {
                PostErorLable.Visible = false;
            }
            if (StatusDD.SelectedIndex == -1)
            {
                StatusErorLable.Visible = true;
            }
            else
            {
                StatusErorLable.Visible = false;
            }
            if (NameErrorLable.Visible || FatherNameErorLable.Visible || EPFID_ErorLable.Visible || DOB_ErorLable.Visible || DOJ_ErorLable.Visible || EmailErorLable.Visible || Phone1ErorLable.Visible || PostErorLable.Visible || PostErorLable.Visible || StatusErorLable.Visible)
            {
                MainClass.ShowMSG("Feilds With * Are Mendatory", "Error...", "Error");
            }
            else
            {
                if (edit == 0)// Code for save
                {
                    byte  stat = StatusDD.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0);
                    staff s    = new staff();
                    s.st_name         = NameTxt.Text;
                    s.st_fatherName   = FathersNameTxt.Text;
                    s.st_EPFID        = EPFID_Txt.Text;
                    s.st_DOB          = DOB_Txt.Text;
                    s.st_DOJ          = DOJ_Txt.Text;
                    s.st_emailAddress = EmailTxt.Text;
                    s.st_phone1       = Phone1_Txt.Text;
                    s.st_phone2       = Phone2Txt.Text;
                    s.st_Post         = PostTxt.Text;
                    s.st_status       = stat;
                    obj.staffs.InsertOnSubmit(s);
                    obj.SubmitChanges();
                    MainClass.ShowMSG(NameTxt.Text + " Added Successfully", "Success...", "Success");
                    MainClass.disable_reset(panel2);
                    loadData();
                }
                else if (edit == 1)// Code for update
                {
                    var data = obj.staffs.Single(x => x.st_id == staffID);

                    byte stat = StatusDD.SelectedIndex == 0 ? Convert.ToByte(1) : Convert.ToByte(0);
                    data.st_name         = NameTxt.Text;
                    data.st_fatherName   = FathersNameTxt.Text;
                    data.st_EPFID        = EPFID_Txt.Text;
                    data.st_DOB          = DOB_Txt.Text;
                    data.st_DOJ          = DOJ_Txt.Text;
                    data.st_emailAddress = EmailTxt.Text;
                    data.st_phone1       = Phone1_Txt.Text;
                    data.st_phone2       = Phone2Txt.Text;
                    data.st_Post         = PostTxt.Text;
                    data.st_status       = stat;
                    obj.SubmitChanges();
                    MainClass.ShowMSG(NameTxt.Text + " Updated Successfully", "Success...", "Success");
                    MainClass.disable_reset(panel2);
                    loadData();
                }
            }
        }
Beispiel #3
0
 private void Staff_Load(object sender, EventArgs e)
 {
     MainClass.disable_reset(panel2);
 }
Beispiel #4
0
 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();
         }
     }
 }