예제 #1
0
        public static ResultData <int> Update(UserProfile user)
        {
            try
            {
                LogHelpers.LogHandler.Info("Id: " + user.Id);
                user.Password    = Utilities.ToMD5Hash(user.Password.Trim());
                user.DateOfBirth = Utilities.ParseToDate(user.DateOfBirthString);

                var stored = "sp_Users_Insert_Update";
                var result = DataAccessHelpers.ExecuteStored(stored, user.GetParameters());

                if (result.Code < 0)
                {
                    LogHelpers.LogHandler.Error(result.ErrorMessage);
                }

                return(result);
            }
            catch (Exception ex)
            {
                LogHelpers.LogHandler.Error(ex.ToString());
                return(new ResultData <int>()
                {
                    Code = ex.HResult,
                    ErrorMessage = ex.Message
                });
            }
        }
예제 #2
0
        public static ResultBOL <int> InsertOrUpdate(ContactBOL contact)
        {
            string stored = "sp_Contacts_Insert_Update";
            var    result = DataAccessHelpers.ExecuteStored(stored, contact.GetParameters());

            return(result);
        }
예제 #3
0
        public static ResultBOL <int> InsertOrUpdate(MenuBOL obj)
        {
            string stored = "sp_Menu_Insert_Update";
            var    result = DataAccessHelpers.ExecuteStored(stored, obj.GetParameters());

            return(result);
        }
예제 #4
0
        public static ResultBOL <int> InsertOrUpdate(OtherTypeBOL BOL)
        {
            string stored = "sp_OtherType_Insert_Update";
            var    result = DataAccessHelpers.ExecuteStored(stored, BOL.GetParameters());

            return(result);
        }
예제 #5
0
        public static ResultBOL <string> UpdateIndex(OtherTypeUpdateIndexBOL[] list)
        {
            string stored = "sp_OtherType_Insert_Update";

            ResultBOL <string> result = new ResultBOL <string>();

            foreach (OtherTypeUpdateIndexBOL obj in list)
            {
                var updateResult = DataAccessHelpers.ExecuteStored(stored, obj.GetParameters());
                if (updateResult.Code < 0)
                {
                    if (string.IsNullOrEmpty(result.ErrorMessage))
                    {
                        result.ErrorMessage = updateResult.ErrorMessage;
                    }
                    else
                    {
                        result.ErrorMessage += "\n" + updateResult.ErrorMessage;
                    }
                }
            }

            if (!string.IsNullOrEmpty(result.ErrorMessage))
            {
                result.Code = -1;
            }

            return(result);
        }
예제 #6
0
        public static ResultData <int> InsertOrUpdate(News news)
        {
            LogHelpers.LogHandler.Info("Start");
            try
            {
                if (news.Id > 0)
                {
                    news.Content_EN = Utilities.ReplaceImageUri(news.Id, news.Content_EN, ConfigurationManager.AppSettings["UploadFilesDir"]);
                    news.Content_VN = Utilities.ReplaceImageUri(news.Id, news.Content_VN, Utilities.UploadImagesDir());
                }

                string stored = "sp_News_Insert_Update";
                var    result = DataAccessHelpers.ExecuteStored(stored, news.GetParameters());
                if (result.Code < 0)
                {
                    LogHelpers.LogHandler.Error(result.ErrorMessage);
                }
                else if (news.Id <= 0)
                {
                    news.Id = result.Code;
                    return(UpdateContent(news));
                }

                return(result);
            }
            catch (Exception ex)
            {
                LogHelpers.LogHandler.Error(ex.ToString());
                return(new ResultData <int>()
                {
                    Code = ex.HResult,
                    ErrorMessage = ex.Message
                });
            }
        }
예제 #7
0
        public static ResultBOL <int> InsertOrUpdate(UserBOL user)
        {
            string stored = "sp_Users_Insert_Update";
            var    result = DataAccessHelpers.ExecuteStored(stored, user.GetParameters());

            return(result);
        }
