Ejemplo n.º 1
0
        /// <summary>
        /// Description  :  
        /// Created By   : Anji
        /// Created Date : 03 May 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <param name="GLCodeId">pass the GLCode id which GLCode details you wont </param>
        /// <returns></returns>
        public static GLCode GetGLCodeById(int id)
        {
            var glcode = new GLCode();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0] = new SqlParameter("@ID", id);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetGLCodeById]", sqlParams);
                while (reader.Read())
                {
                    glcode.FetchGLCode(glcode, new SafeDataReader(reader));
                }
                return glcode;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return glcode;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Description  : 
        /// Created By   : Anji
        /// Created Date : 03 May 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns>it will give all the GLCode details available in database</returns>
        public static GLCodeInfo GetAllGLCodes(int startPage, int resultPerPage, string code, int status, string OrderBy)
        {
            var data = new GLCodeInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[5];
                sqlParams[0] = new SqlParameter("@startPage", startPage);
                sqlParams[1] = new SqlParameter("@resultPerPage", resultPerPage);
                sqlParams[2] = new SqlParameter("@code", code);
                sqlParams[3] = new SqlParameter("@status", status);
                sqlParams[4] = new SqlParameter("@OrderBy", OrderBy);

                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "[SpGetAllMGLCodes]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var glcode = new GLCode();
                    glcode.FetchGLCode(glcode, safe);
                    data.GLCodeList.Add(glcode);
                    data.GLCodeCount = Convert.ToInt32(reader["GLCodeCount"]);
                }

                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }