コード例 #1
0
        public string GeContactView()
        {
            Contact _contact = new Contact()
            {
                Address = "Hyderabad",
                Email = "*****@*****.**",
                Website = "www.test.com",
                Title = "Contact",
                Message = "MVC Common Helper class for generating html from razor view"
            };
            CommonHelper commonHelper = new CommonHelper();

            string _path = "~/Views/Home/Contact.cshtml";
            string _controllerName = "Home";
            string _viewName = "Contact";

            string result = commonHelper.GenerateViewToString<Contact>(new HomeController(), _path, _controllerName, _viewName, _contact);

            return result;
        }
コード例 #2
0
ファイル: Index.cs プロジェクト: leebivip/XCLWinKits
 private string GetResult(CommonHelper.CommonEnum.EncryptEnum encryptEnum, string str,bool isEncrypt)
 {
     string result = string.Empty;
     try
     {
         switch (encryptEnum)
         {
             case CommonHelper.CommonEnum.EncryptEnum.AES:
                 XCLNetTools.Encrypt.AESEncrypt aes = new XCLNetTools.Encrypt.AESEncrypt(this.ckContainKey.Checked);
                 if (string.IsNullOrEmpty(this.txtKey.Text))
                 {
                     result = isEncrypt ? aes.Encrypt(this.txtInput.Text) : aes.Decrypt(this.txtResult.Text);
                 }
                 else
                 {
                     result = isEncrypt ? aes.Encrypt(this.txtInput.Text, this.txtKey.Text) : aes.Decrypt(this.txtResult.Text, this.txtKey.Text);
                 }
                 break;
             case CommonHelper.CommonEnum.EncryptEnum.Base64:
                 result = isEncrypt ? XCLNetTools.Encode.Base64.Base64Code(str) : XCLNetTools.Encode.Base64.Base64Decode(str);
                 break;
             case CommonHelper.CommonEnum.EncryptEnum.DES:
                 if (string.IsNullOrEmpty(this.txtKey.Text))
                 {
                     result = isEncrypt ? XCLNetTools.Encrypt.DESEncrypt.Encrypt(this.txtInput.Text) : XCLNetTools.Encrypt.DESEncrypt.Decrypt(this.txtResult.Text);
                 }
                 else
                 {
                     result = isEncrypt ? XCLNetTools.Encrypt.DESEncrypt.Encrypt(this.txtInput.Text, this.txtKey.Text) : XCLNetTools.Encrypt.DESEncrypt.Decrypt(this.txtResult.Text, this.txtKey.Text);
                 }
                 break;
         }
     }
     catch (Exception ex)
     {
         result = "处理失败!";
     }
     return result;
 }
        private void UpdateChildBorders(ViewBase child,
                                        ViewLayoutContext context,
                                        ref PaletteDrawBorders leftEdges,
                                        ref PaletteDrawBorders rightEdges,
                                        ref PaletteDrawBorders topEdges,
                                        ref PaletteDrawBorders bottomEdges,
                                        ref PaletteDrawBorders fillEdges)
        {
            // Do we need to calculate if the child should remove any borders?
            if (RemoveChildBorders)
            {
                // Check if the view is a canvas
                ViewDrawCanvas childCanvas = child as ViewDrawCanvas;

                // Docking edge determines calculation
                switch (CalculateDock(GetDock(child), context.Control))
                {
                    case ViewDockStyle.Fill:
                        if (childCanvas != null)
                        {
                            childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(fillEdges, childCanvas.Orientation);
                        }
                        else
                        {
                            if (child is ViewLayoutDocker layoutDocker)
                            {
                                foreach (ViewBase layoutChild in layoutDocker)
                                {
                                    childCanvas = layoutChild as ViewDrawCanvas;
                                    if (childCanvas != null)
                                    {
                                        childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(fillEdges, childCanvas.Orientation);
                                    }
                                }
                            }
                        }
                        break;
                    case ViewDockStyle.Top:
                        if (childCanvas != null)
                        {
                            childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(topEdges, childCanvas.Orientation);
                        }

                        // Remove top edges from subsequent children
                        leftEdges &= PaletteDrawBorders.BottomLeftRight;
                        rightEdges &= PaletteDrawBorders.BottomLeftRight;
                        topEdges &= PaletteDrawBorders.BottomLeftRight;
                        fillEdges &= PaletteDrawBorders.BottomLeftRight;
                        break;
                    case ViewDockStyle.Bottom:
                        if (childCanvas != null)
                        {
                            childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(bottomEdges, childCanvas.Orientation);
                        }

                        // Remove bottom edges from subsequent children
                        leftEdges &= PaletteDrawBorders.TopLeftRight;
                        rightEdges &= PaletteDrawBorders.TopLeftRight;
                        bottomEdges &= PaletteDrawBorders.TopLeftRight;
                        fillEdges &= PaletteDrawBorders.TopLeftRight;
                        break;
                    case ViewDockStyle.Left:
                        if (childCanvas != null)
                        {
                            childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(leftEdges, childCanvas.Orientation);
                        }

                        // Remove left edges from subsequent children
                        topEdges &= PaletteDrawBorders.TopBottomRight;
                        bottomEdges &= PaletteDrawBorders.TopBottomRight;
                        leftEdges &= PaletteDrawBorders.TopBottomRight;
                        fillEdges &= PaletteDrawBorders.TopBottomRight;
                        break;
                    case ViewDockStyle.Right:
                        if (childCanvas != null)
                        {
                            childCanvas.MaxBorderEdges = CommonHelper.ReverseOrientateDrawBorders(rightEdges, childCanvas.Orientation);
                        }

                        // Remove right edges from subsequent children
                        topEdges &= PaletteDrawBorders.TopBottomLeft;
                        bottomEdges &= PaletteDrawBorders.TopBottomLeft;
                        rightEdges &= PaletteDrawBorders.TopBottomLeft;
                        fillEdges &= PaletteDrawBorders.TopBottomLeft;
                        break;
                }
            }
        }
コード例 #4
0
ファイル: SonyMusic.cs プロジェクト: zry980321/YaVipCore
        private static List <SongResult> Search(string key, int page, int size)
        {
            key = key.Replace("\"", "");
            var text = "keyword=" + key + "&" + "pageNo=" + (page - 1) + "&" + "pageSize=" + size + "&" + "type=TRACK";
            var url  = "http://api.sonyselect.com.cn/es/search/v1/android/?sign=" + GetDes3EncryptedText(text);
            var data =
                "{\"content\":{\"type\":\"TRACK\",\"pageSize\":\"" + size + "\",\"pageNo\":\"" + (page - 1) + "\",\"keyword\":\"" + key + "\"},\"header\":{\"sdkNo\":\"4.2.2\",\"model\":\"X9Plus\",\"manufacturer\":\"vivo\",\"imei\":\"133524532901500\"}}";
            var html = CommonHelper.PostData(url, new Dictionary <string, string> {
                { "JSON", data }
            }, 1);

            if (string.IsNullOrEmpty(html))
            {
                return(null);
            }
            var json = JObject.Parse(html);

            if (json["content"]["trackPage"]["totalElements"].Value <int>() <= 0)
            {
                return(null);
            }
            var datas = json["content"]["trackPage"]["content"];
            var list  = new List <SongResult>();

            foreach (JToken j in datas)
            {
                try
                {
                    var song = new SongResult
                    {
                        SongId      = j["id"].ToString(),
                        SongName    = j["name"].ToString(),
                        SongSubName = "",
                        SongLink    = "",

                        ArtistId      = j["albums"]?.First?["artistId"].ToString() ?? "",
                        ArtistName    = j["albums"]?.First?["aritst"].ToString() ?? "",
                        ArtistSubName = "",

                        AlbumId      = j["albums"]?.First?["id"].ToString() ?? "0",
                        AlbumName    = j["albums"]?.First?["name"].ToString() ?? "",
                        AlbumSubName = "",
                        AlbumArtist  = j["albums"]?.First?["aritst"].ToString() ?? "",

                        Length  = CommonHelper.TimeToNum(j["duration"].ToString()),
                        BitRate = "无损",

                        FlacUrl = "",
                        ApeUrl  = "",
                        WavUrl  = "",
                        SqUrl   = "",
                        HqUrl   = "",
                        LqUrl   = "",
                        CopyUrl = "",

                        SmallPic = j["albums"]?.First?["smallIcon"].ToString() ?? "",
                        PicUrl   = j["albums"]?.First?["largeIcon"].ToString() ?? "",

                        LrcUrl = "",
                        TrcUrl = "",
                        KrcUrl = "",

                        MvId    = "",
                        MvHdUrl = "",
                        MvLdUrl = "",

                        Language = "",
                        Company  = "",
                        Year     = j["createTime"]?.ToString(),
                        Disc     = 1,
                        TrackNum = 0,
                        Type     = "sn"
                    };
                    if (j["auditionUrl"] != null)
                    {
                        var link = j["auditionUrl"].ToString();
                        song.LqUrl = song.HqUrl = song.SqUrl = song.CopyUrl = link;
                        link       = link.Replace("/Audition/", "/Audio/").Replace(".mp3", "");
                        if (j["downloadUrl"] != null)
                        {
                            if (j["downloadUrl"].ToString().StartsWith("http"))
                            {
                                link = j["downloadUrl"].ToString();
                            }
                        }
                        if (link.Contains(".flac"))
                        {
                            song.FlacUrl = link;
                        }
                        else if (link.Contains(".ape"))
                        {
                            song.ApeUrl = link;
                        }
                        else
                        {
                            song.WavUrl = link;
                        }
                    }
                    list.Add(song);
                }
                catch (Exception e)
                {
                    CommonHelper.AddLog(j.ToString());
                    CommonHelper.AddLog(e.ToString());
                }
            }
            return(list);
        }
