コード例 #1
0
        public ErrorViewModel(int errorCode, object parameters = null)
        {
            ErrorCode = errorCode;
            CustomErrorMessage customErrorMessage = CustomErrorMessages.GetPageError(errorCode) ?? CustomErrorMessages.DefaultPageError;

            Title        = customErrorMessage.Title;
            Subtitle     = customErrorMessage.Subtitle;
            Description  = customErrorMessage.Description;
            CallToAction = customErrorMessage.CallToAction;
            Uri uri = HttpContext.Current?.GetUri();

            ActionUrl  = customErrorMessage.ActionUrl == "#" && uri != null ? uri.PathAndQuery : customErrorMessage.ActionUrl;
            ActionText = customErrorMessage.ActionText;

            //Assign any values to variables
            if (parameters != null)
            {
                foreach (PropertyInfo prop in parameters.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
                {
                    var value = prop.GetValue(parameters, null) as string;
                    if (string.IsNullOrWhiteSpace(prop.Name) || string.IsNullOrWhiteSpace(value))
                    {
                        continue;
                    }

                    Title        = Title.ReplaceI("{" + prop.Name + "}", value);
                    Subtitle     = Subtitle.ReplaceI("{" + prop.Name + "}", value);
                    Description  = Description.ReplaceI("{" + prop.Name + "}", value);
                    CallToAction = CallToAction.ReplaceI("{" + prop.Name + "}", value);
                    ActionUrl    = ActionUrl.ReplaceI("{" + prop.Name + "}", value);
                    ActionText   = ActionText.ReplaceI("{" + prop.Name + "}", value);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 生成HTTP加密服务的 post请求 ACTION URL
        /// </summary>
        /// <param name="objActionUrl"></param>
        /// <returns></returns>

        public static string makeActionUrl(ActionUrl objActionUrl)
        {
            string strActionUrl = string.Empty;

            strActionUrl = @"http://" + objActionUrl.strPostAddress + ":" + objActionUrl.strHttpPort + @"/servlet/ICBCCMPAPIReqServlet?userID=";
            strActionUrl = strActionUrl + objActionUrl.strId + "&PackageID=" + objActionUrl.strPackageID + "&SendTime=" + objActionUrl.strSendTime;
            return(strActionUrl);
        }
コード例 #3
0
        /// <summary>
        /// 生成发往http加密端口的 POST数据
        /// </summary>
        /// <param name="objActionUrl">objActionUrl对象中,包含了CIS\TRANSCODE\ID</param>
        /// <param name="zipFlag">是否压缩报文节点</param>
        /// <param name="signData">签名数据</param>
        /// <returns></returns>
        public static string createPostData(ActionUrl objActionUrl, bool zipFlag, string signData)
        {
            string strPostData = string.Empty;

            strPostData = "Version=" + objActionUrl.strInterfaceVersion + "&TransCode=" + objActionUrl.strTransCode + "&BankCode=102&GroupCIS=" + objActionUrl.strCis + "&ID=" + objActionUrl.strId + "&PackageID=" + objActionUrl.strPackageID + "&Cert=&reqData=" + signData;
            if (zipFlag)
            {
                strPostData = strPostData + "&zipFlag=1";
            }
            return(strPostData);
        }
コード例 #4
0
ファイル: WBAction.cs プロジェクト: OliSharpe/wbf
        /// <summary>
        /// Performs any necessary work to change the default values of the WBAction as set in
        /// the WBCollection to be appropriate for the current user within the context of a specific WorkBox.
        /// </summary>
        /// <param name="workBox"></param>
        public void SpecialiseForCurrentContext(WorkBox workBox)
        {
            ActionUrl = ActionUrl.WBxReplaceTokens(workBox);

            if (IsEnabled)
            {
                // The button might be enabled in general, but maybe we should disable
                // the button in the current context.
                //
                // Unfortunately the logic for some buttons is slightly different:
                IsEnabled = enableLogic(workBox);
            }
        }
コード例 #5
0
ファイル: HomeController.cs プロジェクト: queoGmbH/peanuts
        public ActionResult MenuContentPartial()
        {
            ActionUrl activeLink = ActionUrl.Current();
            IList <MenuItemViewModel> menuModel = new List <MenuItemViewModel>();

            /*Objekte*/
            menuModel.Add(new SimpleMenuItemViewModel("menu_item_home",
                                                      new ActionLink("Dashboard", "", "Home", "Index"),
                                                      activeLink.IsAction("", "Home", "Index"),
                                                      "icon-home"));

            /*Gruppen*/
            menuModel.Add(new SimpleMenuItemViewModel("menu_item_groups",
                                                      new ActionLink("Meine Gruppen", "", "UserGroup", "AllMemberships"),
                                                      activeLink.IsController("", "UserGroup"),
                                                      "icon-group"));

            /*Peanuts*/
            menuModel.Add(new SimpleMenuItemViewModel("menu_item_peanuts",
                                                      new ActionLink("Peanuts", "", "Peanut", "Index"),
                                                      activeLink.IsController("", "Peanut"),
                                                      "icon-calendar"));

            /*Rechnungen*/
            menuModel.Add(new SimpleMenuItemViewModel("menu_item_bills",
                                                      new ActionLink("Rechnungen", "", "Bill", "Index"),
                                                      activeLink.IsController("", "Bill"),
                                                      "icon-inbox"));

            /*Zahlungen*/
            menuModel.Add(new SimpleMenuItemViewModel("menu_item_payments",
                                                      new ActionLink("Zahlungen", "", "Payment", "Index"),
                                                      activeLink.IsController("", "Payment"),
                                                      "icon-eur"));

            if (SecurityExpressionRootFactory.CreateSecurityExpressionRoot().HasRole(Roles.Administrator))
            {
                menuModel.Add(new SimpleMenuItemViewModel("menu_item_administration",
                                                          new ActionLink("Administration", "Admin", "HomeAdministration", "Index"),
                                                          activeLink.IsArea("Admin") && !activeLink.IsController("Admin", "MyUsersAdministration"),
                                                          "icon-gears"));
            }


            MenuViewModel menuViewModel = new MenuViewModel(menuModel);

            return(PartialView(menuViewModel));
        }
コード例 #6
0
ファイル: OCRToExcel.cs プロジェクト: yyq-may/OCRToExcel
        protected override void Execute(CodeActivityContext context)
        {
            string imagePath = ImagePath.Get(context);
            string actionUrl = ActionUrl.Get(context);
            string outPath   = OutExcelPath.Get(context);
            string result    = TaskAsync(actionUrl, imagePath).Result;

            Workbook workbook  = new Workbook();
            var      worksheet = workbook.Worksheets[0];

            var json = Newtonsoft.Json.JsonConvert.DeserializeObject <dynamic>(result);
            int n    = 1;

            foreach (var item in json)
            {
                worksheet.Cells["A" + n + ""].PutValue(item);
                n++;
            }
            workbook.Save(outPath);
            worksheet.Dispose();
            workbook.Dispose();
        }
コード例 #7
0
 protected virtual MenuActionItemBase GenerateActionUrlItem(ActionUrl actionUrl)
 {
     return(new ActionUrlItem(actionUrl));
 }
コード例 #8
0
 protected virtual MenuActionItemBase GenerateActionUrlItem(ActionUrl actionUrl)
 {
     return new ActionUrlItem(actionUrl);
 }