Exemplo n.º 1
0
        public static List <ChampeignCharge> GetAll(int CID)
        {
            DBCon                  dBCon   = new DBCon();
            SqlCommand             cmd     = null;
            SqlDataReader          SDR     = null;
            List <ChampeignCharge> ListTmp = new List <ChampeignCharge>();
            string                 Query   = "SELECT * FROM  CustWallet where CID=" + CID.ToString();

            try
            {
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int             index  = 0;
                    ChampeignCharge ObjTmp = new ChampeignCharge();
                    ObjTmp.ChargeId   = SDR.GetInt32(index++);
                    ObjTmp.ChargeAmt  = SDR.GetDouble(index++);
                    ObjTmp.OID        = SDR.GetInt64(index++);
                    ObjTmp.CashBkId   = SDR.GetInt32(index++);
                    ObjTmp.CreateDate = SDR.GetDateTime(index++);
                    ObjTmp.OrgId      = SDR.GetInt32(index++);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Close(); }

            return(ListTmp);
        }
Exemplo n.º 2
0
        public static int ChargeCamp(Int64 OID, int CBID, int OrgId)
        {
            if (CBID > 0)
            {
                HG_OrganizationDetails ObjOrg = new HG_OrganizationDetails().GetOne(OrgId);

                var             chargeAmt       = new Settings().GetOne("CBCHARGE");
                ChampeignCharge champeignCharge = new ChampeignCharge();

                champeignCharge.ChargeAmt  = double.Parse(chargeAmt.KeyValue);
                champeignCharge.CashBkId   = CBID;
                champeignCharge.OID        = OID;
                champeignCharge.OrgId      = OrgId;
                champeignCharge.CreateDate = DateTime.Now;
                double AvailableAmt = ObjOrg.WalletAmt - champeignCharge.ChargeAmt;
                champeignCharge.BalanceAmt = AvailableAmt;
                champeignCharge.Save();
                ObjOrg.WalletAmt = AvailableAmt;
                ObjOrg.Save();
                return(champeignCharge.ChargeId);
            }
            return(0);
        }