コード例 #5
0
        private bool SubmitProcess()
        {
            if (string.IsNullOrEmpty(this.luInvestor.SelectedValue()))
            {
                DXMessage.ShowTips("请选择投资发起人!");
                this.luInvestor.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.luStock.SelectedValue()))
            {
                DXMessage.ShowTips("请选择股票信息!");
                this.luStock.Focus();
                return(false);
            }

            if (this.txtPrice.Text.Trim().Length == 0)
            {
                DXMessage.ShowTips("请输入单价!");
                this.txtPrice.Focus();
                return(false);
            }

            if (decimal.Parse(this.txtPrice.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("单价应该大于0!");
                this.txtPrice.Focus();
                return(false);
            }

            if (this.txtPriceBound.Text.Trim().Length == 0)
            {
                DXMessage.ShowTips("请输入单价上下限!");
                this.txtPriceBound.Focus();
                return(false);
            }

            int priceBound;

            if (!int.TryParse(txtPriceBound.Text.Trim(), out priceBound))
            {
                DXMessage.ShowTips("单价上下限应该输入数字!");
                this.txtPriceBound.Focus();
                return(false);
            }

            if (int.Parse(this.txtPriceBound.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("单价上下限应该大于0!");
                this.txtPriceBound.Focus();
                return(false);
            }

            if (this.txtVolume.Text.Trim().Length == 0)
            {
                DXMessage.ShowTips("请输入数量!");
                this.txtVolume.Focus();
                return(false);
            }

            if (decimal.Parse(this.txtVolume.Text.Trim()) <= 0)
            {
                DXMessage.ShowTips("数量应该大于0!");
                this.txtVolume.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(this.memoReason.Text.Trim()))
            {
                DXMessage.ShowTips("请输入申请理由!");
                this.memoReason.Focus();
                return(false);
            }

            var investorInfo = this.luInvestor.GetSelectedDataRow() as UserInfo;
            var applyDate    = CommonHelper.StringToDateTime(this.deApply.EditValue.ToString());
            var tradeType    = int.Parse(this.cbOperateType.SelectedValue());
            var price        = decimal.Parse(this.txtPrice.Text.Trim());
            var volume       = decimal.Parse(this.txtVolume.Text.Trim());
            var amount       = Math.Abs(decimal.Parse(this.txtAmount.Text.Trim()) * (int)EnumLibrary.NumericUnit.TenThousand);

            var stock = this.luStock.GetSelectedDataRow() as StockInfoModel;
            var now   = _commonService.GetCurrentServerTime();

            var form = new InvestmentDecisionForm
            {
                Amount            = this.chkBuy.Checked ? amount : -amount,
                ApplyDate         = applyDate,
                ApplyUser         = investorInfo.Code,
                CreateTime        = now,
                DealFlag          = this.chkBuy.Checked ? true : false,
                DepartmentId      = investorInfo.DepartmentId,
                Price             = price,
                PriceBound        = (decimal)priceBound / (int)EnumLibrary.NumericUnit.Hundred,
                Reason            = this.memoReason.Text.Trim(),
                RelateTradePlanNo = txtPlanNo.Text.Trim(),
                SerialNo          = string.Empty,
                Status            = (int)EnumLibrary.IDFormStatus.Submited,
                StockFullCode     = stock.FullCode,
                StockName         = stock.Name,
                TradeType         = tradeType,
                UpdateTime        = now,
                Volume            = volume,
            };

            _IDService.SubmitInvestmentDecisionApplication(form);

            return(true);
        }
コード例 #6
0
 protected override void OnLoad(EventArgs e)
 {
     CommonHelper.EnsureSsl();
     base.OnLoad(e);
 }
コード例 #7
0
 /// <summary>
 /// 删除商品咨询
 /// </summary>
 /// <param name="consultIdList">商品咨询id列表</param>
 /// <returns></returns>
 public ActionResult DelProductConsult(int[] consultIdList)
 {
     AdminProductConsults.DeleteProductConsultById(consultIdList);
     AddAdminOperateLog("删除商品咨询", "删除商品咨询,商品咨询ID为:" + CommonHelper.IntArrayToString(consultIdList));
     return(PromptView("商品咨询删除成功"));
 }
コード例 #8
0
        public static IndexInfo FromXml(string xml, string scope)
        {
            var info = new IndexInfo(scope);

            try
            {
                var doc = XDocument.Parse(xml);

                var lastIndexed = doc.Descendants("last-indexed-utc").FirstOrDefault()?.Value;
                if (lastIndexed.HasValue())
                {
                    info.LastIndexedUtc = lastIndexed.Convert <DateTime?>()?.ToUniversalTime();
                }

                var lastDuration = doc.Descendants("last-indexing-duration").FirstOrDefault()?.Value;
                if (lastDuration.HasValue())
                {
                    info.LastIndexingDuration = lastDuration.Convert <TimeSpan?>();
                }

                var isModified = doc.Descendants("is-modified").FirstOrDefault()?.Value;
                if (isModified.HasValue())
                {
                    info.IsModified = isModified.Convert <bool>();
                }
                else
                {
                    info.IsModified = lastIndexed.HasValue();
                }

                var status = doc.Descendants("status").FirstOrDefault()?.Value;
                if (status.HasValue())
                {
                    info.Status = status.Convert <IndexingStatus>();
                }

                info.Error = doc.Descendants("error").FirstOrDefault()?.Value;

                var documentCount = doc.Descendants("document-count").FirstOrDefault()?.Value;
                if (documentCount.HasValue())
                {
                    info.DocumentCount = documentCount.ToInt();
                }

                var indexSize = doc.Descendants("index-size").FirstOrDefault()?.Value;
                if (indexSize.HasValue() && CommonHelper.TryConvert(indexSize, out long size))
                {
                    info.IndexSize = size;
                }

                var lastAddedDocumentId = doc.Descendants("last-added-document-id").FirstOrDefault()?.Value;
                if (lastAddedDocumentId.HasValue())
                {
                    info.LastAddedDocumentId = lastAddedDocumentId.ToInt();
                }

                var fields = doc.Descendants("fields").FirstOrDefault()?.Value;
                if (fields.HasValue())
                {
                    info.Fields = fields.SplitSafe(", ");
                }

                var shouldRebuild = doc.Descendants("should-rebuild").FirstOrDefault()?.Value;
                if (shouldRebuild.HasValue())
                {
                    info.ShouldRebuild = shouldRebuild.Convert <bool>();
                }
            }
            catch { }

            return(info);
        }
コード例 #9
0
 /// <summary>Show an informational message to the player.</summary>
 /// <param name="message">The message to show.</param>
 public void ShowInfoMessage(string message)
 {
     CommonHelper.ShowInfoMessage(message);
 }
コード例 #10
0
        public void SaveData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            // attribute save example
            //clientData.OrderAttributeValues = new Dictionary<string, CSBusiness.Attributes.AttributeValue>();
            //clientData.OrderAttributeValues.Add("ref_url", new CSBusiness.Attributes.AttributeValue("http://www.google.com"));

            if (clientData.OrderAttributeValues == null)
            {
                clientData.OrderAttributeValues = new Dictionary <string, CSBusiness.Attributes.AttributeValue>();
            }
            clientData.OrderAttributeValues.AddOrUpdateAttributeValue("CustomOrderId", new CSBusiness.Attributes.AttributeValue("CS" + CommonHelper.GetRandonOrderNumber(DateTime.Now)));
            //Recapture billing information if the user modified the information
            if (rId == 0)
            {
                if (cbBillingDifferent.Checked) //override if the user select yes button
                {
                    Address billingAddress = new Address();
                    billingAddress.FirstName       = CommonHelper.fixquotesAccents(txtFirstName.Text);
                    billingAddress.LastName        = CommonHelper.fixquotesAccents(txtLastName.Text);
                    billingAddress.Address1        = CommonHelper.fixquotesAccents(txtAddress1.Text);
                    billingAddress.Address2        = CommonHelper.fixquotesAccents(txtAddress2.Text);
                    billingAddress.City            = CommonHelper.fixquotesAccents(txtCity.Text);
                    billingAddress.StateProvinceId = Convert.ToInt32(ddlState.SelectedValue);
                    billingAddress.CountryId       = Convert.ToInt32(ddlCountry.SelectedValue);
                    billingAddress.ZipPostalCode   = txtZipCode.Text;

                    clientData.CustomerInfo.FirstName      = CommonHelper.fixquotesAccents(txtFirstName.Text);
                    clientData.CustomerInfo.LastName       = CommonHelper.fixquotesAccents(txtLastName.Text);
                    clientData.CustomerInfo.BillingAddress = billingAddress;
                }
            }

            SetBillingAddress();


            PaymentInformation paymentDataInfo = new PaymentInformation();
            string             CardNumber      = txtCCNumber.Text;

            paymentDataInfo.CreditCardNumber  = CommonHelper.Encrypt(CardNumber);
            paymentDataInfo.CreditCardType    = Convert.ToInt32(ddlCCType.SelectedValue);
            paymentDataInfo.CreditCardName    = ddlCCType.SelectedItem.Text;
            paymentDataInfo.CreditCardExpired = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
            paymentDataInfo.CreditCardCSC     = txtCvv.Text;

            CartContext.PaymentInfo = paymentDataInfo;

            Session["ClientOrderData"] = clientData;


            ////// Prepaid Card OverLay //////

            int  cardNo    = Convert.ToInt32(CardNumber.Substring(0, 6));
            bool isPrepaid = CSWebBase.PrepaidCardDAL.IsPrepaidCard(cardNo);

            if (isPrepaid && OrderHelper.IsMainKit() && !OrderHelper.IsOnePay())
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "open_expire_soon();", true);
            }
            else
            {
                int orderId = 0;

                if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess ||
                    CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder ||
                    CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableUpsellReviewOrder)
                {
                    //Save Order information before upsale process

                    if (rId == 1)
                    {
                        orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);
                    }
                    else
                    {
                        //update order with modified customer shipping and billing and credit card information
                        orderId = clientData.OrderId;
                        CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData);
                    }

                    if (orderId > 1)
                    {
                        clientData.OrderId         = orderId;
                        Session["ClientOrderData"] = clientData;

                        if (rId == 1)
                        {
                            Response.Redirect("PostSale.aspx");
                        }
                        else
                        {
                            Response.Redirect("CardDecline.aspx");
                        }
                    }
                }
            }
        }
