Ejemplo n.º 1
0
        public List <Committe> GetCommitte()
        {
            committe = new List <Committe>();
            try
            {
                string Get = " Select * from Committe ";
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(Get, con);
                cmd.Transaction = tran;

                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Committe c = new Committe();
                    c.CommitteID   = Convert.ToInt32(dr["ID"]);
                    c.CommitteName = dr["CommitteName"].ToString();
                    committe.Add(c);
                }
                dr.Close();
                tran.Commit();
                return(committe);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Ejemplo n.º 2
0
        public bool DeleteCommitte(Committe c)
        {
            try
            {
                string delete = "Delete from Committe where ID=" + c.CommitteID + "";

                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(delete, con);
                cmd.Transaction = tran;
                cmd.ExecuteNonQuery();
                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Ejemplo n.º 3
0
        public List <Committe> GetCommittes(Membership mem)
        {
            List <Committe> cms = new List <Committe>();

            try
            {
                string insert = "Select mc.*,c.CommitteName from MemberComittee  mc,Committe c where c.ID = mc.CommitteeID and mc.MID=" + mem.MID;
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(insert, con);
                cmd.Transaction = tran;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Committe cm = new Committe();
                    cm.CommitteID   = Convert.ToInt32(dr["CommitteeID"]);
                    cm.CommitteName = dr["CommitteName"].ToString();
                    cms.Add(cm);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
            return(cms);
        }
Ejemplo n.º 4
0
        public bool SaveCommitte(Committe c)
        {
            try
            {
                string insert;

                if (c.CommitteID == 0)
                {
                    insert = " Insert into Committe  (CommitteName) values ('" + c.CommitteName + "')";
                }
                else
                {
                    insert = "Update Committe set CommitteName='" + c.CommitteName + "' where ID=" + c.CommitteID + "";
                }
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(insert, con);
                cmd.Transaction = tran;
                cmd.ExecuteNonQuery();
                tran.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Ejemplo n.º 5
0
        private void tsSelect_Click(object sender, EventArgs e)
        {
            int ID = Convert.ToInt32(DGVCountry.CurrentRow.Cells["Committeid"].Value);

            if (DGVCountry.CurrentRow != null)
            {
                if (DGVCountry.CurrentRow.Cells["Committeid"].Value != null)
                {
                    this.CurrentCommitte = ((Committe)committe.Where(c => c.CommitteID == ID).Single <Committe>());
                }
            }

            this.Close();
        }
Ejemplo n.º 6
0
        public List <Committe> GetMemberCommitte(Membership MemberID)
        {
            LoCommitte = new List <Committe>();
            try
            {
                string Get = "SELECT mc.CommitteeID,c.CommitteName from Committe c,MemberComittee mc,MembershipData md" +
                             " WHERE mc.CommitteeID=c.ID AND mc.MID=md.MID AND md.MID=" + MemberID.MID;
                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                tran            = con.BeginTransaction();
                cmd             = new OleDbCommand(Get, con);
                cmd.Transaction = tran;

                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Committe c = new Committe();
                    c.CommitteID   = Convert.ToInt32(dr["CommitteeID"]);
                    c.CommitteName = dr["CommitteName"].ToString();
                    LoCommitte.Add(c);
                }
                dr.Close();
                tran.Commit();
                return(LoCommitte);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Ejemplo n.º 7
0
 private void tsSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCommitte.Text.Length > 0)
         {
             c = new Committe();
             c.CommitteName = this.txtCommitte.Text.Trim();
             if (frm.CurrentCommitte != null)
             {
                 c.CommitteID = frm.CurrentCommitte.CommitteID;
             }
             if (new CommitteBLL().SaveCommitte(c))
             {
                 MessageBox.Show("Committe Saved Successfully", "Success");
                 ClearControls();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 8
0
        private void tsSave_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (txtname.Text.Length > 0)
                {
                    memb = new Membership();
                    memb.branch.BranchName = this.cbxbranches.Text.Trim();
                    memb.MemberName        = this.txtname.Text.Trim();
                    memb.MemberLastName    = this.txtfathername.Text.Trim();



                    Decimal age;
                    Decimal.TryParse(this.txtAge.Text, out age);
                    memb.AGE = age;


                    memb.Gender = this.cbxGender.Text.Trim();


                    memb.NIC = this.txtNIC.Text.Trim();

                    // memb.Refrence = cbxReference.SelectedItem as Membership;
                    memb.refrence = cbxReference.Text.Trim();
                    memb.Phone    = this.txtPhoneNumber.Text;

                    memb.Email      = this.txtEmaiAdress.Text.Trim();
                    memb.BloodGroup = this.cbxbloodGroup.Text.Trim();

                    Decimal memFee;
                    Decimal.TryParse(this.txtMembershipFee.Text, out memFee);
                    memb.MembershipFee = memFee;

                    Decimal memno;
                    Decimal.TryParse(this.txtMembersshipNo.Text, out memno);
                    memb.MembershipNo = memno;

                    memb.Status = this.cbxStatus.Text.Trim();

                    Decimal monthFee;
                    Decimal.TryParse(this.txtMonthlyFee.Text, out monthFee);
                    memb.MonthlyFee = monthFee;

                    DateTime colldate;
                    DateTime.TryParse(this.dtpCollectionDate.Text, out colldate);
                    memb.CollectionDate = colldate;

                    memb.Adress = this.txtAdress.Text.Trim();

                    memb.CurrentDate   = dtpcurrentdate.Value.Date;
                    memb.City.CityName = cbxCities.Text.Trim();

                    memb.Country.CountryName = cbxCountry.Text.Trim();
                    memb.MemberType          = cbxMembertype.Text.Trim();

                    foreach (var item in cbxCounsil.CheckedItems)
                    {
                        Counsil cl = (Counsil)item;
                        memb.Counsil.Add(cl);
                    }
                    foreach (var item in cbxCommitte.CheckedItems)
                    {
                        Committe cm = (Committe)item;
                        memb.Committe.Add(cm);
                    }

                    if (frm.CurrentMembership != null)
                    {
                        memb.MID = frm.CurrentMembership.MID;
                    }
                    if (new MembershipBLL().SaveMembersData(memb))
                    {
                        MessageBox.Show("Membership Saved Successfully", "Success");
                        ClearControls();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 9
0
 public bool DeleteCommitte(Committe c)
 {
     return(new CommitteDAL().DeleteCommitte(c));
 }
Ejemplo n.º 10
0
 public bool SaveCommitte(Committe c)
 {
     return(new CommitteDAL().SaveCommitte(c));
 }