public override string[] SaveArgs()
 {
     return(new[] { SiteId.ToString() });
 }
Exemple #2
0
        private string BuildNavigationTree(List <Tab> tabs)
        {
            if (tabs == null || tabs.Count == 0)
            {
                return(string.Empty);
            }

            var builder = new StringBuilder();

            foreach (var parent in tabs)
            {
                if (!TabManager.IsValid(parent, PermissionList))
                {
                    continue;
                }

                var childBuilder = new StringBuilder();
                if (parent.Children != null && parent.Children.Length > 0)
                {
                    var tabCollection = new TabCollection(parent.Children);
                    if (tabCollection.Tabs != null && tabCollection.Tabs.Length > 0)
                    {
                        foreach (var childTab in tabCollection.Tabs)
                        {
                            if (!TabManager.IsValid(childTab, PermissionList))
                            {
                                continue;
                            }

                            var href = childTab.Href;
                            if (!PageUtils.IsAbsoluteUrl(href))
                            {
                                href = PageUtils.AddQueryString(href,
                                                                new NameValueCollection {
                                    { "siteId", SiteId.ToString() }
                                });
                            }

                            if (childTab.HasHref)
                            {
                                childBuilder.Append($@"
<li>
    <a href=""{PageUtils.GetLoadingUrl(href)}"" onclick=""closeMenu()"" target=""{(string.IsNullOrEmpty(childTab.Target) ? "right" : childTab.Target)}"">
        <i class=""{childTab.IconClass}""></i>
        {childTab.Text}
    </a>
</li>");
                            }
                            else
                            {
                                childBuilder.Append($@"
<li>
    <a href=""javascript:;"">
        <i class=""{childTab.IconClass}""></i>
        {childTab.Text}
    </a>
</li>");
                            }
                        }
                    }
                }

                if (childBuilder.Length > 0)
                {
                    builder.Append($@"
<li class=""has_sub"">
    <a href=""javascript:;"" class=""waves-effect waves-primary {(parent.Selected ? "subdrop" : "")}"" target=""{(string.IsNullOrEmpty(parent.Target) ? "right" : parent.Target)}"">
        <i class=""{parent.IconClass ?? "ion-star"}""></i>
        <span> {parent.Text} </span>
        <span class=""menu-arrow""></span>
    </a>
    <ul class=""list-unstyled"" style=""display: {(parent.Selected ? "block" : "none")};"">
        {childBuilder}
    </ul>
</li>
");
                }
                else
                {
                    var href = parent.Href;
                    if (!PageUtils.IsAbsoluteUrl(href))
                    {
                        href = PageUtils.AddQueryString(href,
                                                        new NameValueCollection {
                            { "siteId", SiteId.ToString() }
                        });
                    }

                    if (parent.HasHref)
                    {
                        builder.Append($@"
<li class=""has_sub"">
    <a href=""{PageUtils.GetLoadingUrl(href)}"" onclick=""closeMenu()"" class=""waves-effect waves-primary {(parent.Selected ? "subdrop" : "")}"" target=""{(string.IsNullOrEmpty(parent.Target) ? "right" : parent.Target)}"">
        <i class=""{parent.IconClass ?? "ion-star"}""></i>
        <span> {parent.Text} </span>
    </a>
</li>");
                    }
                    else
                    {
                        builder.Append($@"
<li class=""has_sub"">
    <a href=""javascript:;"" class=""waves-effect waves-primary {(parent.Selected ? "subdrop" : "")}"">
        <i class=""{parent.IconClass ?? "ion-star"}""></i>
        <span> {parent.Text} </span>
    </a>
</li>");
                    }
                }
            }

            return(builder.ToString());
        }
        public Dictionary <string, string> PropertyValues(Context context, IEnumerable <string> names)
        {
            var hash = new Dictionary <string, string>();

            names?.ForEach(name =>
            {
                switch (name)
                {
                case "SiteId":
                    hash.Add("SiteId", SiteId.ToString());
                    break;

                case "UpdatedTime":
                    hash.Add("UpdatedTime", UpdatedTime.Value.ToString());
                    break;

                case "WikiId":
                    hash.Add("WikiId", WikiId.ToString());
                    break;

                case "Ver":
                    hash.Add("Ver", Ver.ToString());
                    break;

                case "Title":
                    hash.Add("Title", Title.Value);
                    break;

                case "Body":
                    hash.Add("Body", Body);
                    break;

                case "TitleBody":
                    hash.Add("TitleBody", TitleBody.ToString());
                    break;

                case "Comments":
                    hash.Add("Comments", Comments.ToJson());
                    break;

                case "Creator":
                    hash.Add("Creator", Creator.Id.ToString());
                    break;

                case "Updator":
                    hash.Add("Updator", Updator.Id.ToString());
                    break;

                case "CreatedTime":
                    hash.Add("CreatedTime", CreatedTime.Value.ToString());
                    break;

                case "VerUp":
                    hash.Add("VerUp", VerUp.ToString());
                    break;

                case "Timestamp":
                    hash.Add("Timestamp", Timestamp);
                    break;
                }
            });
            return(hash);
        }
        public string GetXml()
        {
            // <?xml version="1.0" encoding="UTF-8" ?>
            // <redirecttransaction ua="Example 1.0">
            //     <merchant>
            //         <account>10011001</account>
            //         <site_id>1234</site_id>
            //         <site_secure_code>123456</site_secure_code>
            //         <notification_url>http://www.example.com/notify/</notification_url>
            //         <cancel_url>http://www.example.com/cancel/</cancel_url>
            //         <redirect_url>http://www.example.com/redirect/</redirect_url>
            //         <close_window>false</close_window>
            //     </merchant>
            //     <customer>
            //         <locale>nl_NL</locale>
            //         <ipaddress>85.92.148.67</ipaddress>
            //         <forwardedip></forwardedip>
            //         <firstname>Jan</firstname>
            //         <lastname>Modaal</lastname>
            //         <address1>Teststraat</address1>
            //         <address2></address2>
            //         <housenumber>12</housenumber>
            //         <zipcode>1234AB</zipcode>
            //         <city>Amsterdam</city>
            //         <state>NH</state>
            //         <country>NL</country>
            //         <phone>012-3456789</phone>
            //         <email>[email protected]</email>
            //     </customer>
            //     <transaction>
            //         <id>4084044</id>
            //         <currency>EUR</currency>
            //         <amount>1000</amount>
            //         <description>Test transaction</description>
            //         <var1></var1> <var2></var2>
            //         <var3></var3>
            //         <items></items>
            //         <manual>false</manual>
            //     </transaction>
            //     <signature>d54e019e2bc1a9de0cae1286d388f423</signature>
            // </redirecttransaction>

            var xmlDoc       = new XmlDocument();
            var gatewaysNode = (XmlElement)xmlDoc.AppendChild(xmlDoc.CreateElement("redirecttransaction"));

            gatewaysNode.SetAttribute("ua", "Example 1.0");

            var merchantNode = (XmlElement)gatewaysNode.AppendChild(xmlDoc.CreateElement("merchant"));

            merchantNode.AppendChild(xmlDoc.CreateElement("account")).InnerText          = AccountId.ToString();
            merchantNode.AppendChild(xmlDoc.CreateElement("site_id")).InnerText          = SiteId.ToString();
            merchantNode.AppendChild(xmlDoc.CreateElement("site_secure_code")).InnerText = SiteSecureId.ToString();
            merchantNode.AppendChild(xmlDoc.CreateElement("notification_url")).InnerText = NotificationUrl;
            merchantNode.AppendChild(xmlDoc.CreateElement("cancel_url")).InnerText       = CancelUrl;
            merchantNode.AppendChild(xmlDoc.CreateElement("redirect_url")).InnerText     = RedirectUrl;
            merchantNode.AppendChild(xmlDoc.CreateElement("close_window")).InnerText     = CloseWindow.ToString();

            var customerNode = (XmlElement)gatewaysNode.AppendChild(xmlDoc.CreateElement("customer"));

            customerNode.AppendChild(xmlDoc.CreateElement("locale")).InnerText    = Locale;
            customerNode.AppendChild(xmlDoc.CreateElement("ipaddress")).InnerText = IPAddress;
            //customerNode.AppendChild(xmlDoc.CreateElement("forwardedip")).InnerText = ForwardedIP;
            customerNode.AppendChild(xmlDoc.CreateElement("firstname")).InnerText = FirstName;
            customerNode.AppendChild(xmlDoc.CreateElement("lastname")).InnerText  = LastName;
            //customerNode.AppendChild(xmlDoc.CreateElement("address1")).InnerText = Address1;
            //customerNode.AppendChild(xmlDoc.CreateElement("address2")).InnerText = Address2;
            //customerNode.AppendChild(xmlDoc.CreateElement("housenumber")).InnerText = Housenumber;
            //customerNode.AppendChild(xmlDoc.CreateElement("zipcode")).InnerText = Zipcode;
            //customerNode.AppendChild(xmlDoc.CreateElement("city")).InnerText = City;
            //customerNode.AppendChild(xmlDoc.CreateElement("state")).InnerText = State;
            customerNode.AppendChild(xmlDoc.CreateElement("country")).InnerText = Country;
            //customerNode.AppendChild(xmlDoc.CreateElement("phone")).InnerText = Phone;
            customerNode.AppendChild(xmlDoc.CreateElement("email")).InnerText = Email;

            var transactionNode = (XmlElement)gatewaysNode.AppendChild(xmlDoc.CreateElement("transaction"));

            transactionNode.AppendChild(xmlDoc.CreateElement("id")).InnerText          = TransactionId;
            transactionNode.AppendChild(xmlDoc.CreateElement("currency")).InnerText    = Currency;
            transactionNode.AppendChild(xmlDoc.CreateElement("amount")).InnerText      = Amount.ToString();
            transactionNode.AppendChild(xmlDoc.CreateElement("description")).InnerText = Decription;
            transactionNode.AppendChild(xmlDoc.CreateElement("manual")).InnerText      = Manual.ToString();
            transactionNode.AppendChild(xmlDoc.CreateElement("gateway")).InnerText     = Gateway;

            var SignatureNode = (XmlElement)gatewaysNode.AppendChild(xmlDoc.CreateElement("signature"));

            SignatureNode.InnerText = Signature;

            return(xmlDoc.OuterXml);
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = "Справочники";

            if (!Page.IsPostBack)
            {
                var dictionaries = new DataManager().Dictionary.SelectAll(CurrentUser.Instance.AccessLevelID);

                Guid?accessProfileId = null;
                accessProfileId = CurrentUser.Instance.AccessProfileID;

                if (!accessProfileId.HasValue)
                {
                    accessProfileId = DataManager.Sites.SelectById(CurrentUser.Instance.SiteID).AccessProfileID;
                }

                if (accessProfileId.HasValue)
                {
                    var accessProfileModules = DataManager.AccessProfileModule.SelectByAccessProfileID((Guid)accessProfileId).Where(apm => apm.Read && apm.Write);
                    if (accessProfileModules.Any())
                    {
                        var availableModules = accessProfileModules.Select(apr => apr.ModuleID).ToList();
                        dictionaries =
                            dictionaries.Where(
                                d => (
                                    d.tbl_DictionaryGroup != null && d.tbl_DictionaryGroup.ModuleID.HasValue &&
                                    availableModules.Contains((Guid)d.tbl_DictionaryGroup.ModuleID)) ||
                                d.tbl_DictionaryGroup == null ||
                                !d.tbl_DictionaryGroup.ModuleID.HasValue);
                    }
                }
                else if (CurrentUser.Instance.AccessLevelID != (int)AccessLevel.SystemAdministrator && CurrentUser.Instance.AccessLevelID != (int)AccessLevel.Administrator)
                {
                    dictionaries = dictionaries.Where(d => (d.tbl_DictionaryGroup == null || !d.tbl_DictionaryGroup.ModuleID.HasValue));
                }


                lbcDictionaries.AvailableDictionaries = dictionaries.Select(
                    d =>
                    new DictionaryItem()
                {
                    Name                = d.Title,
                    Dataset             = d.DataSet,
                    GroupId             = d.DictionaryGroupID,
                    GroupTitle          = d.tbl_DictionaryGroup.Title,
                    EditFormUserControl = d.EditFormUserControl
                }).OrderBy(d => d.Name).ToList();

                var filters = new List <FilterColumn> {
                    new FilterColumn()
                    {
                        Name = "SiteID", DbType = DbType.Guid, Value = SiteId.ToString()
                    }
                };
                lbcDictionaries.Filters = filters;
                lbcDictionaries.UploadImagesAbsoluteFilePath = BusinessLogicLayer.Configuration.Settings.LabitecDictionaryUploadImagesAbsoluteFilePath.Replace("$siteId", SiteId.ToString());
                lbcDictionaries.ViewImagesVirtualFilePath    = BusinessLogicLayer.Configuration.Settings.LabitecDictionaryViewImagesVirtualFilePath.Replace("$siteId", SiteId.ToString());
            }
        }
Exemple #6
0
        /// <summary>
        /// This method provides functionality to pay a statement using
        /// electronic check as the method of payment.
        /// </summary>
        /// <param name="strCustomerName"></param>
        /// <param name="strBankRouteNumber"></param>
        /// <param name="strBankAccountNumber"></param>
        /// <param name="ebatAccountType"></param>
        /// <param name="dblAmount"></param>
        /// <returns></returns>
        public PaymentReceipt PayUsingElectronicCheck(
            string strCustomerName,
            [RequiredItem()][StringLength(1, 9)][NumericAttribute()] string strBankRouteNumber,
            [RequiredItem()][StringLength(1, 20)] string strBankAccountNumber,
            [RequiredItem()] eBankAccountType ebatAccountType,
            [RequiredItem()][DoubleRange(0.00, 9999999.99)] double dblAmount)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.PayCheck,
                this.m_can.AccountNumber16, dblAmount);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    // validate the parameters.
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(),
                                                                    strCustomerName, strBankRouteNumber, strBankAccountNumber, ebatAccountType, dblAmount);
                    validator.Validate();

                    // In this case, we are hard-coding the payment type
                    ePaymentType ept = ePaymentType.ElectronicCheck;
                    logEntry.PaymentType = ept;

                    // set the siteId information
                    logEntry.SiteId = SiteId;

                    //use stopped check dal to verfiy the account does not have a stop on it
                    DalStoppedCheck dalSC = new DalStoppedCheck();
                    if (dalSC.IsStoppedCheck(strBankRouteNumber, strBankAccountNumber))
                    {
                        //the account has a stop placed on it
                        throw new MopAuthorizationFailedException(string.Format(__stoppedCheckErrorMessage + "\nBank Routing Number: {0} \nBank Account Number: {1}", strBankRouteNumber, strBankAccountNumber));
                    }

                    checkNSFStatus(false);

                    // Create a DAL to transalate Mop codes
                    DalMethodOfPayment dal = new DalMethodOfPayment();
                    DalPaymentReceipt  dalPaymentReceipt = new DalPaymentReceipt();

                    string paymentReceiptType = dalPaymentReceipt.GetPaymentReceiptType(_userId);
                    paymentReceiptType = paymentReceiptType == string.Empty?CmConstant.kstrDefaultReceiptType:paymentReceiptType;

                    PaymentReceipt rcpt = new PaymentReceipt();

                    // need to get the customer's name.
                    if (strCustomerName != null)
                    {
                        strCustomerName = strCustomerName.Trim();
                    }
                    if (strCustomerName == null || strCustomerName.Length == 0)
                    {
                        DalAccount dalAccount = new DalAccount();
                        CustomerAccountSchema.CustomerName custName =
                            dalAccount.GetCustomerName(_siteId, _siteCode, m_can.AccountNumber9);
                        if (custName == null)
                        {
                            throw new InvalidAccountNumberException();
                        }
                        strCustomerName = (string)new CustomerName(custName.FirstName, custName.MiddleInitial, custName.LastName);
                        if (strCustomerName == null || strCustomerName.Length == 0)
                        {
                            strCustomerName = CmConstant.kstrDefaultAccountTitle;
                        }
                    }

                    // assure that the length of the customer name does NOT exceed 32 characters!
                    if (strCustomerName.Length >= 32)
                    {
                        strCustomerName = strCustomerName.Substring(0, 31);
                    }

                    // Build input elements
                    Request.INL00047 inl47 = new INL00047Helper(dblAmount, dblAmount,
                                                                (eBankAccountType.Checking == ebatAccountType)?
                                                                CmConstant.kstrAccountTypeChecking:
                                                                CmConstant.kstrAccountTypeSavings,
                                                                CmConstant.kstrNegative, strBankRouteNumber, strBankAccountNumber,
                                                                strCustomerName, dal.GetMopByUserPaymentType(
                                                                    UserName, (int)ept), CmConstant.kstrNegative, m_can.StatementCode,
                                                                paymentReceiptType, CmConstant.kstrDefaultWorkstation);

                    Request.MAC00027 mac27 =
                        new Mac00027Helper(SiteId.ToString(), m_can.AccountNumber9,
                                           CmConstant.kstrDefaultTaskCode, inl47);

                    // Use inherited functions to get a response
                    Response.MAC00027 mac27Response = (Response.MAC00027)
                                                      this.Invoke((Request.MAC00027)mac27);
                    Response.INL00047 inl47Response = mac27Response.Items[0] as Response.INL00047;

                    int intErrorCode = toInt32(inl47Response.IGIRTRNCODE);
                    if (intErrorCode > 0)
                    {
                        throw TranslateCmException(
                                  intErrorCode,
                                  string.Format("Authorization failed with error - ErrorCode: {0} ErrorText: {1}",
                                                inl47Response.IGIRTRNCODE,
                                                inl47Response.IGIMESGTEXT),
                                  null);
                    }

                    rcpt.AccountNumber16 = m_can.AccountNumber16;
                    rcpt.AmountPaid      = (inl47Response.AMNTTOAPLYUSR.Length > 0) ? Double.Parse(inl47Response.AMNTTOAPLYUSR): 0.00;
                    rcpt.PaymentType     = ePaymentType.ElectronicCheck;
                    rcpt.Status          = ePaymentStatus.Success;
                    rcpt.TransactionDate = new IcomsDate(inl47Response.ATHRZTNDATE).Date;

                    return(rcpt);
                }                 // try
                catch (BusinessLogicLayerException blle)
                {
                    //the dal threw an exception
                    logEntry.SetError(blle.Message);
                    throw;
                }
                catch (DataSourceException excDSE)
                {
                    //the dal threw an exception
                    logEntry.SetError(excDSE.Message);
                    throw new DataSourceUnavailableException(excDSE);
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }                 // catch( CmErrorException excCm )
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                } // catch( Exception exc )
            }     // using( Log log =  )
        }         // PayUsingElectronicCheck()
        /// <summary>
        /// Execute method to write transaction to the database.
        /// </summary>
        public void Execute()
        {
            string directory = AppDomain.CurrentDomain.BaseDirectory;

            directory = Path.Combine(directory, "Logs");

            // check that directory exists
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            // create full path to the fie
            string filePath = Path.Combine(directory, "pageviews.csv");

            // write to the file
            StreamWriter w = new StreamWriter(filePath, true);

            w.Write("{0},{1},{2},{3},{4},{5}\r\n", DateViewed.ToString(), PageId.ToString(), SiteId.ToString(), PersonId.ToString(), IPAddress, UserAgent);
            w.Close();
        }
