public int SaveRows(DbTransaction pTran, RequestClassList RequestClassList, bool CreateTransaction)
        {
            int           intRows   = 0;
            DbTransaction objTran   = pTran;
            Exception     exception = null;

            try
            {
                if (pTran == null && CreateTransaction == true)
                {
                    objTran = RequestClassData.CreateTransaction();
                }
                intRows = RequestClassData.SaveRows(objTran, RequestClassList);
                if (pTran == null && objTran != null && CreateTransaction == true)
                {
                    RequestClassData.CommitTransaction(objTran, true);
                    objTran = null;
                }
            }
            catch (Exception EX)
            {
                exception = EX;
                if (pTran == null && objTran != null && CreateTransaction == true)
                {
                    RequestClassData.RollbackTransaction(objTran, true);
                    objTran = null;
                }
            }
            finally
            {
            }
            return(intRows);
        }
Example #2
0
        private List <RequestClass> fillRequestClassList()
        {
            RequestClassBusiness _RequestClassBusiness = new RequestClassBusiness();
            RequestClassList     _RequestClassList     = _RequestClassBusiness.SelectRows(null, null, null);

            return(_RequestClassList);
        }
Example #3
0
        public RequestClassList SelectRows(DbTransaction pTran, System.Int32?Id, System.String name, System.String nameAr)
        {
            RequestClassList RequestClassList = new RequestClassList();
            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].[SelectRequestClass]", Parameters);

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

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

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

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

            return(intRows);
        }
 public int SaveRows(DbTransaction pTran, RequestClassList RequestClassList)
 {
     return(SaveRows(pTran, RequestClassList, true));
 }
        public int SaveRows(RequestClassList RequestClassList)
        {
            DbTransaction Tran = null;

            return(SaveRows(Tran, RequestClassList, true));
        }