Ejemplo n.º 1
0
 public MenuBiz(MenuPathMainBiz menuPathMainBiz, ProductBiz productBiz, IRepositry <MenuPathMain> entityDal, BizParameters bizParameters, CashTrxBiz cashTrxBiz, BankBiz bankBiz, OwnerBiz ownerBiz, AddressBiz addressBiz)
     : base(entityDal, bizParameters)
 {
     _menuPathMainBiz = menuPathMainBiz;
     _productBiz      = productBiz;
     _productChildBiz = productBiz.ProductChildBiz;
     //_likeUnlikeBiz = likeUnlikeBiz;
     _cashTrxBiz = cashTrxBiz;
     _bankBix    = bankBiz;
     _ownerBiz   = ownerBiz;
     //_addressBiz = addressBiz;
     _addressBiz = addressBiz;
 }
Ejemplo n.º 2
0
        //This supplies a dummy MenuPathMain for the Back to List in the Create.
        protected IMenuManager makeMenuManager(ControllerIndexParams parm)
        {
            MenuPathMain mpm = null;
            Product      p   = null;
            ProductChild pc  = null;

            switch (parm.MenuEnum)
            {
            case EnumLibrary.EnumNS.MenuENUM.IndexMenuPath2:
            case EnumLibrary.EnumNS.MenuENUM.IndexMenuPath3:
            case EnumLibrary.EnumNS.MenuENUM.IndexMenuProduct:

                parm.MenuPathMainId.IsNullOrWhiteSpaceThrowException();
                string mpmId = parm.MenuPathMainId;
                mpm = Find(mpmId);
                mpm.IsNullThrowException();
                break;

            case EnumLibrary.EnumNS.MenuENUM.IndexMenuProductChild:

                parm.ProductId.IsNullOrWhiteSpaceThrowException();
                string pId = parm.ProductId;
                p = ProductBiz.Find(pId);
                p.IsNullThrowException();
                break;

            case EnumLibrary.EnumNS.MenuENUM.IndexMenuProductChildLandingPage:

                parm.ProductChildId.IsNullOrWhiteSpaceThrowException();
                string productChildId = parm.ProductChildId;
                pc = ProductChildBiz.Find(productChildId);
                pc.IsNullThrowException();

                //add the features
                pc.AllFeatures = ProductChildBiz.Get_All_ProductChild_Features_For(pc);
                break;

            case EnumLibrary.EnumNS.MenuENUM.IndexMenuPath1:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuPath1:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuPath2:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuPath3:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuPathMain:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuProduct:
            case EnumLibrary.EnumNS.MenuENUM.EditMenuProductChild:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuPath1:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuPath2:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuPath3:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuPathMenuPathMain:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuProduct:
            case EnumLibrary.EnumNS.MenuENUM.CreateMenuProductChild:
            default:
                break;
            }

            MenuManager mm = new MenuManager(mpm, p, pc, parm.MenuEnum, parm.BreadCrumbManager, parm.LikeUnlikeCounter, UserId, parm.ReturnUrl, UserName);

            mm.BreadCrumbManager = parm.BreadCrumbManager;
            //mm.IndexMenuVariables.IsAdmin = UserBiz.IsAdmin(UserId);


            if (!UserId.IsNullOrWhiteSpace())
            {
                Person person = CashTrxBiz.PersonBiz.GetPersonForUserId(UserId);
                if (person.IsNull())
                {
                    //mm.UserMoneyAccount = new UserMoneyAccount();
                }
                else
                {
                    bool isBank = BankBiz.IsBanker_User(UserId);
                    //swithched off to get rid of error. MAY NEED IT BACK!
                    //mm.UserMoneyAccount = MoneyAccountForPerson(person.Id, isBank);
                }
            }


            return(mm as IMenuManager);
        }