Exemple #8
0
 public override string ToString()
 {
     return(SiteId.ToString().PadRight(6) + CampgroundId.ToString().PadRight(30) + SiteNumber.ToString().PadRight(30) + MaxOccupancy.ToString().PadRight(10) + Accessible.ToString().PadRight(10) + MaxRVLength.ToString().PadRight(30) + Utilities.ToString().PadRight(10));
 }
Exemple #9
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (string.IsNullOrEmpty(AuthRequest.GetQueryString("startDate")))
            {
                _begin = DateTime.Now.AddMonths(-1);
                _end   = DateTime.Now;
            }
            else
            {
                _begin = TranslateUtils.ToDateTime(AuthRequest.GetQueryString("startDate"));
                _end   = TranslateUtils.ToDateTime(AuthRequest.GetQueryString("endDate"));
            }
            var siteIdList = SiteManager.GetSiteIdListOrderByLevel();

            if (SiteId == 0 && siteIdList.Count > 0)
            {
                PageUtils.Redirect(GetRedirectUrl(siteIdList[0], DateUtils.GetDateAndTimeString(_begin), DateUtils.GetDateAndTimeString(_end)));
                return;
            }

            if (IsPostBack)
            {
                return;
            }

            VerifySystemPermissions(ConfigManager.SettingsPermissions.Chart);

            foreach (var siteId in siteIdList)
            {
                var siteInfo = SiteManager.GetSiteInfo(siteId);
                DdlSiteId.Items.Add(new ListItem(siteInfo.SiteName, siteId.ToString()));
            }
            ControlUtils.SelectSingleItem(DdlSiteId, SiteId.ToString());

            TbStartDate.Text = DateUtils.GetDateAndTimeString(_begin);
            TbEndDate.Text   = DateUtils.GetDateAndTimeString(_end);

            if (SiteInfo == null)
            {
                PhAnalysis.Visible = false;
                return;
            }

            var ds = DataProvider.ContentDao.GetDataSetOfAdminExcludeRecycle(SiteInfo.TableName, SiteId, _begin, _end);

            if (ds == null || ds.Tables.Count <= 0)
            {
                return;
            }

            var dt = ds.Tables[0];

            if (dt.Rows.Count <= 0)
            {
                return;
            }

            foreach (DataRow dr in dt.Rows)
            {
                SetXHashtableUser(dr["userName"].ToString(), dr["userName"].ToString());
                SetYHashtableUser(dr["userName"].ToString(), TranslateUtils.ToInt(dr["addCount"].ToString()), YTypeNew);
                SetYHashtableUser(dr["userName"].ToString(), TranslateUtils.ToInt(dr["updateCount"].ToString()), YTypeUpdate);
            }

            foreach (var key in _userNameList)
            {
                var yValueNew    = GetYHashtableUser(key, YTypeNew);
                var yValueUpdate = GetYHashtableUser(key, YTypeUpdate);
                StrArray += $@"
xArrayNew.push('{GetXHashtableUser(key)}');
yArrayNew.push('{yValueNew}');
yArrayUpdate.push('{yValueUpdate}');";
            }

            SpContents.ControlToPaginate = RptContents;
            RptContents.ItemDataBound   += RptContents_ItemDataBound;
            SpContents.ItemsPerPage      = Constants.PageSize;
            SpContents.SortField         = "UserName";
            SpContents.SortMode          = SortMode.DESC;

            SpContents.SelectCommand = DataProvider.ContentDao.GetSqlStringOfAdminExcludeRecycle(SiteInfo.TableName, SiteId, _begin, _end);

            SpContents.DataBind();
        }
