示例#1
0
        private List <CardValidity> fillCardValidityList()
        {
            CardValidityBusiness _CardValidityBusiness = new CardValidityBusiness();
            CardValidityList     _CardValidityList     = _CardValidityBusiness.SelectRows(null, null, null);

            return(_CardValidityList);
        }
        public int SaveRows(DbTransaction pTran, CardValidityList CardValidityList, bool CreateTransaction)
        {
            int           intRows   = 0;
            DbTransaction objTran   = pTran;
            Exception     exception = null;

            try
            {
                if (pTran == null && CreateTransaction == true)
                {
                    objTran = CardValidityData.CreateTransaction();
                }
                intRows = CardValidityData.SaveRows(objTran, CardValidityList);
                if (pTran == null && objTran != null && CreateTransaction == true)
                {
                    CardValidityData.CommitTransaction(objTran, true);
                    objTran = null;
                }
            }
            catch (Exception EX)
            {
                exception = EX;
                if (pTran == null && objTran != null && CreateTransaction == true)
                {
                    CardValidityData.RollbackTransaction(objTran, true);
                    objTran = null;
                }
            }
            finally
            {
            }
            return(intRows);
        }
示例#3
0
        public CardValidityList SelectRows(DbTransaction pTran, System.Int32?Id, System.String name, System.String nameAr)
        {
            CardValidityList CardValidityList = new CardValidityList();
            Exception        exception        = null;

            DbParameter[] Parameters = new DbParameter[3];
            Parameters[0] = _getIdParameter(Id, ParameterDirection.Input);
            Parameters[1] = _getnameParameter(name, ParameterDirection.Input);
            Parameters[2] = _getnameArParameter(nameAr, ParameterDirection.Input);

            DbDataReader Dr = ExecuteReader(pTran, "[Lookups].[SelectCardValidity]", Parameters);

            try
            {
                if (Dr != null)
                {
                    while (Dr.Read())
                    {
                        CardValidity CardValidity = new CardValidity();
                        if (Dr["Id"] != DBNull.Value)
                        {
                            CardValidity.Id = (System.Int32)Dr["Id"];
                        }
                        if (Dr["name"] != DBNull.Value)
                        {
                            CardValidity.name = (System.String)Dr["name"];
                        }
                        if (Dr["nameAr"] != DBNull.Value)
                        {
                            CardValidity.nameAr = (System.String)Dr["nameAr"];
                        }
                        CardValidityList.FillRow(CardValidity);
                        CardValidity = null;
                    }
                }
            }
            catch (Exception Ex)
            {
                exception = Ex;
            }
            finally
            {
                if (Dr != null)
                {
                    if (Dr.IsClosed == false)
                    {
                        Dr.Close();
                    }
                    Dr = null;
                }
            }
            return(CardValidityList);
        }
示例#4
0
        public int SaveRows(DbTransaction pTran, CardValidityList CardValidityList)
        {
            int intRows = 0;

            for (int i = 0; i < CardValidityList.Count; i++)
            {
                switch (CardValidityList[i].CommonState)
                {
                case CommonState.Added:
                    intRows += InsertRow(pTran, CardValidityList[i]);
                    break;

                case CommonState.Modified:
                    intRows += UpdateRow(pTran, CardValidityList[i]);
                    break;

                case CommonState.Deleted:
                    intRows += DeleteRow(pTran, CardValidityList[i]);
                    break;
                }
            }

            return(intRows);
        }
示例#5
0
        public int SaveRows(CardValidityList CardValidityList)
        {
            DbTransaction Tran = null;

            return(SaveRows(Tran, CardValidityList));
        }
 public int SaveRows(DbTransaction pTran, CardValidityList CardValidityList)
 {
     return(SaveRows(pTran, CardValidityList, true));
 }