コード例 #11
0
        public void ReloadCartData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];


            if (OrderHelper.IsMainKit() && OrderHelper.IsOnePay())
            {
                int orderId = 0;

                if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess ||
                    CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder)
                {
                    //Save Order information before upsale process


                    orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);

                    if (orderId > 1)
                    {
                        clientData.OrderId         = orderId;
                        Session["ClientOrderData"] = clientData;
                        Response.Redirect("PostSale.aspx");
                    }
                }
            }

            try
            {
                ddlCountry.ClearSelection();

                ddlState.ClearSelection();


                ddlCountry.Items.FindByValue(clientData.CustomerInfo.BillingAddress.CountryId.ToString()).Selected = true;
                ddlCountry.SelectedValue = clientData.CustomerInfo.BillingAddress.CountryId.ToString();

                BindRegions();


                ddlState.Items.FindByValue(clientData.CustomerInfo.BillingAddress.StateProvinceId.ToString()).Selected = true;



                //Payment information
                ddlCCType.SelectedValue = clientData.PaymentInfo.CreditCardType.ToString();
                string ccNumber = CommonHelper.Decrypt(clientData.PaymentInfo.CreditCardNumber);
                txtCCNumber.Text = ccNumber;


                txtCvv.Text = clientData.PaymentInfo.CreditCardCSC;
                DateTime expireDate = DateTime.MinValue;
                DateTime.TryParse(clientData.PaymentInfo.CreditCardExpired.ToString(), out expireDate);
                ddlExpMonth.Items.FindByValue(expireDate.Month.ToString()).Selected = true;
                ddlExpYear.Items.FindByValue(expireDate.Year.ToString()).Selected   = true;

                //Billing informarion
                txtFirstName.Text = clientData.CustomerInfo.BillingAddress.FirstName;
                txtLastName.Text  = clientData.CustomerInfo.BillingAddress.LastName;
                txtAddress1.Text  = clientData.CustomerInfo.BillingAddress.Address1;
                txtAddress2.Text  = clientData.CustomerInfo.BillingAddress.Address2;
                txtCity.Text      = clientData.CustomerInfo.BillingAddress.City;
                txtZipCode.Text   = clientData.CustomerInfo.BillingAddress.ZipPostalCode;
            }
            catch
            {
            }
        }
コード例 #12
0
 public SecuritySettings()
 {
     EncryptionKey = CommonHelper.GenerateRandomDigitCode(16);
     AdminAreaAllowedIpAddresses = new List <string>();
 }
コード例 #13
0
        public override async Task <RepositoryResponse <bool> > SaveSubModelsAsync(MixTheme parent, MixCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            RepositoryResponse <bool> result = new RepositoryResponse <bool>()
            {
                IsSucceed = true
            };

            try
            {
                // Clone Default templates
                Name = SeoHelper.GetSEOString(Title);
                string defaultTemplateFolder = $"{MixService.GetConfig<string>(MixConstants.ConfigurationKeyword.DefaultTemplateFolder) }";
                bool   copyResult            = FileRepository.Instance.CopyDirectory(defaultTemplateFolder, TemplateFolder);
                string defaultAssetsFolder   = CommonHelper.GetFullPath(new string[] {
                    MixConstants.Folder.WebRootPath,
                    "assets",
                    MixConstants.Folder.TemplatesAssetFolder,
                    "default"
                });
                copyResult = FileRepository.Instance.CopyDirectory(defaultAssetsFolder, AssetFolder);

                var files = FileRepository.Instance.GetFilesWithContent(TemplateFolder);
                //TODO: Create default asset
                int id = 0;
                foreach (var file in files)
                {
                    id++;
                    string content = file.Content.Replace("/assets/templates/default", $"/{ MixConstants.Folder.FileFolder}/{MixConstants.Folder.TemplatesAssetFolder}/{Name}");
                    MixTemplates.InitViewModel template = new MixTemplates.InitViewModel(
                        new MixTemplate()
                    {
                        Id              = id,
                        FileFolder      = file.FileFolder,
                        FileName        = file.Filename,
                        Content         = content,
                        Extension       = file.Extension,
                        CreatedDateTime = DateTime.UtcNow,
                        LastModified    = DateTime.UtcNow,
                        ThemeId         = Model.Id,
                        ThemeName       = Model.Name,
                        FolderType      = file.FolderName,
                        ModifiedBy      = CreatedBy
                    }, _context, _transaction);
                    var saveResult = await template.SaveModelAsync(true, _context, _transaction);

                    result.IsSucceed = result.IsSucceed && saveResult.IsSucceed;
                    if (!saveResult.IsSucceed)
                    {
                        result.Exception = saveResult.Exception;
                        result.Errors.AddRange(saveResult.Errors);
                        break;
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                result.IsSucceed = false;
                result.Errors.Add(ex.Message);
                result.Exception = ex;
                return(result);
            }
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: shakasi/coding
 private void Form1_Load(object sender, EventArgs e)
 {
     for (int i = 0; i < 50; i++)
     {
         LogDynamicHelper.CreateInstance().WriteLog(LogLevel.Exception, LogSeparator.CreateInstance("\r\n"), "JR1", new object[] { "1.0." + i, System.Reflection.MethodBase.GetCurrentMethod().Name, CommonHelper.GetLineNum(), "我是错误Exception" });
         LogDynamicHelper.CreateInstance().WriteLog(LogLevel.Error, LogSeparator.CreateInstance("\r\n"), "JR2", new object[] { "1.0." + i, System.Reflection.MethodBase.GetCurrentMethod().Name, CommonHelper.GetLineNum(), "我是错误Error" });
         LogDynamicHelper.CreateInstance().WriteLog(LogLevel.Warning, LogSeparator.CreateInstance("\r\n"), "JR3", new object[] { "1.0." + i, System.Reflection.MethodBase.GetCurrentMethod().Name, CommonHelper.GetLineNum(), "我是错误Warning" });
         LogDynamicHelper.CreateInstance().WriteLog(LogLevel.Information, LogSeparator.CreateInstance("\r\n"), "JR4", new object[] { "1.0." + i, System.Reflection.MethodBase.GetCurrentMethod().Name, CommonHelper.GetLineNum(), "我是错误Information" });
     }
 }
コード例 #15
0
 public MigrationController()
 {
     _common = new CommonHelper();
 }
コード例 #16
0
 protected void btnClearCompareProductsList_Click(object sender, EventArgs e)
 {
     ProductManager.ClearCompareProducts();
     Page.Response.Redirect(CommonHelper.GetStoreLocation());
 }
コード例 #17
0
 //删除
 public ActionResult Del(int[] idList)
 {
     WeChats.DeleteWeChat(idList);
     AddAdminOperateLog("删除公众号", "删除公众号,公众号ID为:" + CommonHelper.IntArrayToString(idList));
     return(PromptView("公众号删除成功"));
 }
コード例 #18
0
 /// <summary>Show an error message to the player.</summary>
 /// <param name="message">The message to show.</param>
 public void ShowErrorMessage(string message)
 {
     CommonHelper.ShowErrorMessage(message);
 }
コード例 #19
0
        public bool validateInput()
        {
            if (!cbBillingDifferent.Checked)
            {
                if (CommonHelper.EnsureNotNull(txtShippingFirstName.Text) == String.Empty)
                {
                    lblFirstNameError.Text    = ResourceHelper.GetResoureValue("FirstNameErrorMsg");
                    lblFirstNameError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblFirstNameError.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtShippingLastName.Text) == String.Empty)
                {
                    lblLastNameError.Text    = ResourceHelper.GetResoureValue("LastNameErrorMsg");
                    lblLastNameError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblLastNameError.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtShippingAddress1.Text) == String.Empty)
                {
                    lblShippingAddress1Error.Text    = ResourceHelper.GetResoureValue("ShippingAddress1ErrorMsg");
                    lblShippingAddress1Error.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblShippingAddress1Error.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtShippingCity.Text) == String.Empty)
                {
                    lblShippingCityError.Text    = ResourceHelper.GetResoureValue("ShippingCityErrorMsg");
                    lblShippingCityError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblShippingCityError.Visible = false;
                }


                if (ddlShippingState.SelectedValue.Equals("select"))
                {
                    lblShippingStateError.Text    = ResourceHelper.GetResoureValue("ShippingStateErrorMsg");
                    lblShippingStateError.Visible = true;
                    _bError = true;
                }
                else
                {
                    lblShippingStateError.Visible = false;
                }

                if (CommonHelper.EnsureNotNull(txtShippingZipCode.Text) == String.Empty)
                {
                    lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeErrorMsg");
                    lblShippingZiPError.Visible = true;
                    _bError = true;
                }
                else
                {
                    if (!CommonHelper.IsValidZipCode(txtShippingZipCode.Text))
                    {
                        lblShippingZiPError.Text    = ResourceHelper.GetResoureValue("ShippingZipCodeValidationErrorMsg");
                        lblShippingZiPError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblShippingZiPError.Visible = false;
                    }
                }
            }
            //if (!cbTeams.Checked)
            //{
            //    lblTerms.Text = ResourceHelper.GetResoureValue("TermsErrorMsg");
            //    lblTerms.Visible = true;
            //    _bError = true;

            //}
            //else
            //    lblTerms.Visible = false;

            if (ddlCCType.SelectedIndex < 0)
            {
                lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeErrorMsg");
                lblCCType.Visible = true;
                _bError           = true;
            }
            else
            {
                lblCCType.Visible = false;
            }


            DateTime expire = new DateTime();

            if (ddlExpYear.SelectedIndex > 0 && ddlExpMonth.SelectedIndex > 0)
            {
                expire = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
            }
            DateTime today = DateTime.Today;

            if (expire.Year <= today.Year && expire.Month <= today.Month)
            {
                lblExpDate.Text    = ResourceHelper.GetResoureValue("ExpDateErrorMsg");
                lblExpDate.Visible = true;
                _bError            = true;
            }
            else
            {
                lblExpDate.Visible = false;
            }

            string c = txtCCNumber1.Text + txtCCNumber2.Text + txtCCNumber3.Text + txtCCNumber4.Text;

            if (c.Equals(""))
            {
                lblCCNumberError.Text    = ResourceHelper.GetResoureValue("CCErrorMsg");
                lblCCNumberError.Visible = true;
                _bError = true;
            }
            else
            {
                if ((c.ToString() != "4444333322221111") && (txtCvv.Text.IndexOf("147114711471") == -1))
                {
                    if (!CommonHelper.ValidateCardNumber(c))
                    {
                        lblCCNumberError.Text    = ResourceHelper.GetResoureValue("CCErrorMsg");
                        lblCCNumberError.Visible = true;
                        _bError = true;
                    }
                    else
                    {
                        lblCCNumberError.Visible = false;
                    }
                }
                else
                {
                    lblCCNumberError.Visible = false;
                }
            }

            if (CommonHelper.EnsureNotNull(txtCvv.Text) == String.Empty)
            {
                lblCvvError.Text    = ResourceHelper.GetResoureValue("CVVErrorMsg");
                lblCvvError.Visible = true;
                _bError             = true;
            }
            else
            {
                if (CommonHelper.onlynums(txtCvv.Text) == false)
                {
                    lblCvvError.Text    = ResourceHelper.GetResoureValue("CVVErrorMsg");
                    lblCvvError.Visible = true;
                    _bError             = true;
                }
                if ((CommonHelper.CountNums(txtCvv.Text) != 3) && (CommonHelper.CountNums(txtCvv.Text) != 4))
                {
                    lblCvvError.Text    = ResourceHelper.GetResoureValue("CVVErrorMsg");
                    lblCvvError.Visible = true;
                    _bError             = true;
                }
                else
                {
                    lblCvvError.Visible = false;
                }

                if ((c[0].ToString() == "5") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.MasterCard.ToString()))
                {
                    lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                    lblCCType.Visible = true;
                    _bError           = true;
                }
                else if ((c[0].ToString() == "4") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.VISA.ToString()))
                {
                    lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                    lblCCType.Visible = true;
                    _bError           = true;
                }
                else if ((c[0].ToString() == "6") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.Discover.ToString()))
                {
                    lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                    lblCCType.Visible = true;
                    _bError           = true;
                }
                else if ((c[0].ToString() == "3") && (ddlCCType.SelectedItem.Text.ToString() != CreditCardTypeEnum.AmericanExpress.ToString()))
                {
                    lblCCType.Text    = ResourceHelper.GetResoureValue("CCTypeValidationErrorMsg");
                    lblCCType.Visible = true;
                    _bError           = true;
                }
                else
                {
                    lblCCType.Visible = false;
                }
            }
            return(_bError);
        }
 public object Clone()
 {
     return(CommonHelper.Copy(this));
 }