Exemple #10
0
        /// <summary>
        /// Sets up the CustomerAccount to pay for services on a recurring basis
        /// using a credit card.
        /// </summary>
        /// <param name="strCustomerName"></param>
        /// <param name="strBankRouteNumber"></param>
        /// <param name="strBankAccountNumber"></param>
        /// <param name="ebatAccountType"></param>
        public void ActivateRecurringUsingDirectDebit(
            string strCustomerName,
            [RequiredItem()][StringLength(1, 9)][NumericAttribute()] string strBankRouteNumber,
            [RequiredItem()][StringLength(1, 20)] string strBankAccountNumber,
            [RequiredItem()] eBankAccountType ebatAccountType)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.RecurringCheck,
                this.m_can.AccountNumber16);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(),
                                                                    strCustomerName, strBankRouteNumber, strBankAccountNumber, ebatAccountType);
                    validator.Validate();

                    // In this case, we are hard-coding the payment type
                    ePaymentType ept = ePaymentType.RecurringDirectDebit;
                    logEntry.PaymentType = ept;

                    // set the siteId information
                    logEntry.SiteId = SiteId;

                    int intStatementCode = 0;
                    try{ intStatementCode = int.Parse(m_can.StatementCode); }
                    catch { /*don't care*/ }

                    //use stopped check dal to verfiy the account does not have a stop on it
                    DalStoppedCheck dalSC = new DalStoppedCheck();
                    if (dalSC.IsStoppedCheck(strBankRouteNumber, strBankAccountNumber))
                    {
                        //the account has a stop placed on it
                        throw new MopAuthorizationFailedException(string.Format(__stoppedCheckErrorMessage + "\nBank Routing Number: {0} \nBank Account Number: {1}", strBankRouteNumber, strBankAccountNumber));
                    }

                    checkNSFStatus(false);

                    // Create a DAL to transalate Mop codes
                    DalMethodOfPayment dal = new DalMethodOfPayment();

                    // need to get the customer's name.
                    if (strCustomerName != null)
                    {
                        strCustomerName = strCustomerName.Trim();
                    }
                    if (strCustomerName == null || strCustomerName.Length == 0)
                    {
                        DalAccount dalAccount = new DalAccount();
                        CustomerAccountSchema.CustomerName custName =
                            dalAccount.GetCustomerName(_siteId, _siteCode, m_can.AccountNumber9);
                        if (custName == null)
                        {
                            throw new InvalidAccountNumberException();
                        }
                        strCustomerName = (string)new CustomerName(custName.FirstName, custName.MiddleInitial, custName.LastName);
                        if (strCustomerName == null || strCustomerName.Length == 0)
                        {
                            strCustomerName = CmConstant.kstrDefaultAccountTitle;
                        }
                    }

                    // assure that the length of the customer name does NOT exceed 32 characters!
                    if (strCustomerName.Length >= 32)
                    {
                        strCustomerName = strCustomerName.Substring(0, 31);
                    }

                    // Build input elements
                    Request.INL00074 inl74 =
                        new INL00074Helper(dal.GetMopByUserPaymentType(UserName, (int)ept),
                                           strBankAccountNumber, strBankRouteNumber, strCustomerName,
                                           (char)TypeDescriptor.GetConverter(typeof(eBankAccountType)).ConvertTo(ebatAccountType, typeof(char)),
                                           intStatementCode, false);
                    Request.MAC00027 mac27 = new Mac00027Helper(SiteId.ToString(),
                                                                m_can.AccountNumber9, CmConstant.kstrDefaultTaskCode, inl74);

                    this.Invoke((Request.MAC00027)mac27);
                }
                catch (BusinessLogicLayerException blle)
                {
                    //the dal threw an exception
                    logEntry.SetError(blle.Message);
                    throw;
                }
                catch (DataSourceException excDSE)
                {
                    //the dal threw an exception
                    logEntry.SetError(excDSE.Message);
                    throw new DataSourceUnavailableException(excDSE);
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                }
            }
        }
