Ejemplo n.º 1
0
 public void Delete(long donorId,
                    ref IAuctionTransaction trans)
 {
     using(var donors = new DonorCollection())
     {
         donors.DeleteMulti(new PredicateExpression {DonorFields.Id == donorId});
     }
 }
Ejemplo n.º 2
0
        public DSDonorCollection GetDonorCollectionData(DonorCollection d, string fromdate, string todate)
        {
            DSDonorCollection ds = new DSDonorCollection();

            try
            {
                string Donors = "";
                string all    = "";
                if (d.DonorName != null && d.DonorName != "")
                {
                    Donors = "Select * from DonorCollection Where DonorName='" + d.DonorName + "' and CollectionDate>=#" + fromdate + "# and CollectionDate<=#" + todate + "#";
                }
                else
                {
                    all = "Select * from DonorCollection";
                }



                con = new OleDbConnection();
                this.readconfile     = new ReadConfigFile();
                con.ConnectionString = this.readconfile.ConfigString(ConfigFiles.ProjectConfigFile);
                con.Open();
                if (con.State == ConnectionState.Open)
                {
                    string select = "";
                    if (d.DonorName != null && d.DonorName != "")
                    {
                        select = Donors;
                    }
                    else
                    {
                        select = all;
                    }

                    da = new OleDbDataAdapter(select, con);
                    da.Fill(ds, ds.Tables[0].TableName);
                }


                return(ds);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Ejemplo n.º 3
0
 public Auction.Domain.Donor GetDonor(long Id, ref IAuctionTransaction trans)
 {
     using (var donors = new DonorCollection())
     {
         donors.GetMulti(new PredicateExpression { DonorFields.Id == Id }, 1);
         return donors.Select(d => new Donor()
         {
             Id = d.Id,
             AccountId = d.AccountId,
             Name = d.Name,
             Notes = d.Notes,
             Phone = d.Phone
         }).First();
     }
 }
Ejemplo n.º 4
0
        public IList<Auction.Domain.Donor> GetByAccount(long accountId,
                                  ref IAuctionTransaction trans)
        {
            using (var donors = new DonorCollection())
            {
                var filter = new PredicateExpression { DonorFields.AccountId == accountId };
                donors.GetMulti(filter);

                return donors.Select(d => new Donor()
                {
                    Id = d.Id,
                    AccountId = d.AccountId,
                    Name = d.Name,
                    Notes = d.Notes,
                    Phone = d.Phone
                }).ToList();
            }
        }
Ejemplo n.º 5
0
             public List<DonorCollection> GetDonorCollectionData()
             {

                 try
                 {

                     Donorcollc = new List<DonorCollection>();
                     string insert = "Select * from DonorCollection";

                     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())
                     {
                         DonorCollection m = new DonorCollection();


                         m.ID = dr["ID"] == System.DBNull.Value ? 0 : Convert.ToInt32(dr["ID"]);
                         m.DonorName = dr["DonorName"] == System.DBNull.Value ? null : Convert.ToString(dr["DonorName"]);
                         m.CollectionDate = dr["CollectionDate"] == System.DBNull.Value ? new DateTime() : Convert.ToDateTime(dr["CollectionDate"]);
                         m.CollectionFee = dr["CollectionFee"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["CollectionFee"]);
                         m.ReciptNo = dr["ReciptNo"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["ReciptNo"]);
                         m.DonationType = dr["DonationType"] == System.DBNull.Value ? null : Convert.ToString(dr["DonationType"]);
                         m.Others = dr["Other"] == System.DBNull.Value ? null : Convert.ToString(dr["Other"]);
                         m.CheckDetail = dr["CheckDetail"] == System.DBNull.Value ? 0 : Convert.ToDecimal(dr["CheckDetail"]);
                         Donorcollc.Add(m);

                     }
                     dr.Close();

                     tran.Commit();
                     return Donorcollc;
                 }
                 catch (Exception ex)
                 {

                     throw ex;
                 }
             }
Ejemplo n.º 6
0
        public IList<Auction.Domain.Donor> GetByEvent(long eventId,
                                ref IAuctionTransaction trans)
        {
            using (var donors = new DonorCollection())
            {
                var relations = new RelationCollection {AuctionEventDonorEntity.Relations.DonorEntityUsingDonorId};
                var filter = new PredicateExpression { AuctionEventDonorFields.EventId == eventId };
                donors.GetMulti(filter, relations);

                return donors.Select(d => new Donor()
                {
                    Id = d.Id,
                    AccountId = d.AccountId,
                    Name = d.Name,
                    Notes = d.Notes,
                    Phone = d.Phone
                }).ToList();
            }
        }
        public void Save()
        {
            try
            {
                DC = new DonorCollection();
                DC.CollectionDate = dtpCollectionDate.Value.Date;
                DC.DonorName      = cbxName.Text.Trim();
                Decimal colfee;
                Decimal.TryParse(this.txtCollectionfee.Text, out colfee);

                DC.CollectionFee = colfee;

                Decimal recno;
                Decimal.TryParse(this.txtReciptNo.Text, out recno);

                DC.ReciptNo = recno;


                Decimal chkdetail;
                Decimal.TryParse(this.txtCheckDetails.Text, out chkdetail);

                DC.CheckDetail = chkdetail;


                DC.DonationType = cbxDonationtype.Text.Trim();
                DC.Others       = txtOtherDonation.Text.Trim();

                if (frm.CurrentCollection != null)
                {
                    DC.ID = frm.CurrentCollection.ID;
                }

                if (new DonorBLL().SaveDonorCollection(DC))
                {
                    MessageBox.Show("Donor Collection Saved Successfully");
                }
                ClearControll();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
             public bool SaveDonorCollection(DonorCollection mc)
        {
            try
            {
                string insert;
                if (mc.ID == 0)

                    insert = "Insert Into DonorCollection(DonorName,CollectionDate,CollectionFee,ReciptNo,DonationType,Other,CheckDetail) "
                       + "values ('" + mc.DonorName + "',#" + mc.CollectionDate + "#," + mc.CollectionFee + "," + mc.ReciptNo + ",'" + mc.DonationType + "','" + mc.Others + "'," + mc.CheckDetail + " )";

                else

                    insert = "Update DonorCollection set DonorName='" + mc.DonorName + "',CollectionDate=#" + mc.CollectionDate + "#,CollectionFee=" + mc.CollectionFee + " ,ReciptNo=" + mc.ReciptNo + ",DonationType='" + mc.DonationType + "',Other='" + mc.Others + "',CheckDetail="+mc.CheckDetail+"  where ID=" + mc.ID + "";


                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.º 9
0
 public DSDonorCollection GetDonorCollectionData(DonorCollection d, string Fromdate, string Todate, bool All)
 {
     return(new DonorDAL().GetDonorCollectionData(d, Fromdate, Todate, All));
 }
Ejemplo n.º 10
0
 public bool DeleteDonorCollection(DonorCollection mem)
 {
     return(new DonorDAL().DeleteDonorCollection(mem));
 }
Ejemplo n.º 11
0
 public bool SaveDonorCollection(DonorCollection mem)
 {
     return(new DonorDAL().SaveDonorCollection(mem));
 }
Ejemplo n.º 12
0
 public IList<Auction.Domain.Donor> GetDonors(IEnumerable<long> ids, ref IAuctionTransaction trans)
 {
     using(var donors = new DonorCollection())
     {
         donors.GetMulti(new PredicateExpression {DonorFields.Id == ids.ToArray()});
         return donors.Select(d => new Donor()
                                           {
                                               Id = d.Id,
                                               AccountId = d.AccountId,
                                               Name = d.Name,
                                               Notes = d.Notes,
                                               Phone = d.Phone
                                           }).ToList();
     }
 }
Ejemplo n.º 13
0
 public void Update(ref Auction.Domain.Donor donor,
                    ref IAuctionTransaction trans)
 {
     var d = new DonorEntity
     {
         Notes = donor.Notes,
         Name = donor.Name,
         AccountId = donor.AccountId,
         Phone = donor.Phone,
         UpdatedBy = donor.UpdatedBy
     };
     using (var donors = new DonorCollection())
     {
         donors.UpdateMulti(d, new PredicateExpression {DonorFields.Id == donor.Id});
     }
 }