コード例 #21
0
        public void SaveData()
        {
            ClientCartContext clientData = (ClientCartContext)Session["ClientOrderData"];

            // attribute save example
            //clientData.OrderAttributeValues = new Dictionary<string, CSBusiness.Attributes.AttributeValue>();
            //clientData.OrderAttributeValues.Add("ref_url", new CSBusiness.Attributes.AttributeValue("http://www.google.com"));
            if (clientData.OrderAttributeValues == null)
            {
                clientData.OrderAttributeValues = new Dictionary <string, CSBusiness.Attributes.AttributeValue>();
            }
            clientData.OrderAttributeValues.Add("CustomOrderId", new CSBusiness.Attributes.AttributeValue("CS" + CommonHelper.GetRandonOrderNumber(DateTime.Now)));
            clientData.OrderAttributeValues.Add("cartabandonmentid", new CSBusiness.Attributes.AttributeValue(clientData.CartAbandonmentId.ToString()));


            //Recapture billing information if the user modified the information
            if (rId == 0)
            {
                if (Convert.ToBoolean(!cbBillingDifferent.Checked)) //override if the user select yes button
                {
                    Address shippingAddress = new Address();
                    shippingAddress.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                    shippingAddress.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Text);
                    shippingAddress.Address1        = CommonHelper.fixquotesAccents(txtShippingAddress1.Text);
                    shippingAddress.Address2        = CommonHelper.fixquotesAccents(txtShippingAddress2.Text);
                    shippingAddress.City            = CommonHelper.fixquotesAccents(txtShippingCity.Text);
                    shippingAddress.StateProvinceId = Convert.ToInt32(ddlShippingState.SelectedValue);
                    shippingAddress.CountryId       = Convert.ToInt32(ddlShippingCountry.SelectedValue);
                    shippingAddress.ZipPostalCode   = txtShippingZipCode.Text;

                    clientData.CustomerInfo.FirstName       = CommonHelper.fixquotesAccents(txtShippingFirstName.Text);
                    clientData.CustomerInfo.LastName        = CommonHelper.fixquotesAccents(txtShippingLastName.Text);
                    clientData.CustomerInfo.ShippingAddress = shippingAddress;
                }
            }

            SetShippingAddress();


            PaymentInformation paymentDataInfo = new PaymentInformation();
            string             CardNumber      = txtCCNumber1.Text + txtCCNumber2.Text + txtCCNumber3.Text + txtCCNumber4.Text;

            paymentDataInfo.CreditCardNumber  = CommonHelper.Encrypt(CardNumber);
            paymentDataInfo.CreditCardType    = Convert.ToInt32(ddlCCType.SelectedValue);
            paymentDataInfo.CreditCardName    = ddlCCType.SelectedItem.Text;
            paymentDataInfo.CreditCardExpired = new DateTime(int.Parse(ddlExpYear.SelectedValue), int.Parse(ddlExpMonth.SelectedValue), 1);
            paymentDataInfo.CreditCardCSC     = txtCvv.Text;

            CartContext.PaymentInfo = paymentDataInfo;

            int orderId = 0;

            if (CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.InstantOrderProcess ||
                CSFactory.OrderProcessCheck() == (int)OrderProcessTypeEnum.EnableReviewOrder)
            {
                //Save Order information before upsale process

                if (rId == 1)
                {
                    orderId = CSResolve.Resolve <IOrderService>().SaveOrder(clientData);
                }
                else
                {
                    //update order with modified customer shipping and billing and credit card information
                    orderId = clientData.OrderId;
                    CSResolve.Resolve <IOrderService>().UpdateOrder(orderId, clientData);
                }

                if (orderId > 1)
                {
                    clientData.OrderId         = orderId;
                    Session["ClientOrderData"] = clientData;

                    if (rId == 1)
                    {
                        Response.Redirect("PostSale.aspx");
                    }
                    else
                    {
                        Response.Redirect("CardDecline.aspx");
                    }
                }
            }
        }
