Example #1
0
        public bool DeleteCounsil(Counsil c)
        {
            try
            {
                string delete = "Delete from Counsil where CounsilID=" + c.CounsilID + "";

                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();
            }
        }
Example #2
0
        public List <Counsil> GetCounsil()
        {
            Locounsil = new List <Counsil>();
            try
            {
                string Get = " Select * from Counsil ";
                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())
                {
                    Counsil c = new Counsil();
                    c.CounsilID   = Convert.ToInt32(dr["CounsilID"]);
                    c.CounsilName = dr["CounsilName"].ToString();
                    Locounsil.Add(c);
                }
                dr.Close();
                tran.Commit();
                return(Locounsil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Example #3
0
        public bool SaveCounsil(Counsil c)
        {
            try
            {
                string insert;

                if (c.CounsilID == 0)
                {
                    insert = " Insert into Counsil  (CounsilName) values ('" + c.CounsilName + "')";
                }
                else
                {
                    insert = "Update Counsil set CounsilName='" + c.CounsilName + "' where CounsilID=" + c.CounsilID + "";
                }
                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();
            }
        }
Example #4
0
        public List <Counsil> GetCouncils(Membership mem)
        {
            List <Counsil> councils = new List <Counsil>();

            try
            {
                members = new List <Membership>();
                string insert = "Select mc.*,c.CounsilName from MemberCouncil  mc,Counsil c where c.CounsilID = mc.CounsilId 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())
                {
                    Counsil c = new Counsil();
                    c.CounsilID   = Convert.ToInt32(dr["CounsilID"]);
                    c.CounsilName = dr["CounsilName"].ToString();
                    councils.Add(c);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
            return(councils);
        }
Example #5
0
 private void tsSelect_Click(object sender, EventArgs e)
 {
     if (DGVCounsil.CurrentRow != null)
     {
         if (DGVCounsil.CurrentRow.Cells["CounsilID"].Value != null)
         {
             int ID = Convert.ToInt32(DGVCounsil.CurrentRow.Cells["CounsilID"].Value);
             this.CurrentCounsil = ((Counsil)Counsil.Where(c => c.CounsilID == ID).Single <Counsil>());
         }
     }
     this.Close();
 }
Example #6
0
        public List <Counsil> GetMemberCouncil(Membership MemberID)
        {
            Locounsil = new List <Counsil>();
            try
            {
                string Get = "SELECT mc.CounsilID,c.CounsilName from Counsil c,MemberCouncil mc,MembershipData md" +
                             " WHERE mc.CounsilID=c.CounsilID 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())
                {
                    Counsil c = new Counsil();
                    c.CounsilID   = Convert.ToInt32(dr["CounsilID"]);
                    c.CounsilName = dr["CounsilName"].ToString();
                    Locounsil.Add(c);
                }
                dr.Close();
                tran.Commit();
                return(Locounsil);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Example #7
0
 private void tsSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCounsil.Text.Length > 0)
         {
             c             = new Counsil();
             c.CounsilName = this.txtCounsil.Text.Trim();
             if (frm.CurrentCounsil != null)
             {
                 c.CounsilID = frm.CurrentCounsil.CounsilID;
             }
             if (new CounsilBLL().SaveCounsil(c))
             {
                 MessageBox.Show("Counsil Saved Successfully", "Success");
                 ClearControls();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #8
0
 public bool DeleteCounsil(Counsil c)
 {
     return(new CounsilDAL().DeleteCounsil(c));
 }
Example #9
0
 public bool SaveCounsil(Counsil c)
 {
     return(new CounsilDAL().SaveCounsil(c));
 }
Example #10
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);
            }
        }