Exemple #11
0
        /// <summary>
        /// Turn off EasyPay (Recurring Payments for the specified account.
        /// </summary>
        public void DeactivateRecurring()
        {
            // setup logging
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.DeactivateRecurring,
                this.m_can.AccountNumber16);

            using (Log log = CreateLog(logEntry))
            {
                // declare needed variables
                int intStatementCode = 0, intMopAccountSequence = 0, intMopCode = 0;
                // no need to wrap in try/catch (its already been validated).
                int intAccountStatementCode = int.Parse(m_can.StatementCode);
                // set the siteId information
                logEntry.SiteId = SiteId;

                try
                {
                    // execute ACSUM to get needed information
                    Response.ACSUM acsumOutput = (Response.ACSUM)Invoke((Request.ACSUM)
                                                                        new AcsumHelper(SiteId.ToString(), m_can.AccountNumber9));

                    // format the output
                    if (acsumOutput.Items != null)
                    {
                        // we need to look for the correct statement.
                        foreach (object item in acsumOutput.Items)
                        {
                            if (item is Response.SQLSTMNT)
                            {
                                // cast to correct type.
                                Response.SQLSTMNT icomsStatement = (Response.SQLSTMNT)item;

                                // now convert statementCode to an integer.
                                int intLocalStatementCode = 0;
                                try{ intLocalStatementCode = int.Parse(icomsStatement.STMNTCD); }
                                catch { /*don't care*/ }

                                // if we did not find the correct statement code then break now.
                                if (intLocalStatementCode == intAccountStatementCode)
                                {
                                    // set this.
                                    intStatementCode = intLocalStatementCode;
                                    try{ intMopAccountSequence = int.Parse(icomsStatement.SQLSTMNTBAS[0].MOPACNTSQNC); }
                                    catch { /*don't care*/ }

                                    try{ intMopCode = int.Parse(icomsStatement.SQLSTMNTBAS[0].MOPCD); }
                                    catch { /*don't care*/ }
                                    break;
                                }
                            }
                        }
                    }

                    // now let's validate to see if we found the statement.
                    if (intStatementCode == 0)
                    {
                        throw new InvalidStatementCodeException();
                    }

                    // if we have a statementCode but no MopCode, then recurring
                    // payments are not setup and there is no point in going further
                    if (intMopCode != 0)
                    {
                        // Build input elements
                        Request.INL00076 inl76 = new INL00076Helper(intMopCode,
                                                                    intMopAccountSequence, intStatementCode);

                        // build mac27 call.
                        Request.MAC00027 mac27 = new Mac00027Helper(SiteId.ToString(),
                                                                    m_can.AccountNumber9, CmConstant.kstrDefaultTaskCode, inl76);

                        // now invoke.
                        this.Invoke((Request.MAC00027)mac27);
                    }
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                }
            }
        }
