Ejemplo n.º 1
0
        /// <summary>
        /// Description  : To Get Service Which you want to Edit
        /// Created By   : Anji
        /// Created Date : 03 May 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <param name="serviceId">pass the Service id which Service details you wont </param>
        /// <returns>it will give service </returns>
        public static Service GetServiceById(int? id)
        {
            var services = new Service();

            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, "SpGetServiceById", sqlParams);

                while (reader.Read())
                {
                    services.FetchService(services, new SafeDataReader(reader));
                }
                return services;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return services;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Description  : To Show all the Services in View
        /// Created By   : Anji
        /// Created Date : 03 May 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns>it will give all the Service details available in database</returns>
        public static ServiceInfo GetAllServices(int startPage, int resultPerPage, string code, int status, string OrderBy)
        {
            var data = new ServiceInfo();

            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, "[SpGetAllMServices]", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var service = new Service();
                    service.FetchService(service, safe);
                    data.ServiceList.Add(service);
                    data.ServiceCount = Convert.ToInt32(reader["serviceCount"]);
                }
                return data;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return data;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }