예제 #1
0
        public IList <SchemeCategory> Get()
        {
            try
            {
                Logger.LogInfo("Get: Scheme category process start");
                IList <SchemeCategory> schemeCategories = new List <SchemeCategory>();

                DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ALL));
                foreach (DataRow dr in dtAppConfig.Rows)
                {
                    SchemeCategory schemeCategory = convertToSchemeCategory(dr);
                    schemeCategories.Add(schemeCategory);
                }
                Logger.LogInfo("Get: Scheme category process completed.");
                return(schemeCategories);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                return(null);
            }
        }
예제 #2
0
        private SchemeCategory convertToSchemeCategory(DataRow dr)
        {
            SchemeCategory schemeCategory = new SchemeCategory();

            schemeCategory.Id   = dr.Field <int>("ID");
            schemeCategory.Name = dr.Field <string>("Name");

            schemeCategory.UpdatedBy         = dr.Field <int>("UpdatedBy");
            schemeCategory.UpdatedOn         = dr.Field <DateTime>("UpdatedOn");
            schemeCategory.UpdatedByUserName = dr.Field <string>("UpdatedByUserName");
            schemeCategory.CreatedBy         = dr.Field <int>("CreatedBy");
            schemeCategory.CreatedOn         = dr.Field <DateTime>("CreatedOn");
            schemeCategory.UpdatedByUserName = dr.Field <string>("UpdatedByUserName");
            return(schemeCategory);
        }
        public Result Delete(SchemeCategory schemeCategory)
        {
            var result = new Result();

            try
            {
                SchemeCategoryService schemeCategoryService = new SchemeCategoryService();
                schemeCategoryService.Delete(schemeCategory);
                result.IsSuccess = true;
            }
            catch (Exception exception)
            {
                result.IsSuccess     = false;
                result.ExceptionInfo = exception;
            }
            return(result);
        }
예제 #4
0
 public void Delete(SchemeCategory schemeCategory)
 {
     try
     {
         DataBase.DBService.ExecuteCommand(string.Format(DELETE_BY_ID, schemeCategory.Name));
         Activity.ActivitiesService.Add(ActivityType.DeleteSchemeCategory, EntryStatus.Success,
                                        Source.Server, schemeCategory.UpdatedByUserName, schemeCategory.Name, schemeCategory.MachineName);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         throw ex;
     }
 }
예제 #5
0
        public void Add(SchemeCategory schemeCategory)
        {
            try
            {
                //string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(GET_CLIENT_NAME_QUERY, 0));

                DataBase.DBService.ExecuteCommand(string.Format(INSERT_QUERY,
                                                                schemeCategory.Name,
                                                                schemeCategory.CreatedOn.ToString("yyyy-MM-dd hh:mm:ss"), schemeCategory.CreatedBy,
                                                                schemeCategory.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), schemeCategory.UpdatedBy));

                Activity.ActivitiesService.Add(ActivityType.CreateSchemeCategory, EntryStatus.Success,
                                               Source.Server, schemeCategory.UpdatedByUserName, schemeCategory.Name, schemeCategory.MachineName);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                throw ex;
            }
        }