Exemple #12
0
        /// <summary>
        /// Sets up the CustomerAccount to pay for services on a recurring basis
        /// using a credit card.
        /// </summary>
        /// <param name="strCreditCardNumber"></param>
        /// <param name="strNameOnCard"></param>
        /// <param name="strExpirationDate"></param>
        public void ActivateRecurringUsingCreditCard(
            [RequiredItem()][CreditCardNumber()] string strCreditCardNumber,
            [RequiredItem()] string strNameOnCard,
            [RequiredItem()][ValidCCDate()] string strExpirationDate)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.RecurringCredit,
                this.m_can.AccountNumber16);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(),
                                                                    strCreditCardNumber, strNameOnCard, strExpirationDate);
                    validator.Validate();

                    // convert the accountNumber.
                    CreditCardNumber creditCardNumber = (CreditCardNumber)TypeDescriptor.GetConverter(
                        typeof(CreditCardNumber)).ConvertFrom(strCreditCardNumber);

                    // Credit card validation
                    logEntry.PaymentType = creditCardNumber.PaymentType;
                    DateTime dttmExpirationDate = ValidCCDateAttribute.ToDate(strExpirationDate);
                    // set the siteId information
                    logEntry.SiteId = SiteId;

                    // Create a DAL to transalate Mop codes
                    DalMethodOfPayment dal = new DalMethodOfPayment();

                    int intStatementCode = 0;
                    try{ intStatementCode = int.Parse(m_can.StatementCode); }catch { /*don't care*/ }

                    // check nsf status
                    checkNSFStatus(true);

                    // assure that the length of the customer name does NOT exceed 32 characters!
                    if (strNameOnCard.Length >= 32)
                    {
                        strNameOnCard = strNameOnCard.Substring(0, 31);
                    }

                    // Build input elements
                    Request.INL00073 inl73 = new INL00073Helper(dal.GetMopByUserPaymentType(
                                                                    UserName, (int)creditCardNumber.PaymentType), creditCardNumber.AccountNumber,
                                                                strNameOnCard, dttmExpirationDate, intStatementCode, false);
                    Request.MAC00027 mac27 = new Mac00027Helper(SiteId.ToString(),
                                                                m_can.AccountNumber9, CmConstant.kstrDefaultTaskCode, inl73);

                    // invoke and get the response object.
                    this.Invoke((Request.MAC00027)mac27);
                }
                catch (BusinessLogicLayerException blle)
                {
                    //the dal threw an exception
                    logEntry.SetError(blle.Message);
                    throw;
                }
                catch (DataSourceException excDSE)
                {
                    //the dal threw an exception
                    logEntry.SetError(excDSE.Message);
                    throw new DataSourceUnavailableException(excDSE);
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                }
            }
        }