コード例 #22
0
        public async Task UpdateBaoJiaPrice(string licenseno, string intentioncompany, int agent, string custKey)
        {
            logInfo.Info("报价回调接口" + Request.RequestUri);
            //if (agent != 4405) return;
            string   str1       = string.Empty;
            IBxAgent agentModel = _commonBehaviorService.GetAgentModelFactory(agent);
            //custKey = custKey.Substring(custKey.IndexOf("-", System.StringComparison.Ordinal) + 1);

            var pairs    = Request.GetQueryNameValuePairs();
            var newPairs = new List <KeyValuePair <string, string> >();

            foreach (KeyValuePair <string, string> pair in pairs)
            {
                if (pair.Key == "custkey")
                {
                    newPairs.Add(new KeyValuePair <string, string>(pair.Key, custKey));
                }
                else
                {
                    newPairs.Add(new KeyValuePair <string, string>(pair.Key, pair.Value));
                }
            }


            string secCode = _commonBehaviorService.GetSecCode(newPairs, agentModel.SecretKey);



            using (HttpClient client = new HttpClient())
            {
                //var url = System.Configuration.ConfigurationManager.AppSettings["CarInsuranceGetPriceInfo"];
                var geturl = string.Format("http://it.91bihu.com/api/CarInsurance/GetPrecisePrice?licenseno={0}&intentioncompany={1}&agent={2}&seccode={3}&custkey={4}", licenseno, intentioncompany, agent, secCode, custKey);
                //var geturl =
                // string.Format("http://192.168.3.12:8099/api/CarInsurance/GetPrecisePrice?licenseno={0}&intentioncompany={1}&agent={2}&seccode={3}&custkey={4}", licenseno, intentioncompany, agent, secCode, custKey);

                var clientResult =
                    await client.GetAsync(geturl);

                if (clientResult.IsSuccessStatusCode)
                {
                    str1 = await clientResult.Content.ReadAsStringAsync();
                }
            }

            //根据agent确定回调地址
            string str = str1;

            //string str =
            //    "\"UserInfo\":{\"LicenseNo\":\"京NR4923\",\"ForceExpireDate\":\"2017-03-24\",\"BusinessExpireDate\":\"2016-03-24\"}";
            using (HttpClient client = new HttpClient())
            {
                DateTime dtStart   = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
                DateTime dtNow     = DateTime.Parse(DateTime.Now.ToString());
                TimeSpan toNow     = dtNow.Subtract(dtStart);
                string   timeStamp = toNow.Ticks.ToString();
                timeStamp = timeStamp.Substring(0, timeStamp.Length - 7);
                var _from      = "bihu";
                var _nonce     = "abcdefgh";
                var _timestamp = timeStamp;
                // var queryString = "data=" + @"{UserInfo:{LicenseNo:京NR4923,ForceExpireDate:2017-03-24,BusinessExpireDate:2016-03-24},Item:{BizRate:0,ForceRate:0,BizTotal:2396.07,ForceTotal:0,TaxTotal:0,Source:2,QuoteStatus:-1,QuoteResult:成功,CheSun:{BaoE:95900,BaoFei:984.92},SanZhe:{BaoE:300000,BaoFei:717.49},DaoQiang:{BaoE:0,BaoFei:0},SiJi:{BaoE:10000,BaoFei:23.99},ChengKe:{BaoE:10000,BaoFei:60.86},BoLi:{BaoE:1,BaoFei:106.63},HuaHen:{BaoE:2000,BaoFei:234.09},SheShui:{BaoE:0,BaoFei:0},CheDeng:{BaoE:1,BaoFei:0},ZiRan:{BaoE:0,BaoFei:0},BuJiMianCheSun:{BaoE:1,BaoFei:147.74},BuJiMianSanZhe:{BaoE:1,BaoFei:107.62},BuJiMianDaoQiang:{BaoE:0,BaoFei:0},BuJiMianRenYuan:{BaoE:1,BaoFei:12.73},BuJiMianFuJia:{BaoE:0,BaoFei:0}},BusinessStatus:1}";
                // var transData = str.Replace("\"", "");
                var transData   = str;
                var queryString = "data=" + transData;
                var request     = new
                {
                    _from      = "bihu",
                    _nonce     = "abcdefgh",
                    _timestamp = timeStamp,
                    _sign      = (queryString.GetMd5() + _nonce + _timestamp + _from +
                                  "NmQ0YzhmNzhlZmM1OWNk").GetMd5().ToUpper(),
                    data = transData
                };
                var datas = CommonHelper.ReverseEachProperties(request);

                var postData     = new System.Net.Http.FormUrlEncodedContent(datas);
                var clientResult =
                    await client.PostAsync("http://210.13.242.24:7001/api/insurance/updatePrice", postData);

                //var rr2 = response2.Content.ReadAsStringAsync().Result;
                if (clientResult.IsSuccessStatusCode)
                {
                    var raw_response = await clientResult.Content.ReadAsByteArrayAsync();

                    var result = Encoding.Default.GetString(await clientResult.Content.ReadAsByteArrayAsync(), 0, raw_response.Length);
                    if (result.IndexOf("10000", System.StringComparison.Ordinal) > 0)
                    {
                        logInfo.Info("获取报价回调成功" + str);
                    }
                    else
                    {
                        logInfo.Info("获取报价回调失败" + str);
                    }
                }
            }
        }
コード例 #23
0
ファイル: CategoryController.cs プロジェクト: hzl091/BrnShop
        public ActionResult EditCategory(CategoryModel model, int cateId = -1)
        {
            CategoryInfo categoryInfo = AdminCategories.GetCategoryById(cateId);

            if (categoryInfo == null)
            {
                return(PromptView("此分类不存在"));
            }

            int cateId2 = AdminCategories.GetCateIdByName(model.CategroyName);

            if (cateId2 > 0 && cateId2 != cateId)
            {
                ModelState.AddModelError("CategroyName", "名称已经存在");
            }

            if (model.ParentCateId == categoryInfo.CateId)
            {
                ModelState.AddModelError("ParentCateId", "不能将自己作为父分类");
            }

            if (model.ParentCateId != 0 && AdminCategories.GetCategoryById(model.ParentCateId) == null)
            {
                ModelState.AddModelError("ParentCateId", "父分类不存在");
            }

            if (model.ParentCateId != 0 && AdminCategories.GetChildCategoryList(categoryInfo.CateId, categoryInfo.Layer, true).Exists(x => x.CateId == model.ParentCateId))
            {
                ModelState.AddModelError("ParentCateId", "不能将分类调整到自己的子分类下");
            }

            if (ModelState.IsValid)
            {
                int oldParentId = categoryInfo.ParentId;

                categoryInfo.DisplayOrder = model.DisplayOrder;
                categoryInfo.Name         = model.CategroyName;
                categoryInfo.ParentId     = model.ParentCateId;
                categoryInfo.PriceRange   = CommonHelper.StringArrayToString(CommonHelper.RemoveArrayItem(StringHelper.SplitString(CommonHelper.TBBRTrim(model.PriceRange).Replace(",", ","))));

                AdminCategories.UpdateCategory(categoryInfo, oldParentId);
                AddMallAdminLog("修改分类", "修改分类,分类ID为:" + cateId);
                return(PromptView("商品修改成功"));
            }

            Load();
            return(View(model));
        }
コード例 #24
0
 public virtual string MapPath(string path)
 {
     return(CommonHelper.MapPath(path, false));
 }
コード例 #25
0
ファイル: CategoryController.cs プロジェクト: hzl091/BrnShop
        public ActionResult AddCategory(CategoryModel model)
        {
            if (AdminCategories.GetCateIdByName(model.CategroyName) > 0)
            {
                ModelState.AddModelError("CategroyName", "名称已经存在");
            }

            if (model.ParentCateId != 0 && AdminCategories.GetCategoryById(model.ParentCateId) == null)
            {
                ModelState.AddModelError("ParentCateId", "父分类不存在");
            }

            if (ModelState.IsValid)
            {
                CategoryInfo categoryInfo = new CategoryInfo()
                {
                    DisplayOrder = model.DisplayOrder,
                    Name         = model.CategroyName,
                    ParentId     = model.ParentCateId,
                    PriceRange   = CommonHelper.StringArrayToString(CommonHelper.RemoveArrayItem(StringHelper.SplitString(CommonHelper.TBBRTrim(model.PriceRange).Replace(",", ","))))
                };

                AdminCategories.CreateCategory(categoryInfo);
                AddMallAdminLog("添加分类", "添加分类,分类为:" + model.CategroyName);
                return(PromptView("分类添加成功"));
            }

            Load();
            return(View(model));
        }
