Exemple #1
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            MParameterCom mParameterCom = null;

            // Variable initialize
            mParameterCom = new MParameterCom();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_SYSTEMS))
                throw new ExecuteException("E_MSG_00013");

            // Check valid
            int i = 0;
            foreach (var obj in inputObject.ListParams)
            {
                if (DataCheckHelper.IsNull(obj.ParamValue))
                    throw new ExecuteException("E_MSG_00004", string.Format("Giá trị ({0})", i + 1));
                if (!mParameterCom.IsExist(obj.ParamCd, false))
                    throw new DataNotExistException(string.Format("Tham số ({0})", i + 1));
                var paramType = mParameterCom.GetType(obj.ParamCd, false);
                if (paramType == Logics.PT_NUMBER && !DataCheckHelper.IsNumber(obj.ParamValue))
                    throw new ExecuteException("E_MSG_00001", string.Format("Giá trị ({0})", i + 1));
                if (paramType == Logics.PT_DATE && !DataCheckHelper.IsDate(obj.ParamValue))
                    throw new ExecuteException("E_MSG_00001", string.Format("Giá trị ({0})", i + 1));
                i++;
            }
        }
Exemple #2
0
        /// <summary>
        /// Execute send email.
        /// </summary>
        /// <param name="param">String</param>
        /// <returns>EmailModel</returns>
        private void SendEmail(string clientEmail, string acceptSlipNo)
        {
            // Local variable declaration
            MParameterCom mParameterCom = null;

            // Variable initialize
            mParameterCom = new MParameterCom();

            // Get data
            var emailModel = GetEmailModel(acceptSlipNo);
            var fileTemplate = FileHelper.ToString("/pages/media/email/accept-new.html");

            var email = mParameterCom.GetString(Logics.PR_EMAIL_SUPPORT, false);
            var emailPass = mParameterCom.GetString(Logics.PR_EMAIL_SUPPORT_PASS, false);
            var hostMail = mParameterCom.GetString(Logics.PR_MAIL_SERVER, false);
            var subject = string.Format("Xác nhận Đơn hàng #{0}", acceptSlipNo);
            var body = DataHelper.FormatString(fileTemplate, emailModel);

            MailHelper.SendMail(clientEmail, email, subject, body, hostMail);
            MailHelper.SendMail(email, clientEmail, subject, body, hostMail, emailPass);
        }
Exemple #3
0
        /// <summary>
        /// Execute get email model.
        /// </summary>
        /// <param name="param">String</param>
        /// <returns>EmailModel</returns>
        private OutputEmailModel GetEmailModel(string param)
        {
            // Local variable declaration
            OutputEmailModel emailModel = null;
            ClientCheckoutDao clientCheckoutDao = null;
            MParameterCom mParameterCom = null;
            MCodeCom mCodeCom = null;
            IList<OutputAcceptDetailsModel> listAcceptDetails = null;

            // Variable initialize
            emailModel = new OutputEmailModel();
            clientCheckoutDao = new ClientCheckoutDao();
            mParameterCom = new MParameterCom();
            mCodeCom = new MCodeCom();
            listAcceptDetails = new List<OutputAcceptDetailsModel>();

            // Get data
            var accept = clientCheckoutDao.GetAccept(param);
            var strHotline = mParameterCom.GetString(Logics.PR_HOTLINE, false);
            var strEmail = mParameterCom.GetString(Logics.PR_EMAIL_SUPPORT, false);
            var paymentMethodsContent = mCodeCom.GetCodeContent(Logics.GROUP_PAYMENT_METHODS, accept.PaymentMethods);
            OutputAcceptDetailsModel acceptDetails = null;
            foreach (var obj in accept.AcceptDetails)
            {
                acceptDetails = new OutputAcceptDetailsModel();
                acceptDetails.ItemName = DataHelper.ToString(obj.ItemName);
                acceptDetails.DetailPrice = DataHelper.ToString(Formats.CURRENCY, obj.DetailPrice);
                acceptDetails.DetailQtty = DataHelper.ToString(Formats.NUMBER, obj.DetailQtty);
                acceptDetails.DetailAmt = DataHelper.ToString(Formats.CURRENCY, obj.DetailAmt);
                listAcceptDetails.Add(acceptDetails);
            }

            // Set data
            emailModel.AcceptSlipNo = DataHelper.ToString(accept.AcceptSlipNo);
            emailModel.ViewId = DataHelper.ToString(accept.ViewId);
            emailModel.AcceptDate = DataHelper.ToString(Formats.RFC_DATE, accept.AcceptDate);
            emailModel.ClientName = DataHelper.ToString(accept.ClientName);
            emailModel.ClientAddress = DataHelper.ToString(accept.ClientAddress);
            emailModel.ClientTel = DataHelper.ToString(accept.ClientTel);
            emailModel.DeliveryName = DataHelper.ToString(accept.DeliveryName);
            emailModel.DeliveryAddress = DataHelper.ToString(accept.DeliveryAddress);
            emailModel.DeliveryTel = DataHelper.ToString(accept.DeliveryTel);
            emailModel.PaymentMethodsContent = DataHelper.ToString(paymentMethodsContent);
            emailModel.Notes = DataHelper.ToString(accept.Notes);
            emailModel.Hotline = DataHelper.ToString(strHotline);
            emailModel.EmailSupport = DataHelper.ToString(strEmail);
            emailModel.AcceptDetails = listAcceptDetails;
            emailModel.TotalAmount = DataHelper.ToString(Formats.CURRENCY, accept.TotalAmount);

            // Return value;
            return emailModel;
        }
