Esempio n. 1
0
        private void txtMemberName_Enter(object sender, EventArgs e)
        {
            Community.DBLayer dbLayer = new Community.DBLayer();

            bool Result = dbLayer.CheckFamily(txtFCardNo.Text);

            if (Result)
            {
                usp_SEL_tblFamilyMemberTableAdapter.Fill(comDataSet.usp_SEL_tblFamilyMember, txtFCardNo.Text);
                if (txtMemberName.Text == "")
                {
                    MessageBox.Show("No Member Found!", "Unable to Find");
                    btnFCardNo.Enabled = false;
                }
                else
                {
                    btnFCardNo.Enabled = true;
                }
            }
            else
            {
                MessageBox.Show("Card Does Not Exist!");
                txtMemberName.Text = "";
                btnFCardNo.Enabled = false;
            }
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Community.DBLayer Chk     = new Community.DBLayer();
            Community.DBLayer dblayer = new Community.DBLayer();
            txtHName.Text = txtHNameT.Text;

            try
            {
                int      ID           = Convert.ToInt32(txtMemberID.Text);
                string   FCardNo      = txtFCardNo.Text;
                string   FCardNoT     = txtFCardNoT.Text;
                string   Academic     = txtAcdemicEdu.Text;
                string   BAddress     = txtBAddress.Text;
                string   Bgroup       = txtBGroup.Text;
                string   BName        = txtBName.Text;
                string   BPhone       = txtBPhone.Text;
                string   Gender       = txtGender.Text;
                string   AgeGroup     = txtAdult.Text;
                string   CMIC         = txtCMIC.Text;
                string   CNIC         = txtCNIC.Text;
                string   Designation  = txtDesignation.Text;
                string   Email        = txtEmail.Text;
                string   Fax          = txtFax.Text;
                string   Mobile       = txtMobile.Text;
                string   Name         = txtName.Text;
                string   Professional = txtProfessionalEdu.Text;
                string   Technical    = txtTechnicalEdu.Text;
                string   Type         = txtTypeWork.Text;
                string   Website      = txtWebsite.Text;
                string   DOB          = txtDOBYear.Text;
                string   LRealation   = txtRelation.Text;
                string   LRelationT   = cmbRelationT.Text;
                string   FName        = txtFName.Text;
                string   HName        = txtHNameT.Text;
                bool     Active       = rbActive.Checked;
                bool     ActiveT      = rbActiveT.Checked;
                string   Reason       = Reason1();
                DateTime Incident     = Convert.ToDateTime(dpIncident.Text);
                string   Status       = cmbMaritalStatus.Text;
                string   OutOf        = cmbOutof.SelectedText;
                DateTime EntryDate    = Convert.ToDateTime(dpEntryDate.Text);
                string   FromCard     = "";
                if (txtFromCard.Text != "")
                {
                    FromCard = txtFromCard.Text + " , " + txtFCardNoT.Text;
                }
                else
                {
                    FromCard = txtFCardNo.Text;
                }
                string ToCard = "";
                if (txtToCard.Text != "")
                {
                    ToCard = txtToCard + " , " + txtFCardNoT.Text;
                }
                else
                {
                    ToCard = txtFCardNoT.Text;
                }
                string       TempDOB = Convert.ToDateTime(DOB).ToString("dd-MM-yyyy");
                DialogResult Confirm = MessageBox.Show("Are you sure??", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                //    bool Result1 = Chk.CHK_DVC(FCardNoT, LRelationT, HName);
                bool Result2 = dblayer.CheckFamily(FCardNoT);
                if (Result2 == false)
                {
                    MessageBox.Show("Family Card No Does Not Exist! Please Insert Valid Card Number", "Error");
                }
                else
                {
                    if (mode == 1 || mode == 2)
                    {
                        if (CheckFields())
                        {
                            if (Confirm == DialogResult.Yes)
                            {
                                btnCancel.Visible   = false;
                                btnSubmit.Visible   = false;
                                txtFCardNo.Enabled  = true;
                                boxTransfer.Visible = false;
                                usp_SEL_tblFamilyMemberTableAdapter.Update1(ID, FCardNo, Name, LRealation, FName, HName, DOB, Bgroup, Gender, AgeGroup, Mobile, CNIC, CMIC, Academic, Technical, Professional, BName, Type, Designation, BAddress, BPhone, Email, Website, Fax, Active, Reason, Incident, Status, OutOf, EntryDate, txtFromCard.Text, ToCard, Convert.ToDateTime(TempDOB), "", "", "", new DBLayer().GetUserID());
                                usp_SEL_tblFamilyMemberTableAdapter.Insert1(FCardNoT, Name, LRelationT, FName, HName, DOB, Bgroup, Gender, AgeGroup, Mobile, CNIC, CMIC, Academic, Technical, Professional, BName, Type, Designation, BAddress, BPhone, Email, Website, Fax, ActiveT, Reason, Incident, Status, OutOf, EntryDate, FromCard, txtToCard.Text, Convert.ToDateTime(TempDOB), "", "", "", new DBLayer().GetUserID());
                                MessageBox.Show("Transferred Succesfully!", "Success");
                                exit = 1;
                                btnCancel_Click(sender, e);
                            }
                        }
                    }
                    else if (mode == 3)
                    {
                        if (txtFCardNoT.Text != "" && cmbRelationT.Text != "")
                        {
                            if (Confirm == DialogResult.Yes)
                            {
                                btnCancel.Visible   = false;
                                btnSubmit.Visible   = false;
                                txtFCardNo.Enabled  = true;
                                boxTransfer.Visible = false;
                                usp_SEL_tblFamilyMemberTableAdapter.Update1(ID, FCardNo, Name, LRealation, FName, HName, DOB, Bgroup, Gender, AgeGroup, Mobile, CNIC, CMIC, Academic, Technical, Professional, BName, Type, Designation, BAddress, BPhone, Email, Website, Fax, Active, Reason, Incident, Status, OutOf, EntryDate, FromCard, ToCard, Convert.ToDateTime(TempDOB), "", "", "", new DBLayer().GetUserID());
                                usp_SEL_tblFamilyMemberTableAdapter.Insert1(FCardNoT, Name, LRelationT, FName, HName, DOB, Bgroup, Gender, AgeGroup, Mobile, CNIC, CMIC, Academic, Technical, Professional, BName, Type, Designation, BAddress, BPhone, Email, Website, Fax, ActiveT, Reason, Incident, Status, OutOf, EntryDate, FromCard, ToCard, Convert.ToDateTime(TempDOB), "", "", "", new DBLayer().GetUserID());
                                MessageBox.Show("Transferred Succesfully!", "Success");
                                exit = 1;
                                btnCancel_Click(sender, e);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Fields could not be left Blank!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }



                    //else if (mode == 2)
                    //{
                    //    if (Confirm = DialogResult.Yes)
                    //{
                    //    btnCancel.Visible = false;
                    //    btnSubmit.Visible = false;
                    //    txtFCardNo.Enabled = true;
                    //    boxTransfer.Visible = false;
                    //    usp_SEL_tblFamilyMemberTableAdapter.Update1(ID, FCardNo, Name, LRealation, FName, HName, DOB, Bgroup, Gender, AgeGroup, Mobile, CNIC, CMIC, Academic, Technical, Professional, BName, Type, Designation, BAddress, BPhone, Email, Website, Fax, Active, Reason, Incident, Status, OutOf, EntryDate);
                    //    usp_SEL_tblFamilyMemberTableAdapter.Insert1(FCardNoT, Name, LRelationT, FName, HName, DOB, Bgroup, Gender, AgeGroup, Mobile, CNIC, CMIC, Academic, Technical, Professional, BName, Type, Designation, BAddress, BPhone, Email, Website, Fax, ActiveT, Reason, Incident, Status, OutOf, EntryDate);
                    //    MessageBox.Show("Transferred Succesfully!", "Success");
                    //    exit = 1;
                    //    btnCancel_Click(sender, e);
                    //}
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
        private void btnFCardNo_Click(object sender, EventArgs e)
        {
            txtFCardNo_Leave(sender, e);
            string x = txtFCardNo.Text;

            Community.DBLayer dblayer = new Community.DBLayer();
            if (txtFCardNo.Text == "")
            {
                MessageBox.Show("Please Insert Family Card Number", "Family Card Required", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                bool result = dblayer.CheckFamily(txtFCardNo.Text);
                if (result)
                {
                    usp_SEL_FAMILYTableAdapter.Leader(comDataSet.usp_SEL_FAMILY, txtFCardNo.Text);
                    //if (DGRenewal.Rows.Count == 0)
                    //{
                    //    btnEdit.Enabled = false;
                    //    btnPrint.Enabled = false;
                    //}
                    //else
                    //{
                    //    btnEdit.Enabled = false;
                    //    btnPrint.Enabled = false;
                    //}
                    if (txtFCardNo.Text == "")
                    {
                        txtFCardNo.Text = x;
                    }
                    btnViewInfo_Click(sender, e);


                    usp_SEL_tblFamilyMemberTableAdapter.FillActive(comDataSet.usp_SEL_tblFamilyMember, txtFCardNo.Text);
                    txtTotalMembers.Text = comDataSet.usp_SEL_tblFamilyMember.Rows.Count.ToString();

                    GetFemaleInformation(txtFCardNo.Text);

                    usp_Male_tblFamilyMemberTableAdapter.Fill(comDataSet.usp_Male_tblFamilyMember, txtFCardNo.Text, "Male");
                    int Male = DGInfo.Rows.Count;

                    CalculateAge();

                    usp_SEL_tblFamilyMemberTableAdapter.FillAdult(comDataSet.usp_SEL_tblFamilyMember, txtFCardNo.Text);
                    int Adults = comDataSet.usp_SEL_tblFamilyMember.Rows.Count;
                    txtAdult.Text = Adults.ToString();

                    int Minor = Male - Adults;
                    txtMinor.Text = Minor.ToString();
                    if (DBLayer.User_Right(UserID, SecurityLevelID, "[Modify]"))
                    {
                        btnEdit.Enabled = true;
                    }
                    else
                    {
                        btnEdit.Enabled = false;
                    }

                    if (DBLayer.User_Right(UserID, SecurityLevelID, "[Delete]"))
                    {
                        btnDelete.Enabled = true;
                    }
                    else
                    {
                        btnDelete.Enabled = false;
                    }

                    if (DBLayer.User_Right(UserID, SecurityLevelID, "[Write]"))
                    {
                        btnAdd.Enabled = true;
                    }
                    else
                    {
                        btnAdd.Enabled = false;
                    }
                    //Get Selected Family Card Renewal Info
                    usp_SEL_RenewalTableAdapter.Fill(comDataSet.usp_SEL_Renewal, txtFCardNo.Text);
                    btnViewInfo.Enabled = true;
                    this.AcceptButton   = btnAdd;
                    btnPrint.Enabled    = true;
                    //btnDelete.Enabled = true;
                    if (txtFCardNo.Text == "")
                    {
                        txtFCardNo.Text = x;
                    }
                    //if()
                }
                else
                {
                    MessageBox.Show("Family CardNo doesnot exist! Please enter a Valid CardNo.", "Invalid CardNo.", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    btnAdd.Enabled      = false;
                    btnEdit.Enabled     = false;
                    DGRenewal.Enabled   = false;
                    btnViewInfo.Enabled = false;
                    btnPrint.Enabled    = false;
                }
            }
        }