コード例 #26
0
ファイル: SonyMusic.cs プロジェクト: zry980321/YaVipCore
        private static List <SongResult> SearchAlbum(string id)
        {
            var text = "albumId=" + id;
            var url  = "http://api.sonyselect.com.cn/albumDetail/v1/android/?sign=" + GetDes3EncryptedText(text);
            var data =
                "{\"content\":{\"albumId\":\"" + id + "\"},\"header\":{\"sdkNo\":\"4.2.2\",\"model\":\"X9Plus\",\"manufacturer\":\"vivo\",\"imei\":\"133524532901500\"}}";
            var html = CommonHelper.PostData(url, new Dictionary <string, string> {
                { "JSON", data }
            }, 1);

            if (string.IsNullOrEmpty(html))
            {
                return(null);
            }
            var json = JObject.Parse(html);

            if (json["content"]["album"]["musicNum"].Value <int>() <= 0)
            {
                return(null);
            }
            var datas = json["content"]["album"]["tracks"];
            var list  = new List <SongResult>();
            var ar    = json["content"]["album"]["aritst"].ToString();
            var arId  = json["content"]["album"]["artistId"].ToString();
            var an    = json["content"]["album"]["name"].ToString();
            var sm    = json["content"]["album"]["smallIcon"].ToString();
            var lg    = json["content"]["album"]["largeIcon"].ToString();
            var index = 0;

            foreach (JToken j in datas)
            {
                index++;
                var song = new SongResult
                {
                    SongId      = j["id"].ToString(),
                    SongName    = j["name"].ToString(),
                    SongSubName = "",
                    SongLink    = "",

                    ArtistId      = arId,
                    ArtistName    = ar,
                    ArtistSubName = "",

                    AlbumId      = id,
                    AlbumName    = an,
                    AlbumSubName = "",
                    AlbumArtist  = ar,

                    Length  = CommonHelper.TimeToNum(j["duration"].ToString()),
                    BitRate = "无损",

                    FlacUrl = "",
                    ApeUrl  = "",
                    WavUrl  = "",
                    SqUrl   = "",
                    HqUrl   = "",
                    LqUrl   = "",
                    CopyUrl = "",

                    SmallPic = sm,
                    PicUrl   = lg,

                    LrcUrl = "",
                    TrcUrl = "",
                    KrcUrl = "",

                    MvId    = "",
                    MvHdUrl = "",
                    MvLdUrl = "",

                    Language = "",
                    Company  = "",
                    Year     = j["createTime"]?.ToString(),
                    Disc     = 1,
                    TrackNum = index,
                    Type     = "sn"
                };
                if (j["auditionUrl"] != null)
                {
                    var link = j["auditionUrl"].ToString();
                    song.LqUrl = song.HqUrl = song.SqUrl = song.CopyUrl = link;
                    link       = link.Replace("/Audition/", "/Audio/").Replace(".mp3", "");
                    if (j["downloadUrl"] != null)
                    {
                        if (j["downloadUrl"].ToString().StartsWith("http"))
                        {
                            link = j["downloadUrl"].ToString();
                        }
                    }
                    if (link.Contains(".flac"))
                    {
                        song.FlacUrl = link;
                    }
                    else if (link.Contains(".ape"))
                    {
                        song.ApeUrl = link;
                    }
                    else
                    {
                        song.WavUrl = link;
                    }
                }
                list.Add(song);
            }
            return(list);
        }
コード例 #27
0
        public ActionResult Put(CommentInputDto dto)
        {
            if (Regex.Match(dto.Content, CommonHelper.BanRegex).Length > 0)
            {
                return(ResultData(null, false, "您提交的内容包含敏感词,被禁止发表,请检查您的内容后尝试重新提交!"));
            }

            Post post = PostService.GetById(dto.PostId);

            if (post is null)
            {
                return(ResultData(null, false, "评论失败,文章不存在!"));
            }

            if (post.DisableComment)
            {
                return(ResultData(null, false, "本文已禁用评论功能,不允许任何人回复!"));
            }

            dto.Content = dto.Content.Trim().Replace("<p><br></p>", string.Empty);
            if (dto.Content.RemoveHtmlTag().Trim().Equals(HttpContext.Session.Get <string>("comment" + dto.PostId)))
            {
                return(ResultData(null, false, "您刚才已经在这篇文章发表过一次评论了,换一篇文章吧,或者换一下评论内容吧!"));
            }

            var comment = dto.Mapper <Comment>();

            if (Regex.Match(dto.Content, CommonHelper.ModRegex).Length <= 0)
            {
                comment.Status = Status.Pended;
            }

            comment.CommentDate = DateTime.Now;
            var user = HttpContext.Session.Get <UserInfoOutputDto>(SessionKey.UserInfo);

            if (user != null)
            {
                comment.NickName   = user.NickName;
                comment.QQorWechat = user.QQorWechat;
                comment.Email      = user.Email;
                if (user.IsAdmin)
                {
                    comment.Status   = Status.Pended;
                    comment.IsMaster = true;
                }
            }
            comment.Content  = dto.Content.HtmlSantinizerStandard().ClearImgAttributes();
            comment.Browser  = dto.Browser ?? Request.Headers[HeaderNames.UserAgent];
            comment.IP       = HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString();
            comment.Location = comment.IP.GetIPLocation().Split("|").Where(s => !int.TryParse(s, out _)).ToHashSet().Join("|");
            comment          = CommentService.AddEntitySaved(comment);
            if (comment == null)
            {
                return(ResultData(null, false, "评论失败"));
            }

            HttpContext.Session.Set("comment" + comment.PostId, comment.Content.RemoveHtmlTag().Trim());
            var emails = new HashSet <string>();
            var email  = CommonHelper.SystemSettings["ReceiveEmail"]; //站长邮箱

            emails.Add(email);
            var content = System.IO.File.ReadAllText(HostEnvironment.WebRootPath + "/template/notify.html")
                          .Replace("{{title}}", post.Title)
                          .Replace("{{time}}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                          .Replace("{{nickname}}", comment.NickName)
                          .Replace("{{content}}", comment.Content);

            if (comment.Status == Status.Pended)
            {
                if (!comment.IsMaster)
                {
                    MessageService.AddEntitySaved(new InternalMessage()
                    {
                        Title   = $"来自【{comment.NickName}】的新文章评论",
                        Content = comment.Content,
                        Link    = Url.Action("Details", "Post", new { id = comment.PostId, cid = comment.Id }, Request.Scheme) + "#comment"
                    });
                }
#if !DEBUG
                if (comment.ParentId == 0)
                {
                    emails.Add(post.Email);
                    emails.Add(post.ModifierEmail);
                    //新评论,只通知博主和楼主
                    foreach (var s in emails)
                    {
                        BackgroundJob.Enqueue(() => CommonHelper.SendMail(CommonHelper.SystemSettings["Domain"] + "|博客文章新评论:", content.Replace("{{link}}", Url.Action("Details", "Post", new { id = comment.PostId, cid = comment.Id }, Request.Scheme) + "#comment"), s));
                    }
                }
                else
                {
                    //通知博主和上层所有关联的评论访客
                    var pid = CommentService.GetParentCommentIdByChildId(comment.Id);
                    emails.AddRange(CommentService.GetSelfAndAllChildrenCommentsByParentId(pid).Select(c => c.Email).ToArray());
                    emails.AddRange(post.Email, post.ModifierEmail);
                    emails.Remove(comment.Email);
                    string link = Url.Action("Details", "Post", new { id = comment.PostId, cid = comment.Id }, Request.Scheme) + "#comment";
                    foreach (var s in emails)
                    {
                        BackgroundJob.Enqueue(() => CommonHelper.SendMail($"{CommonHelper.SystemSettings["Domain"]}{CommonHelper.SystemSettings["Title"]}文章评论回复:", content.Replace("{{link}}", link), s));
                    }
                }
#endif
                return(ResultData(null, true, "评论发表成功,服务器正在后台处理中,这会有一定的延迟,稍后将显示到评论列表中"));
            }

            foreach (var s in emails)
            {
                BackgroundJob.Enqueue(() => CommonHelper.SendMail(CommonHelper.SystemSettings["Domain"] + "|博客文章新评论(待审核):", content.Replace("{{link}}", Url.Action("Details", "Post", new { id = comment.PostId, cid = comment.Id }, Request.Scheme) + "#comment") + "<p style='color:red;'>(待审核)</p>", s));
            }

            return(ResultData(null, true, "评论成功,待站长审核通过以后将显示"));
        }
コード例 #28
0
        private async void GetNoticeList(List <RequestParameter> param)
        {
            try
            {
                _commonFun.ShowLoading("查询中...");
                string fromDate      = param.Find(p => p.Name == "StartDate").Value.Replace("-", "");
                string toDate        = param.Find(p => p.Name == "EndDate").Value.Replace("-", "");
                string noticeReaders = param.Find(p => p.Name == "NoticeReaders").Value;
                string status        = param.Find(p => p.Name == "StatusSelectIndex").Value;
                string needReply     = param.Find(p => p.Name == "ReplySelected").Value;
                string title         = param.Find(p => p.Name == "NoticeTitle").Value;
                string noticeNo      = param.Find(p => p.Name == "NoticeNo").Value;
                string inUserId      = CommonContext.Account.UserId;
                //TO-DO
                var result = await _noticeMngService.SearchMadeNotifiList(fromDate,
                                                                          toDate,
                                                                          noticeReaders,
                                                                          status,
                                                                          needReply,
                                                                          title,
                                                                          noticeNo,
                                                                          inUserId);

                if (result.ResultCode == Module.ResultType.Success)
                {
                    List <NoticeListInfoDto> noticeList = CommonHelper.DecodeString <List <NoticeListInfoDto> >(result.Body);
                    if (noticeList != null && noticeList.Count > 0)
                    {
                        _commonFun.HideLoading();
                        NoticeList = noticeList;
                    }
                    else
                    {
                        _commonFun.HideLoading();
                        NoticeList = new List <NoticeListInfoDto>();
                        _commonFun.ShowToast("没有数据");
                    }
                }
                else
                {
                    _commonFun.HideLoading();
                    NoticeList = new List <NoticeListInfoDto>();
                    _commonFun.AlertLongText("查询失败,请重试。 " + result.Msg);
                }
            }
            catch (OperationCanceledException)
            {
                _commonFun.HideLoading();
                NoticeList = new List <NoticeListInfoDto>();
                _commonFun.AlertLongText("请求超时。");
            }
            catch (Exception)
            {
                _commonFun.HideLoading();
                NoticeList = new List <NoticeListInfoDto>();
                _commonFun.AlertLongText("查询异常,请重试。");
            }
            finally
            {
                _commonFun.HideLoading();
            }
        }
コード例 #29
0
ファイル: KryptonLabel.cs プロジェクト: yp25/Krypton
 /// <summary>
 /// Update the view elements based on the requested label style.
 /// </summary>
 /// <param name="style">New label style.</param>
 protected virtual void SetLabelStyle(LabelStyle style)
 {
     _paletteCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style);
 }