Exemple #4
0
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel getResult = null;
            ClientItemDetailsDao clientItemDetailsDao = null;
            ItemCom itemCom = null;
            MParameterCom mParameterCom = null;

            // Variable initialize
            getResult = new InitDataModel();
            clientItemDetailsDao = new ClientItemDetailsDao();
            itemCom = new ItemCom();
            mParameterCom = new MParameterCom();

            // Get data
            var item = clientItemDetailsDao.GetItem(inputObject);
            var listRelation = clientItemDetailsDao.GetListItemsByBrandCd(item.BrandCd, inputObject.ItemCd);
            var strHotline = mParameterCom.GetString(Logics.PR_HOTLINE, false);

            // Update data
            itemCom.UpdateViewer(inputObject.ItemCd);

            // Set value
            getResult.Item = itemCom.ToItemModel(item);
            getResult.ListRelation = itemCom.ToListItemModel(listRelation);
            getResult.Hotline = strHotline;

            // Return value
            return getResult;
        }
Exemple #5
0
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel getResult = null;
            ClientMasterDao clientMasterDao = null;
            MCodeCom mCodeCom = null;
            MParameterCom mParameterCom = null;
            CartCom cartCom = null;

            // Variable initialize
            getResult = new InitDataModel();
            clientMasterDao = new ClientMasterDao();
            mCodeCom = new MCodeCom();
            mParameterCom = new MParameterCom();
            cartCom = new CartCom(inputObject.Cart);

            // Get data
            var cartCount = cartCom.Count;
            var strEmail = mParameterCom.GetString(Logics.PR_EMAIL_SUPPORT, false);

            var listToys = clientMasterDao.GetListCategories(Logics.CD_CATEGORY_DIV_TOYS);
            var listLearningTools = clientMasterDao.GetListCategories(Logics.CD_CATEGORY_DIV_LEARNING_TOOLS);
            var listBooks = clientMasterDao.GetListCategories(Logics.CD_CATEGORY_DIV_BOOKS);
            var listAge = clientMasterDao.GetListAge();
            var listGender = clientMasterDao.GetListGender();
            var listBrand = clientMasterDao.GetListBrand();
            var listCountry = clientMasterDao.GetListCountry();

            // Set value
            getResult.CartCount = cartCount;
            getResult.Email = strEmail;

            getResult.ListToys = listToys;
            getResult.ListLearningTools = listLearningTools;
            getResult.ListBooks = listBooks;
            getResult.ListAge = listAge;
            getResult.ListGender = listGender;
            getResult.ListBrand = listBrand;
            getResult.ListCountry = listCountry;

            // Return value
            return getResult;
        }
Exemple #6
0
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel getResult = null;
            MParameterCom mParameterCom = null;

            // Variable initialize
            getResult = new InitDataModel();
            mParameterCom = new MParameterCom();

            // Get data
            var listParams = mParameterCom.GetList(false);

            // Set value
            getResult.ListParams = listParams;

            // Return value
            return getResult;
        }
Exemple #7
0
        /// <summary>
        /// Update data
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private UpdateDataModel UpdateInfo(UpdateDataModel inputObject)
        {
            // Local variable declaration
            UpdateDataModel getResult = null;
            MParameterCom mParameterCom = null;

            // Variable initialize
            getResult = new UpdateDataModel();
            mParameterCom = new MParameterCom();

            // Get data
            foreach (var obj in inputObject.ListParams)
            {
                mParameterCom.Update(obj, false);
            }

            // Submit data
            mParameterCom.SubmitChanges();

            // Return value
            return getResult;
        }
Exemple #8
0
        /// <summary>
        /// Execute send email.
        /// </summary>
        /// <param name="param">String</param>
        /// <returns>EmailModel</returns>
        private void SendEmail(SaveDataModel inputObject)
        {
            // Local variable declaration
            MParameterCom mParameterCom = null;

            // Variable initialize
            mParameterCom = new MParameterCom();

            // Get data
            var emailModel = GetEmailModel(inputObject);
            var fileTemplate = FileHelper.ToString("/pages/media/email/active.html");

            var email = mParameterCom.GetString(Logics.PR_EMAIL_SUPPORT, false);
            var emailPass = mParameterCom.GetString(Logics.PR_EMAIL_SUPPORT_PASS, false);
            var hostMail = mParameterCom.GetString(Logics.PR_MAIL_SERVER, false);
            var subject = "Xác nhận tài khoản";
            var body = DataHelper.FormatString(fileTemplate, emailModel);

            MailHelper.SendMail(email, inputObject.Email, subject, body, hostMail, emailPass);
        }