Exemple #13
0
        }         // PayUsingCreditCard()

        /// <summary>
        /// This method provides functionality to pay a statement using
        /// a pinless debit card as the method of payment.
        /// </summary>
        /// <param name="debitCardNumber">
        /// The customer debit card number used to pay the bill.
        /// </param>
        /// <param name="nameOnCard">
        /// The name on the customer debit card.
        /// </param>
        /// <param name="amount">
        /// The amount to be paid to the customer service account.
        /// </param>
        /// <returns>
        /// A payment receipt instance is returned with the results from
        /// the requested payment.
        /// </returns>
        public PaymentReceipt PayUsingPinlessDebitCard(
            [RequiredItem()][RegEx(@"^\d{12,19}$", RegexOptions.None)] string debitCardNumber,
            [RequiredItem()][StringLength(1, 32)] string nameOnCard,
            [RequiredItem()][DoubleRange(0.00, 9999999.99)] double amount)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.PayPinlessDebit,
                this.m_can.AccountNumber16, amount);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    MethodValidator validator = new MethodValidator(
                        MethodBase.GetCurrentMethod(),
                        debitCardNumber, nameOnCard, amount);
                    validator.Validate();

                    // See if debit card number exists in BIN file.
                    // If not, it's invalid...need to throw an
                    // exception.
                    if (!_IsDebitCardNumberValid(debitCardNumber))
                    {
                        throw new InvalidDebitCardNumberException(__debitCardNotFoundInBinFileMessage);
                    }

                    // Debit card validation
                    logEntry.PaymentType = ePaymentType.PinlessDebit;

                    // set the siteId information
                    logEntry.SiteId = SiteId;

                    // Set to false since it's a pinless debit transaction
                    checkNSFStatus(false);

                    // Create a DAL to transalate Mop codes
                    DalMethodOfPayment dal = new DalMethodOfPayment();
                    DalPaymentReceipt  dalPaymentReceipt = new DalPaymentReceipt();

                    string paymentReceiptType = dalPaymentReceipt.GetPaymentReceiptType(_userId);
                    paymentReceiptType = paymentReceiptType == string.Empty?CmConstant.kstrDefaultReceiptType:paymentReceiptType;

                    // assure that the length of the customer name does NOT exceed 32 characters!
                    if (nameOnCard.Length >= 32)
                    {
                        nameOnCard = nameOnCard.Substring(0, 31);
                    }

                    // Build input elements
                    Request.INL00072 inl72 =
                        new INL00072Helper(
                            amount,
                            amount,
                            CmConstant.kstrNegative,
                            debitCardNumber,
                            nameOnCard,
                            __icomsSpecialDate,
                            dal.GetMopByUserPaymentType(UserName, (int)ePaymentType.PinlessDebit),
                            CmConstant.kstrNegative,
                            m_can.StatementCode,
                            paymentReceiptType,
                            CmConstant.kstrDefaultWorkstation);

                    Request.MAC00027 mac27 = new Mac00027Helper(
                        SiteId.ToString(),
                        m_can.AccountNumber9,
                        CmConstant.kstrDefaultTaskCode,
                        inl72);

                    // Use inherited functions to get a response
                    Response.MAC00027 mac27Response = (Response.MAC00027)
                                                      this.Invoke((Request.MAC00027)mac27);
                    Response.INL00072 inl72Response = mac27Response.Items[0] as Response.INL00072;

                    int intErrorCode = toInt32(inl72Response.IGIRTRNCODE);
                    if (intErrorCode > 0)
                    {
                        throw TranslateCmException(
                                  intErrorCode,
                                  string.Format("Authorization failed with error - ErrorCode: {0} ErrorText: {1}",
                                                inl72Response.IGIRTRNCODE,
                                                inl72Response.IGIMESGTEXT),
                                  null);
                    }

                    PaymentReceipt rcpt = new PaymentReceipt();
                    rcpt.AccountNumber16 = m_can.AccountNumber16;
                    rcpt.AmountPaid      = (inl72Response.AMNTTOAPLY.Length > 0) ? Double.Parse(inl72Response.AMNTTOAPLY): 0.00;
                    rcpt.PaymentType     = (ePaymentType) new MopPaymentType(this.UserName, inl72Response.MTHDOFPAYCODE);
                    rcpt.Status          = ePaymentStatus.Success;
                    rcpt.TransactionDate = new IcomsDate(inl72Response.ATHRZTNDATE).Date;

                    return(rcpt);
                }
                catch (BusinessLogicLayerException blle)
                {
                    //the dal threw an exception
                    logEntry.SetError(blle.Message);
                    throw;
                }
                catch (DataSourceException excDSE)
                {
                    //the dal threw an exception
                    logEntry.SetError(excDSE.Message);
                    throw new DataSourceUnavailableException(excDSE);
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                }
            }
        }