예제 #8
0
        public static ResultBOL <int> InsertOrUpdate(MenuBOL obj)
        {
            //string type = GetType(obj.ParentId);
            //if (!string.IsNullOrEmpty(type))
            //{
            //    switch (type)
            //    {
            //        case "DichVu":
            //            return NewsDAL.InsertOrUpdate(new NewsBOL() {
            //                Name_EN = obj.Name_EN,
            //                Name_VN = obj.Name_VN,
            //                ImageLink = obj.Image,
            //                Type = type,
            //                ParentId = obj.ParentId
            //            });

            //        default:
            //            break;
            //    }
            //}

            string stored = "sp_Menu_Insert_Update";
            var    result = DataAccessHelpers.ExecuteStored(stored, obj.GetParameters());

            return(result);
        }
예제 #9
0
        public static ResultBOL <int> UpdatePriorityOrDisable(object obj)
        {
            string stored = "sp_News_Insert_Update";
            var    result = DataAccessHelpers.ExecuteStored(stored, obj);

            return(result);
        }
예제 #10
0
        public static ResultData <int> InsertOrUpdate(Menu menu)
        {
            LogHelpers.LogHandler.Info("Start.");
            try
            {
                string stored = "sp_Menu_Insert_Update";
                var    result = DataAccessHelpers.ExecuteStored(stored, menu.GetParameters());

                if (result.Code < 0)
                {
                    LogHelpers.LogHandler.Error(result.ErrorMessage);
                }

                return(result);
            }
            catch (Exception ex)
            {
                LogHelpers.LogHandler.Error(ex.ToString());
                return(new ResultData <int>()
                {
                    Code = ex.HResult,
                    ErrorMessage = ex.Message
                });
            }
        }
예제 #11
0
        public static ResultBOL <int> UpdateSiteVisitors()
        {
            string stored = "sp_UpdateSiteVisitors";
            var    result = DataAccessHelpers.ExecuteStored(stored, null);

            return(result);
        }
예제 #12
0
        public static ResultBOL <int> InsertOrUpdate(ProjectBOL BOL)
        {
            string imageDir = Utilities.GetDirectory("ImagesDir");

            BOL.Content_VN = Utilities.ReplaceImageUri(BOL.Content_VN, imageDir);
            BOL.Content_EN = Utilities.ReplaceImageUri(BOL.Content_VN, imageDir);

            string stored = "sp_Peojects_Insert_Update";
            var    result = DataAccessHelpers.ExecuteStored(stored, BOL.GetParameters());

            return(result);
        }
예제 #13
0
        public static ResultBOL <int> InsertOrUpdate(GalleryBOL obj)
        {
            string          stored = "sp_Galley_Insert_Update";
            ResultBOL <int> result = DataAccessHelpers.ExecuteStored(stored, obj);

            if (result.Code < 0)
            {
                _log.Error(result.ErrorMessage);
            }
            else
            {
                obj.Id = result.Data;
            }

            return(result);
        }
예제 #14
0
        public static ResultBOL <int> InsertOrUpdate(AboutBOL about)
        {
            if (about == null)
            {
                return(new ResultBOL <int>()
                {
                    Code = -20,
                    ErrorMessage = Utilities.GetErrorMessage("NullObject")
                });
            }

            string stored = "sp_About_Insert_Update";

            about.InsertDate  = DateTime.Now;
            about.UpdatedDate = DateTime.Now;

            var result = DataAccessHelpers.ExecuteStored(stored, about.GetParameters());

            return(result);
        }
예제 #15
0
        private static ResultData <int> UpdateContent(News news)
        {
            if (news == null)
            {
                return(new ResultData <int>()
                {
                    Code = -104,
                    ErrorMessage = "Data not found"
                });
            }

            LogHelpers.LogHandler.Info("NewsId: " + news.Id.ToString());
            try
            {
                news.Content_EN = Utilities.ReplaceImageUri(news.Id, news.Content_EN, Utilities.UploadImagesDir());
                news.Content_VN = Utilities.ReplaceImageUri(news.Id, news.Content_VN, Utilities.UploadImagesDir());

                string stored = "sp_News_Insert_Update";
                var    result = DataAccessHelpers.ExecuteStored(stored, news.GetParameters());
                if (result.Code < 0)
                {
                    LogHelpers.LogHandler.Error(result.ErrorMessage);
                }

                return(result);
            }
            catch (Exception ex)
            {
                LogHelpers.LogHandler.Error(ex.ToString());
                return(new ResultData <int>()
                {
                    Code = ex.HResult,
                    ErrorMessage = ex.Message
                });
            }
        }