コード例 #30
0
        /// <summary>
        /// 用户列表
        /// </summary>
        /// <param name="pagination">分页参数</param>
        /// <param name="queryJson">查询参数</param>
        /// <returns>返回分页列表Json</returns>
        //[HandlerMonitor(3, "分页查询用户信息!")]
        // DateTime? planeStart, DateTime? planeEnd, string state, string evaluationState, string space, Pagination pagination, bool ispage
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            var      watch           = CommonHelper.TimerStart();
            var      queryParam      = queryJson.ToJObject();
            DateTime?planeStart      = null;
            DateTime?planeEnd        = null;
            var      state           = "";
            var      evaluationState = "";
            var      deptId          = "";

            if (queryJson != null)
            {
                if (!string.IsNullOrEmpty(queryParam["planeStart"].ToString()))
                {
                    planeStart = Convert.ToDateTime(queryParam["planeStart"].ToString());
                }
                if (!string.IsNullOrEmpty(queryParam["planeEnd"].ToString()))
                {
                    planeEnd = Convert.ToDateTime(queryParam["planeEnd"].ToString());
                }

                deptId          = queryParam["deptId"].ToString();
                state           = queryParam["state"].ToString();
                evaluationState = queryParam["evaluationState"].ToString();
            }
            var data = ebll.getList(planeStart, planeEnd, state, evaluationState, "", pagination, true, deptId, false);

            foreach (var item in data)
            {
                if (item.planeStartDate != null && item.planeEndDate != null)
                {
                    item.planeTime = Convert.ToDateTime(item.planeStartDate).ToString("yyyy-MM-dd") + "-" + Convert.ToDateTime(item.planeEndDate).ToString("yyyy-MM-dd");
                }
                else
                {
                    item.planeTime = null;
                }
                if (item.state == "未提交")
                {
                    item.ModifyDate = null;
                }
                if (string.IsNullOrEmpty(item.evaluation))
                {
                    item.evaluationState = "未评价";
                }
                else
                {
                    item.evaluationState = "已评价";
                }
            }

            var JsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
コード例 #31
0
        /// <summary>Get all items owned by the player.</summary>
        /// <remarks>Derived from <see cref="Utility.doesItemWithThisIndexExistAnywhere"/>, with extra logic for hay.</remarks>
        public IEnumerable <Item> GetAllOwnedItems()
        {
            List <Item> items = new List <Item>();

            // inventory
            items.AddRange(Game1.player.Items);

            // in locations
            foreach (GameLocation location in CommonHelper.GetLocations())
            {
                // map objects
                foreach (SObject item in location.objects.Values)
                {
                    // chest
                    if (item is Chest chest)
                    {
                        if (chest.playerChest.Value)
                        {
                            items.Add(chest);
                            items.AddRange(chest.items);
                        }
                    }

                    // auto-grabber
                    else if (item.ParentSheetIndex == 165 && item.heldObject.Value is Chest grabberChest)
                    {
                        items.Add(item);
                        items.AddRange(grabberChest.items);
                    }

                    // cask
                    else if (item is Cask)
                    {
                        items.Add(item);
                        items.Add(item.heldObject.Value); // cask contents can be retrieved anytime
                    }

                    // craftable
                    else if (item.bigCraftable.Value)
                    {
                        items.Add(item);
                        if (item.MinutesUntilReady == 0)
                        {
                            items.Add(item.heldObject.Value);
                        }
                    }

                    // anything else
                    else if (!item.IsSpawnedObject)
                    {
                        items.Add(item);
                        items.Add(item.heldObject.Value);
                    }
                }

                // furniture
                if (location is DecoratableLocation decorableLocation)
                {
                    foreach (Furniture furniture in decorableLocation.furniture)
                    {
                        items.Add(furniture);
                        items.Add(furniture.heldObject.Value);
                    }
                }

                // building output
                if (location is Farm farm)
                {
                    foreach (var building in farm.buildings)
                    {
                        if (building is Mill mill)
                        {
                            items.AddRange(mill.output.Value.items);
                        }
                        else if (building is JunimoHut hut)
                        {
                            items.AddRange(hut.output.Value.items);
                        }
                    }
                }

                // farmhouse fridge
                if (location is FarmHouse house)
                {
                    items.AddRange(house.fridge.Value.items);
                }
            }

            // hay in silos
            int hayCount = Game1.getFarm()?.piecesOfHay.Value ?? 0;

            while (hayCount > 0)
            {
                SObject hay = new SObject(178, 1);
                hay.Stack = Math.Min(hayCount, hay.maximumStackSize());
                hayCount -= hay.Stack;
                items.Add(hay);
            }

            return(items.Where(p => p != null));
        }
コード例 #32
0
 /****
 ** UI
 ****/
 /// <summary>Draw a pretty hover box for the given text.</summary>
 /// <param name="spriteBatch">The sprite batch being drawn.</param>
 /// <param name="label">The text to display.</param>
 /// <param name="position">The position at which to draw the text.</param>
 /// <param name="wrapWidth">The maximum width to display.</param>
 public Vector2 DrawHoverBox(SpriteBatch spriteBatch, string label, Vector2 position, float wrapWidth)
 {
     return(CommonHelper.DrawHoverBox(spriteBatch, label, position, wrapWidth));
 }