Exemple #14
0
        }         // PayUsingElectronicCheck()

        /// <summary>
        /// This method provides functionality to pay a statement using
        /// a credit card as the method of payment.
        /// </summary>
        /// <param name="strCreditCardNumber">
        /// Thie customer credit card number used to pay the bill.
        /// </param>
        /// <param name="strNameOnCard">
        /// The name on the customer credit card.
        /// </param>
        /// <param name="strExpirationDate">
        /// The expiration date of the customer credit card.
        /// </param>
        /// <param name="dblAmount">
        /// The amount to be paid to the customer service account.
        /// </param>
        /// <returns>
        /// A payment receipt instance is returned with the results from
        /// the requested payment.
        /// </returns>
        public PaymentReceipt PayUsingCreditCard(
            [RequiredItem()][CreditCardNumberAttribute()] string strCreditCardNumber,
            [RequiredItem()] string strNameOnCard,
            [RequiredItem()][ValidCCDate()] string strExpirationDate,
            [RequiredItem()][DoubleRange(0.00, 9999999.99)] double dblAmount)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.PayCredit,
                this.m_can.AccountNumber16, dblAmount);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(),
                                                                    strCreditCardNumber, strNameOnCard, strExpirationDate, dblAmount);
                    validator.Validate();

                    // convert the accountNumber.
                    CreditCardNumber creditCardNumber = (CreditCardNumber)TypeDescriptor.GetConverter(
                        typeof(CreditCardNumber)).ConvertFrom(strCreditCardNumber);

                    // Credit card validation
                    logEntry.PaymentType = creditCardNumber.PaymentType;
                    DateTime dttmExpirationDate = ValidCCDateAttribute.ToDate(strExpirationDate);

                    // set the siteId information
                    logEntry.SiteId = SiteId;

                    checkNSFStatus(true);

                    // Create a DAL to transalate Mop codes
                    DalMethodOfPayment dal = new DalMethodOfPayment();
                    DalPaymentReceipt  dalPaymentReceipt = new DalPaymentReceipt();

                    string paymentReceiptType = dalPaymentReceipt.GetPaymentReceiptType(_userId);
                    paymentReceiptType = paymentReceiptType == string.Empty?CmConstant.kstrDefaultReceiptType:paymentReceiptType;

                    PaymentReceipt rcpt = new PaymentReceipt();

                    // assure that the length of the customer name does NOT exceed 32 characters!
                    if (strNameOnCard.Length >= 32)
                    {
                        strNameOnCard = strNameOnCard.Substring(0, 31);
                    }

                    // Build input elements
                    Request.INL00072 inl72 =
                        new INL00072Helper(
                            dblAmount,
                            dblAmount,
                            CmConstant.kstrNegative,
                            creditCardNumber.AccountNumber,
                            strNameOnCard,
                            dttmExpirationDate,
                            dal.GetMopByUserPaymentType(UserName, (int)creditCardNumber.PaymentType),
                            CmConstant.kstrNegative,
                            m_can.StatementCode,
                            paymentReceiptType,
                            CmConstant.kstrDefaultWorkstation);

                    Request.MAC00027 mac27 =
                        new Mac00027Helper(
                            SiteId.ToString(),
                            m_can.AccountNumber9,
                            CmConstant.kstrDefaultTaskCode,
                            inl72);

                    // Use inherited functions to get a response
                    Response.MAC00027 mac27Response = (Response.MAC00027)
                                                      this.Invoke((Request.MAC00027)mac27);
                    Response.INL00072 inl72Response = mac27Response.Items[0] as Response.INL00072;

                    int intErrorCode = toInt32(inl72Response.IGIRTRNCODE);
                    if (intErrorCode > 0)
                    {
                        throw TranslateCmException(
                                  intErrorCode,
                                  string.Format("Authorization failed with error - ErrorCode: {0} ErrorText: {1}",
                                                inl72Response.IGIRTRNCODE,
                                                inl72Response.IGIMESGTEXT),
                                  null);
                    }

                    rcpt.AccountNumber16 = m_can.AccountNumber16;
                    rcpt.AmountPaid      = (inl72Response.AMNTTOAPLY.Length > 0) ? Double.Parse(inl72Response.AMNTTOAPLY): 0.00;
                    rcpt.PaymentType     = (ePaymentType) new MopPaymentType(this.UserName, inl72Response.MTHDOFPAYCODE);
                    rcpt.Status          = ePaymentStatus.Success;
                    rcpt.TransactionDate = new IcomsDate(inl72Response.ATHRZTNDATE).Date;

                    return(rcpt);
                }                 // try
                catch (BusinessLogicLayerException blle)
                {
                    //the dal threw an exception
                    logEntry.SetError(blle.Message);
                    throw;
                }
                catch (DataSourceException excDSE)
                {
                    //the dal threw an exception
                    logEntry.SetError(excDSE.Message);
                    throw new DataSourceUnavailableException(excDSE);
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }                 // catch( CmErrorException excCm )
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                } // catch( Exception exc )
            }     // using( Log log = CreateLog( logEntry ) )
        }         // PayUsingCreditCard()
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = Constants.PageSize;

            SpContents.SelectCommand = !AuthRequest.IsQueryExists("LogType")
                ? DataProvider.SiteLogDao.GetSelectCommend()
                : DataProvider.SiteLogDao.GetSelectCommend(SiteId, AuthRequest.GetQueryString("LogType"),
                                                           AuthRequest.GetQueryString("UserName"), AuthRequest.GetQueryString("Keyword"), AuthRequest.GetQueryString("DateFrom"),
                                                           AuthRequest.GetQueryString("DateTo"));

            SpContents.SortField       = nameof(SiteLogInfo.Id);
            SpContents.SortMode        = SortMode.DESC;
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (AuthRequest.IsQueryExists("Delete"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("IDCollection"));
                DataProvider.SiteLogDao.Delete(arraylist);
                SuccessDeleteMessage();
            }
            else if (AuthRequest.IsQueryExists("DeleteAll"))
            {
                DataProvider.SiteLogDao.DeleteAll();
                SuccessDeleteMessage();
            }
            else if (AuthRequest.IsQueryExists("Setting"))
            {
                ConfigManager.SystemConfigInfo.IsLogSite = !ConfigManager.SystemConfigInfo.IsLogSite;
                DataProvider.ConfigDao.Update(ConfigManager.Instance);
                SuccessMessage($"成功{(ConfigManager.SystemConfigInfo.IsLogSite ? "启用" : "禁用")}日志记录");
            }

            if (IsPostBack)
            {
                return;
            }

            VerifySystemPermissions(ConfigManager.AppPermissions.SettingsLogSite);

            if (SiteId == 0)
            {
                LtlSite.Text = @"<th align=""text-center text-nowrap"">站点名称</th>";
            }

            DdlSiteId.Items.Add(new ListItem("<<全部站点>>", "0"));

            var siteIdList = SiteManager.GetSiteIdListOrderByLevel();

            foreach (var psId in siteIdList)
            {
                DdlSiteId.Items.Add(new ListItem(SiteManager.GetSiteInfo(psId).SiteName, psId.ToString()));
            }

            DdlLogType.Items.Add(new ListItem("全部记录", "All"));
            DdlLogType.Items.Add(new ListItem("栏目相关记录", "Channel"));
            DdlLogType.Items.Add(new ListItem("内容相关记录", "Content"));

            if (AuthRequest.IsQueryExists("LogType"))
            {
                ControlUtils.SelectSingleItem(DdlSiteId, SiteId.ToString());
                ControlUtils.SelectSingleItem(DdlLogType, AuthRequest.GetQueryString("LogType"));
                TbUserName.Text = AuthRequest.GetQueryString("UserName");
                TbKeyword.Text  = AuthRequest.GetQueryString("Keyword");
                TbDateFrom.Text = AuthRequest.GetQueryString("DateFrom");
                TbDateTo.Text   = AuthRequest.GetQueryString("DateTo");
            }

            BtnDelete.Attributes.Add("onclick",
                                     PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                         PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
            {
                { "Delete", "True" }
            }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?"));

            BtnDeleteAll.Attributes.Add("onclick",
                                        AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部",
                                                                   PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
            {
                { "DeleteAll", "True" }
            })));

            if (ConfigManager.SystemConfigInfo.IsLogSite)
            {
                BtnSetting.Text = "禁用站点日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("禁用站点日志", "此操作将禁用站点日志记录功能,确定吗?", "禁 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }
            else
            {
                LtlState.Text   = @"<div class=""alert alert-danger m-t-10"">站点日志当前处于禁用状态,系统将不会记录站点操作日志!</div>";
                BtnSetting.Text = "启用站点日志";
                BtnSetting.Attributes.Add("onclick",
                                          AlertUtils.ConfirmRedirect("启用站点日志", "此操作将启用站点日志记录功能,确定吗?", "启 用",
                                                                     PageUtils.GetSettingsUrl(nameof(PageLogSite), new NameValueCollection
                {
                    { "Setting", "True" }
                })));
            }

            SpContents.DataBind();
        }
