Ejemplo n.º 1
0
        public JsonResult CreateGLCode(int GLCodeId, string code, string desc, bool status)
        {
            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                Int32 returnValue = -2;
                int checkSession = UserLogin.AuthenticateRequest();
                int createdBy = Convert.ToInt32(Session["UserID"]);
                if (checkSession == 0)
                {
                    return Json(returnValue);
                }
                else
                {
                    var data = new GLCode
                    {
                        Id = GLCodeId,
                        Code = code,
                        Description = desc,
                        Status = status,
                        CreatedBy = createdBy
                    };

                    int result = data.InsertGLCode();
                    return Json(result);
                }
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return Json("");
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Ejemplo n.º 2
0
        private GLCode FetchGLCode(GLCode glcode, SafeDataReader dr)
        {
            glcode.Id = dr.GetInt32("ID");
            glcode.Code = dr.GetString("Code");
            glcode.Description = dr.GetString("Description");
            glcode.Status = dr.GetBoolean("Status");

            return glcode;
        }
Ejemplo n.º 3
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.º 4
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);
            }
        }