Exemple #1
0
        private List <RequestStatus> fillRequestStatusList()
        {
            RequestStatusBusiness _RequestStatusBusiness = new RequestStatusBusiness();
            RequestStatusList     _RequestStatusList     = _RequestStatusBusiness.SelectRows(null, null, null);

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

            try
            {
                if (pTran == null && CreateTransaction == true)
                {
                    objTran = RequestStatusData.CreateTransaction();
                }
                intRows = RequestStatusData.SaveRows(objTran, RequestStatusList);
                if (pTran == null && objTran != null && CreateTransaction == true)
                {
                    RequestStatusData.CommitTransaction(objTran, true);
                    objTran = null;
                }
            }
            catch (Exception EX)
            {
                exception = EX;
                if (pTran == null && objTran != null && CreateTransaction == true)
                {
                    RequestStatusData.RollbackTransaction(objTran, true);
                    objTran = null;
                }
            }
            finally
            {
            }
            return(intRows);
        }
        public RequestStatusList SelectRows(DbTransaction pTran, System.Int32?Id, System.String name, System.String nameAr)
        {
            RequestStatusList RequestStatusList = new RequestStatusList();
            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].[SelectRequestStatus]", Parameters);

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

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

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

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

            return(intRows);
        }
        public int SaveRows(RequestStatusList RequestStatusList)
        {
            DbTransaction Tran = null;

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