Exemple #16
0
        protected void BuildNavigationTree(StringBuilder builder, List <Tab> tabs, int parentsCount, bool isDisplay)
        {
            if (tabs == null)
            {
                return;
            }

            foreach (var parent in tabs)
            {
                if (!TabManager.IsValid(parent, PermissionList))
                {
                    continue;
                }

                //var linkUrl = PageUtils.AddQueryString(parent.Href, new NameValueCollection { { "siteId", SiteId.ToString() } });
                //if (!string.IsNullOrEmpty(linkUrl) && !StringUtils.EqualsIgnoreCase(linkUrl, PageUtils.UnclickedUrl))
                //{
                //    linkUrl = PageUtils.GetLoadingUrl(linkUrl);
                //}
                var childBuilder = new StringBuilder();
                if (parent.Children != null && parent.Children.Length > 0)
                {
                    var tabCollection = new TabCollection(parent.Children);
                    if (tabCollection.Tabs != null && tabCollection.Tabs.Length > 0)
                    {
                        foreach (var childTab in tabCollection.Tabs)
                        {
                            if (!TabManager.IsValid(childTab, PermissionList))
                            {
                                continue;
                            }

                            //var childUrl = PageUtils.AddQueryString(childTab.Href, new NameValueCollection { { "siteId", SiteId.ToString() } });
                            //if (!string.IsNullOrEmpty(childUrl) && !StringUtils.EqualsIgnoreCase(childUrl, PageUtils.UnclickedUrl))
                            //{
                            //    childUrl = PageUtils.GetLoadingUrl(childUrl);
                            //}
                            var href = childTab.Href;
                            if (!PageUtils.IsAbsoluteUrl(href))
                            {
                                href = PageUtils.AddQueryString(href,
                                                                new NameValueCollection {
                                    { "siteId", SiteId.ToString() }
                                });
                            }
                            href = childTab.HasHref ? PageUtils.GetLoadingUrl(href) : "javascript:;";

                            childBuilder.Append($@"
<li>
    <a href=""{href}"" target=""{(string.IsNullOrEmpty(childTab.Target) ? "right" : childTab.Target)}"">
        <i class=""{childTab.IconClass}""></i>
        {childTab.Text}
    </a>
</li>");
                        }
                    }
                }

                if (childBuilder.Length > 0)
                {
                    builder.Append($@"
<li class=""has_sub"">
    <a href=""javascript:;"" class=""waves-effect waves-primary {(parent.Selected ? "subdrop" : "")}"" target=""{(string.IsNullOrEmpty(parent.Target) ? "right" : parent.Target)}"">
        <i class=""{parent.IconClass ?? "ion-star"}""></i>
        <span> {parent.Text} </span>
        <span class=""menu-arrow""></span>
    </a>
    <ul class=""list-unstyled"" style=""display: {(parent.Selected ? "block" : "none")};"">
        {childBuilder}
    </ul>
</li>
");
                }
                else
                {
                    var href = parent.Href;
                    if (!PageUtils.IsAbsoluteUrl(href))
                    {
                        href = PageUtils.AddQueryString(href,
                                                        new NameValueCollection {
                            { "siteId", SiteId.ToString() }
                        });
                    }
                    href = parent.HasHref ? PageUtils.GetLoadingUrl(href) : "javascript:;";
                    builder.Append($@"
<li class=""has_sub"">
    <a href=""{href}"" class=""waves-effect waves-primary {(parent.Selected ? "subdrop" : "")}"" target=""{(string.IsNullOrEmpty(parent.Target) ? "right" : parent.Target)}"">
        <i class=""{parent.IconClass ?? "ion-star"}""></i>
        <span> {parent.Text} </span>
    </a>
</li>");
                }
            }
        }
 public override string ToString()
 {
     return(ReservationId.ToString().PadRight(6) + SiteId.ToString().PadRight(6) + Name.PadRight(30) + FromDate.PadRight(30) + ToDate.PadRight(30) + CreateDate.PadRight(30));
 }
Exemple #18
0
        protected string _MCategoryTree(string moduleID)
        {
            //读取缓存
            var cacheKey = string.Format("{0}_site{1}_mtree_{2}", CacheSign.Category.ToString(), SiteId.ToString(),
                                         moduleID);
            BuiltCacheResultHandler <string> bh = () =>
            {
                //无缓存,则继续执行
                var sb        = new StringBuilder(400);
                var _moduleID = int.Parse(moduleID);
                //从模块加载
                if (CmsLogic.Module.GetModule(_moduleID) == null)
                {
                    return(TplMessage("不存在模块!ID:" + moduleID));
                }
                sb.Append("<div class=\"category_tree mtree\">");
                var dto = new CategoryDto {
                    ID = 0
                };
                CategoryTree_Iterator(dto, sb, a => { return(a.ModuleId == _moduleID); }, true);
                sb.Append("</div>");
                return(sb.ToString());
            };

            return(Cms.Cache.GetCachedResult(cacheKey, bh, DateTime.Now.AddHours(Settings.OptiDefaultCacheHours)));
        }