Ejemplo n.º 3
0
        IEnumerable <ExistingProductData> InquiryCustomerSingleView(string IDNumber, string IDTypeCode, string IDIssueCountryCode)
        {
            CBSCustomerService.CBSCustomerService ws = new CBSCustomerService.CBSCustomerService();
            ws.Timeout = AppConstant.CBSTimeout;
            IEnumerable <ExistingProductData> result = new List <ExistingProductData>();

            try {
                InquiryCustomerSingleView req = new InquiryCustomerSingleView();
                req.Header = new InquiryCustomerSingleViewHeader
                {
                    ReferenceNo         = DateTime.Now.ToString("yyyyMMddhhmmss", new System.Globalization.CultureInfo("en-US")),
                    TransactionDateTime = DateTime.Now,
                    ServiceName         = AppConstant.CBSInquiryCustomerSingleView,
                    SystemCode          = AppConstant.CBSSystemCode,
                    ChannelID           = AppConstant.CBSChannelID
                };
                _log.Info("InquiryCustomerSingleView => ReferenceNo:" + req.Header.ReferenceNo + "  IDNumber:" + IDNumber + "  IDTypeCode : " + IDTypeCode + "    IDIssueCountryCode : " + IDIssueCountryCode);

                req.InquiryCustomerSingleViewRequest                    = new InquiryCustomerSingleViewInquiryCustomerSingleViewRequest();
                req.InquiryCustomerSingleViewRequest.IDNumber           = IDNumber;
                req.InquiryCustomerSingleViewRequest.IDTypeCode         = IDTypeCode;
                req.InquiryCustomerSingleViewRequest.IDIssueCountryCode = IDIssueCountryCode;
                _log.DebugFormat("XML Request " + Environment.NewLine + "{0}", req.SerializeObject());

                InquiryCustomerSingleViewResponse res = new InquiryCustomerSingleViewResponse();
                res = ws.InquiryCustomerSingleView(req);

                if (res != null)
                {
                    if (res.Header.ResponseStatusInfo.ResponseStatus.ResponseCode == "CBS-I-1000")
                    {
                        IEnumerable <ExistingProductData> awb = new List <ExistingProductData>();
                        IEnumerable <ExistingProductData> swb = new List <ExistingProductData>();
                        IEnumerable <ExistingProductData> iwb = new List <ExistingProductData>();

                        if (res.Header.ProductList != null)
                        {
                            var tmpAwb = (from c in res.Header.ProductList
                                          select new ExistingProductData
                            {
                                CitizenId = txtCitizenId.Text,
                                ProductGroup = (!string.IsNullOrEmpty(c.AccountTypeCode) ? c.AccountTypeCode : ""),
                                ProductName = (!string.IsNullOrEmpty(c.ProductCode) ? c.ProductCode : ""),
                                //Grade = ,
                                ContactNo = (!string.IsNullOrEmpty(c.AccountNumber) ? c.AccountNumber : ""),
                                //StartDate = c.EffectiveDate,
                                //EndDate = c.ValidTill,
                                //PaymentTerm = ,
                                Status = (string.IsNullOrEmpty(c.AccountStatus) == false ? AccountStatusBiz.GetAccountStatusByCode(c.AccountStatus).AccountStatusName : "")
                            });
                            awb = (tmpAwb != null ? tmpAwb : new List <ExistingProductData>());
                        }

                        if (res.Header.ServiceList != null)
                        {
                            var tmpSwb = (from c in res.Header.ServiceList
                                          select new ExistingProductData
                            {
                                CitizenId = txtCitizenId.Text,
                                ProductGroup = (!string.IsNullOrEmpty(c.AccountTypeCode) ? c.AccountTypeCode : ""),
                                ProductName = (!string.IsNullOrEmpty(c.ProductCode) ? c.ProductCode : ""),
                                //Grade = ,
                                ContactNo = (!string.IsNullOrEmpty(c.AccountNumber) ? c.AccountNumber : ""),
                                StartDate = SLMUtil.ConvertTimeZoneFromUtc(c.EffectiveDate),
                                EndDate = SLMUtil.ConvertTimeZoneFromUtc(c.ValidTill),
                                //PaymentTerm = ,
                                Status = (string.IsNullOrEmpty(c.AccountStatus) == false ? AccountStatusBiz.GetAccountStatusByCode(c.AccountStatus).AccountStatusName : "")
                            });
                            swb = (tmpSwb != null ? tmpSwb : new List <ExistingProductData>());
                        }

                        if (res.Header.InstructionList != null)
                        {
                            var tmpIwb = (from c in res.Header.InstructionList
                                          select new ExistingProductData
                            {
                                CitizenId = txtCitizenId.Text,
                                ProductGroup = (!string.IsNullOrEmpty(c.AccountTypeCode) ? c.AccountTypeCode : ""),
                                ProductName = (!string.IsNullOrEmpty(c.InstructionDescription) ? c.InstructionDescription : ""),
                                //Grade = ,
                                ContactNo = BankBiz.GetBankByNo(c.BankNumber.ToString()) + c.AccountNumber,
                                StartDate = SLMUtil.ConvertTimeZoneFromUtc(c.EffectiveDate),
                                //EndDate = c.ValidTill,
                                //PaymentTerm = ,
                                Status = (string.IsNullOrEmpty(c.SubscriptionStatus) == false ? AccountStatusBiz.GetAccountStatusByCode(c.SubscriptionStatus).AccountStatusName : "")
                            });
                            iwb = (tmpIwb != null ? tmpIwb : new List <ExistingProductData>());
                        }

                        result = awb.Union(swb).Union(iwb);
                    }
                    else if (res.Header.ResponseStatusInfo.ResponseStatus.ResponseCode == "CBS-M-2001")
                    {
                        _log.Info(res.Header.ResponseStatusInfo.ResponseStatus.ResponseMessage);
                        gvExistProduct.EmptyDataText = "<center><span style='color:Red;'>ไม่พบข้อมูล</span></center>";
                    }
                    else
                    {
                        _log.Error(res.Header.ResponseStatusInfo.ResponseStatus.ResponseMessage);
                        gvExistProduct.EmptyDataText = "<center><span style='color:Red;'>เกิดข้อผิดพลาดในการเชื่อมต่อ Webservice InquiryCustomerSingleView</span></center>";
                    }
                }
                _log.DebugFormat("XML Response " + Environment.NewLine + "{0}", res.SerializeObject());
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                gvExistProduct.EmptyDataText = "<center><span style='color:Red;'>ไม่สามารถเชื่อมต่อ Webservice InquiryCustomerSingleView</span></center>";
            }

            return(result);
        }