Exemple #9
0
        /// <summary>
        /// Execute get email model.
        /// </summary>
        /// <param name="param">String</param>
        /// <returns>EmailModel</returns>
        private OutputEmailModel GetEmailModel(SaveDataModel inputObject)
        {
            // Local variable declaration
            OutputEmailModel emailModel = null;
            UserCom userCom = null;
            MParameterCom mParameterCom = null;

            // Variable initialize
            emailModel = new OutputEmailModel();
            userCom = new UserCom();
            mParameterCom = new MParameterCom();

            // Get data

            var strHotline = mParameterCom.GetString(Logics.PR_HOTLINE, false);
            var strEmail = mParameterCom.GetString(Logics.PR_EMAIL_SUPPORT, false);
            var strChatYahoo = mParameterCom.GetString(Logics.PR_CHAT_YAHOO, false);

            // Set data
            emailModel.UserCd = DataHelper.ToString(inputObject.UserCd);
            emailModel.FullName = DataHelper.ToString(inputObject.Fullname);
            emailModel.Hotline = DataHelper.ToString(strHotline);
            emailModel.EmailSupport = DataHelper.ToString(strEmail);
            emailModel.ChatYahoo = DataHelper.ToString(strChatYahoo); ;

            // Return value;
            return emailModel;
        }
Exemple #10
0
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel getResult = null;
            ClientIndexDao clientIndexDao = null;
            ItemCom itemCom = null;
            MParameterCom mParameterCom = null;

            // Variable initialize
            getResult = new InitDataModel();
            clientIndexDao = new ClientIndexDao();
            itemCom = new ItemCom();
            mParameterCom = new MParameterCom();

            // Get data
            var listBanners = clientIndexDao.GetListBanners();
            var listNewItems = clientIndexDao.GetListNewItems();
            var listHotItems = clientIndexDao.GetListHotItems();
            var listOfferItems = clientIndexDao.GetListOfferItems();
            var discountMember = mParameterCom.GetNumber(Logics.PR_DISCOUNT_MEMBER, false);
            var strHotline = mParameterCom.GetString(Logics.PR_HOTLINE, false);
            var strChatYahoo = mParameterCom.GetString(Logics.PR_CHAT_YAHOO, false);
            var strChatSkype = mParameterCom.GetString(Logics.PR_CHAT_SKYPE, false);

            // Set value
            getResult.DiscountMember = discountMember;
            getResult.Hotline = strHotline;
            getResult.ChatYahoo = strChatYahoo;
            getResult.ChatSkype = strChatSkype;
            getResult.ListBanners = listBanners;
            getResult.ListNewItems = itemCom.ToListItemModel(listNewItems);
            getResult.ListHotItems = itemCom.ToListItemModel(listHotItems);
            getResult.ListOfferItems = itemCom.ToListItemModel(listOfferItems);

            // Return value
            return getResult;
        }
Exemple #11
0
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel getResult = null;
            ClientItemsDao clientItemsDao = null;
            ItemCom itemCom = null;
            MParameterCom mParameterCom = null;

            // Variable initialize
            getResult = new InitDataModel();
            clientItemsDao = new ClientItemsDao();
            itemCom = new ItemCom();
            mParameterCom = new MParameterCom();

            // Get data
            var listItems = clientItemsDao.GetListItems(inputObject);
            var discountMember = mParameterCom.GetNumber(Logics.PR_DISCOUNT_MEMBER, false);
            var strHotline = mParameterCom.GetString(Logics.PR_HOTLINE, false);
            var strChatYahoo = mParameterCom.GetString(Logics.PR_CHAT_YAHOO, false);

            // Title
            var title = string.Empty;
            if (!DataCheckHelper.IsNull(inputObject.SearchText))
                title = "Tìm kiếm";
            else if (!DataCheckHelper.IsNull(inputObject.CategoryCd))
                title = clientItemsDao.GetCategoryName(inputObject.CategoryCd);
            else if (!DataCheckHelper.IsNull(inputObject.BrandCd))
                title = clientItemsDao.GetBrandName(inputObject.BrandCd);
            else if (!DataCheckHelper.IsNull(inputObject.AgeCd))
                title = clientItemsDao.GetAgeName(inputObject.AgeCd);
            else if (!DataCheckHelper.IsNull(inputObject.GenderCd))
                title = clientItemsDao.GetGenderName(inputObject.GenderCd);
            else if (!DataCheckHelper.IsNull(inputObject.OfferGroupCd))
                title = "Khuyến mãi";
            else title = "Tất cả";

            // Set value
            getResult.Title = title;
            getResult.DiscountMember = discountMember;
            getResult.Hotline = strHotline;
            getResult.ChatYahoo = strChatYahoo;
            getResult.ListItems = PagingHelper.GetPagerList(
                itemCom.ToListItemModel(listItems), inputObject);

            // Return value
            return getResult;
        }