コード例 #33
0
        public ActionResult Index(QRCModel ObjQRCModel)
        {
            DARModel            objDAR;
            long                Totalrecords           = 0;
            eTracLoginModel     ObjLoginModel          = new eTracLoginModel();
            LocationMasterModel objLocationMasterModel = null;

            try
            {
                //if (ModelState.IsValid)
                if (true)
                {
                    #region login model
                    ////
                    if (Session["eTrac"] != null)
                    {
                        ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);

                        // ObjQRCModel.UserModel.ProjectID = (ObjLoginModel != null && ObjLoginModel.LocationID > 0) ? (ObjLoginModel.LocationID) : 0;
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Login"));
                    }
                    ///
                    #endregion login model

                    long          _qRCId = 0;
                    Result        _fnResult, result;
                    PrintQRCModel ObjPrintQRCModel;
                    CommonHelper  ObjCommonHelper = new CommonHelper();
                    string        QRCImageName    = string.Empty;
                    //string msg;
                    if (Session["ImageName"] != null)
                    {
                        ObjQRCModel.UserModel.myProfileImage = Convert.ToString(Session["ImageName"]);
                    }

                    if (ObjQRCModel.WarrantyDocument != null)
                    {
                        ObjQRCModel.WarrantyDoc = DateTime.Now.Ticks + "_" + ObjQRCModel.WarrantyDocument.FileName.Replace(" ", "");
                    }
                    if (ObjQRCModel.LOCPicture != null)
                    {
                        ObjQRCModel.LocationPicture = DateTime.Now.Ticks + "_" + ObjQRCModel.LOCPicture.FileName.Replace(" ", "");
                    }
                    if (ObjQRCModel.AssetPictureUrl != null)
                    {
                        ObjQRCModel.AssetPicture = DateTime.Now.Ticks + "_" + ObjQRCModel.AssetPictureUrl.FileName.Replace(" ", "");
                    }

                    ObjQRCModel.CreatedBy  = ObjLoginModel.UserId;
                    ObjQRCModel.LocationId = ObjLoginModel.LocationID;

                    objDAR            = new DARModel();
                    objDAR.LocationId = ObjLoginModel.LocationID;
                    objDAR.UserId     = ObjLoginModel.UserId;
                    objDAR.CreatedBy  = ObjLoginModel.UserId;
                    objDAR.CreatedOn  = DateTime.UtcNow;

                    //Added by Bhushan on 26/Oct/2016 for client has changed request for If QRC is vehicle then directly set vehicle type is Motor Vehicle and for Shuttle Bus  set vehicle type is Shuttle Bus
                    if (ObjQRCModel.QRCTYPE == Convert.ToInt64(QrcType.Vehicle))
                    {
                        ObjQRCModel.VehicleType = Convert.ToInt64(VEHICLETYPE.MotorVehicle);
                    }
                    if (ObjQRCModel.QRCTYPE == Convert.ToInt64(QrcType.ShuttleBus))
                    {
                        ObjQRCModel.VehicleType = Convert.ToInt64(VEHICLETYPE.ShuttleBus);
                    }

                    if (_IQRCSetup.ProcessQRCSetup(ObjQRCModel, out _qRCId, out _fnResult, out ObjPrintQRCModel))
                    {
                        path = Server.MapPath(path);

                        if (ObjQRCModel.WarrantyDocument != null)
                        {
                            ObjCommonHelper.UploadImage(ObjQRCModel.WarrantyDocument, path, ObjQRCModel.WarrantyDoc);
                        }
                        if (ObjQRCModel.LOCPicture != null)
                        {
                            ObjCommonHelper.UploadImage(ObjQRCModel.LOCPicture, path, ObjQRCModel.LocationPicture);
                        }
                        if (ObjQRCModel.AssetPictureUrl != null)
                        {
                            ObjCommonHelper.UploadImage(ObjQRCModel.AssetPictureUrl, path, ObjQRCModel.AssetPicture);
                        }

                        if (_fnResult == Result.Completed)
                        {
                            // Code for to get path of root directory and attach path of directory to store image

                            string RootDirectory = ConfigurationManager.AppSettings["QRCImage"];
                            RootDirectory = Server.MapPath(RootDirectory);
                            if (ObjQRCModel.QRCImageBase64 != null)
                            {
                                ObjQRCModel.QRCImageBase64 = ObjQRCModel.QRCImageBase64.Split(',')[1];
                                ObjCommonHelper.UploadQRCImage(ObjQRCModel.QRCImageBase64, RootDirectory, ObjQRCModel.QRCImage);
                            }

                            objDAR.ActivityDetails = DarMessage.SaveQRC(ObjPrintQRCModel.QRCName, ObjLoginModel.Location);
                            objDAR.TaskType        = (long)TaskTypeCategory.QRCCreation;

                            ViewBag.Message           = CommonMessage.SaveSuccessMessage();
                            ViewBag.AlertMessageClass = ObjAlertMessageClass.Success;
                            ModelState.Clear();
                            ObjQRCModel = QRCInIt();
                        }
                        else if (_fnResult == Result.UpdatedSuccessfully)
                        {
                            objDAR.ActivityDetails = DarMessage.UpdateQRC(ObjPrintQRCModel.QRCName, ObjLoginModel.Location);
                            objDAR.TaskType        = (long)TaskTypeCategory.QRCUpdate;

                            ViewBag.Message           = CommonMessage.UpdateSuccessMessage();
                            ViewBag.AlertMessageClass = ObjAlertMessageClass.Success;
                            ModelState.Clear();
                            ObjQRCModel = QRCInIt();
                        }
                        else if (_fnResult == Result.Failed)
                        {
                            ViewBag.Message           = CommonMessage.FailureMessage();
                            ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;
                            // store the failure message in tempdata to display in view.
                        }

                        #region Save DAR
                        result = _ICommonMethod.SaveDAR(objDAR);
                        #endregion Save DAR
                    }
                    else
                    {
                        ViewBag.Message           = CommonMessage.DuplicateRecordMessage();
                        ViewBag.AlertMessageClass = ObjAlertMessageClass.Info;
                        // store the failure message in tempdata to display in view.
                    }
                    //ViewBag.EncryptQRC = Cryptography.GetEncryptedData(QRCDetail.QRCId.ToString(), true);

                    //ViewBag.EncryptQRC = Cryptography.GetEncryptedData(_qRCId.ToString(), true);

                    ViewBag.QRCName     = ObjQRCModel.QRCName;
                    ViewBag.SpecialNote = ObjQRCModel.SpecialNotes;

                    //ViewBag.QRCSize = QRCDetail.DefaultSize;

                    /*
                     *                  ObjPrintQRCModel = new PrintQRCModel();
                     *
                     *
                     *                  /// pull details from ObjQRCModel and plug into ObjPrintQRCModel
                     *                  ObjPrintQRCModel.QRCId = ObjQRCModel.QRCId;
                     *
                     *                  ObjPrintQRCModel.QRCName = ObjQRCModel.QRCName;
                     *                  ObjPrintQRCModel.SpecialNotes = ObjQRCModel.SpecialNotes;
                     *                  ObjPrintQRCModel.QRCTYPE = ObjQRCModel.QRCTYPECaption;
                     *                  ObjPrintQRCModel.VehicleType = ObjQRCModel.VehicleTypeCaption;
                     *                  ObjPrintQRCModel.MotorType = ObjQRCModel.MotorTypeCaption;
                     */


                    /// pull details from ObjQRCModel and plug into ObjPrintQRCModel End

                    ObjPrintQRCModel.QRCSize    = _ICommonMethod.GetGlobalCodeData("QRCSIZE");
                    ObjPrintQRCModel.EncryptQRC = Cryptography.GetEncryptedData(ObjPrintQRCModel.QRCId.ToString(), true);

                    ObjPrintQRCModel.CompanyLogo  = (ObjLoginModel != null && !string.IsNullOrEmpty(ObjLoginModel.LocationLogo)) ? (ObjLoginModel.LocationLogo) : "/";
                    ObjPrintQRCModel.CompanyImage = (ObjLoginModel != null && !string.IsNullOrEmpty(ObjLoginModel.LocationImage)) ? (ObjLoginModel.LocationImage) : "/";
                    ObjPrintQRCModel.CompanyName  = (ObjLoginModel != null && !string.IsNullOrEmpty(ObjLoginModel.Location)) ? (ObjLoginModel.Location) : "/";

                    objLocationMasterModel    = _IGlobalAdmin.GetLocationById(ObjPrintQRCModel.LocationId);
                    ObjPrintQRCModel.Location = objLocationMasterModel.LocationName;

                    //ViewBag.EncryptQRC = ObjPrintQRCModel.EncryptQRC;
                    ViewBag.EncryptQRC     = ObjPrintQRCModel.QRCIDCode;
                    ViewBag.LastEncryptQRC = ObjPrintQRCModel.QRCIDCode;// + ',' + ObjPrintQRCModel.QRCTYPEID;//This field added by Bhushan Dod  //After comma we don't need type of QRC.We need to comment .
                    ViewBag.QRCSize        = ObjPrintQRCModel.QRCSize;

                    //PrintQRCModel ObjPrintQRCModel;
                    ViewBag.QRCModel = ObjPrintQRCModel;
                }
                else
                {
                    var    errors   = ModelState.Values.SelectMany(v => v.Errors);
                    string _message = "";
                    foreach (var items in errors)
                    {
                        _message = _message + items.ErrorMessage;
                    }
                    ViewBag.Message = _message;
                    ObjQRCModel     = _IQRCSetup.GetGlobalCodeForCategories();
                }
            }
            catch (Exception ex)
            {
                WorkOrderEMS.BusinessLogic.Exception_B.Exception_B.exceptionHandel_Runtime(ex, "Exception For File Upload", path.ToString(), null);
                ViewBag.Message           = ex.Message;
                ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;
                ObjQRCModel       = _IQRCSetup.GetGlobalCodeForCategories();
                ViewBag.Country   = _ICommonMethod.GetAllcountries();
                ViewBag.PurchType = _ICommonMethod.GetGlobalCodeDataList("PURCHASETYPE");
                return(View(ObjQRCModel));
            }
            ObjQRCModel     = _IQRCSetup.GetGlobalCodeForCategories();
            ViewBag.Country = _ICommonMethod.GetAllcountries();
            // ViewBag.PurchType = _ICommonMethod.GetGlobalCodeDataList("PURCHASETYPE");
            ViewBag.PurchType   = _ICommonMethod.GetGlobalCodeDataList("PURCHASETYPE");
            ViewBag.RefreshMode = true;
            //ViewBag.EncryptLastQRC = data.EncryptLastQRC;
            //ViewBag.EncryptLastQRC = ObjQRCModel.EncryptLastQRC + "," + (string.IsNullOrEmpty(objLocationMasterModel.Address2) ? ObjLoginModel.Location.ToString().Substring(0, 3).ToUpper() : objLocationMasterModel.Address2.ToString().Substring(0, 3).ToUpper());
            //ViewBag.ItemAbberivationList = Convert.ToString(ConfigurationManager.AppSettings["ItemAbberivationList"]);

            //if (ObjLoginModel != null && (ObjLoginModel.UserRoleId == Convert.ToInt64(UserType.GlobalAdmin) || ObjLoginModel.UserRoleId == Convert.ToInt64(UserType.ITAdministrator)))
            //{
            //    //ViewBag.ManagerList = _IGlobalAdmin.GetAllITAdministratorList(0, 1, 1000, "UserEmail", "asc", "", Convert.ToInt64(UserType.Manager), out Totalrecords);
            //    ViewBag.LocationList = _IGlobalAdmin.GetAllLocationNew();
            //    ViewBag.AdministratorList = _IGlobalAdmin.GetAllITAdministratorList(0, 0, 1, 1000, "UserEmail", "asc", "", Convert.ToInt64(UserType.Administrator), out Totalrecords);
            //}
            //else if (ObjLoginModel != null && (ObjLoginModel.UserRoleId == Convert.ToInt64(UserType.Administrator)))
            //{
            //    ViewBag.LocationList = _IGlobalAdmin.GetAllLocationNew();
            //    //ViewBag.AdministratorList = _IGlobalAdmin.GetAllITAdministratorList(0, 1, 1000, "UserEmail", "asc", "", Convert.ToInt64(UserType.Manager), out Totalrecords);
            //    ViewBag.AdministratorList = _ICommonMethod.GetManagersBYLocationId(ObjLoginModel.LocationID);
            //}

            return(View(ObjQRCModel));
            // return RedirectToAction("Index","QRCSetup");
        }