/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { try { var member = new LHCustomerLink { FCode = txtFCode.Text.Trim(), FName = tbxFCustomer.Text.Trim(), FAddress = txtFAddress.Text.Trim(), FLinkman = txtFLinkman.Text.Trim(), FPhome = txtFPhome.Text.Trim(), FMoile = txtFMoile.Text.Trim(), FMemo = txtFMemo.Text.Trim(), FSpell = ChineseSpell.MakeSpellCode(tbxFCustomer.Text.Trim(), "", SpellOptions.FirstLetterOnly).ToUpper(), FCompanyId = CurrentUser.AccountComId, FCity = txtFCity.Text.Trim(), FZip = txtFZip.Text.Trim(), }; return(CustomerLinkService.Add(member)); } catch (Exception ex) { throw; } }
/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { if (ProductItem != null) { ProductItem.FName = txtFName.Text.Trim(); //助记码 ProductItem.FSpell = ChineseSpell.MakeSpellCode(txtFName.Text.Trim(), "", SpellOptions.FirstLetterOnly).ToUpper(); ProductItem.FGroupNum = txtFGroupNum.Text.Trim(); ProductItem.FSpec = txtFSpec.Text.Trim(); ProductItem.FUnit = ddlUnit.SelectedValue.Trim(); ProductItem.FPurchasePrice = Convert.ToDecimal(txtFPurchasePrice.Text.Trim()); ProductItem.FSalesPrice = Convert.ToDecimal(txtFSalesPrice.Text.Trim()); ProductItem.FMemo = txtFMemo.Text.Trim();//备注 // ProductItem.FCompanyId = CurrentUser.AccountComId; ProductItem.FGroupNum = txtFGroupNum.Text.Trim(); ProductItem.FPieceWork1 = Convert.ToDecimal(txtFPieceWork1.Text.Trim()); ProductItem.FPieceWork2 = Convert.ToDecimal(txtFPieceWork2.Text.Trim()); ProductItem.FPieceWork3 = Convert.ToDecimal(txtFPieceWork3.Text.Trim()); ProductItem.FPieceWork4 = Convert.ToDecimal(txtFPieceWork4.Text.Trim()); ProductItem.FPieceWork5 = Convert.ToDecimal(txtFPieceWork5.Text.Trim()); ProductItem.FNetWeight = Convert.ToDecimal(txtFNetWeight.Text.Trim());//重量 ProductItem.FRack = txtFRack.Text; return(ItemsService.SaveChanges() >= 0); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var its = new LHItems { FCode = txtFCode.Text.Trim(), FName = txtFName.Text.Trim(), FSpec = txtFSpec.Text.Trim(), FSpell = ChineseSpell.MakeSpellCode(txtFName.Text.Trim(), "", SpellOptions.FirstLetterOnly).ToUpper(), FFlag = 1, //分类 FCateId = "2001", FSubCateId = ProjectItem.FId, FCompanyId = CurrentUser.AccountComId, FGroupNum = txtFGroupNum.Text, FMemo = txtFMemo.Text.Trim(), FRack = txtFRack.Text.Trim(), //单位 FUnit = ddlUnit.SelectedValue, FPurchasePrice = Convert.ToDecimal(txtFPurchasePrice.Text.Trim()), FSalesPrice = Convert.ToDecimal(txtFSalesPrice.Text.Trim()), FPieceWork1 = Convert.ToDecimal(txtFPieceWork1.Text.Trim()), FPieceWork2 = Convert.ToDecimal(txtFPieceWork2.Text.Trim()), FPieceWork3 = Convert.ToDecimal(txtFPieceWork3.Text.Trim()), FPieceWork4 = Convert.ToDecimal(txtFPieceWork4.Text.Trim()), FPieceWork5 = Convert.ToDecimal(txtFPieceWork5.Text.Trim()), FNetWeight = Convert.ToDecimal(txtFNetWeight.Text.Trim()),//重量 }; return(ItemsService.Add(its)); }
/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { if (ProductItem != null) { ProductItem.FName = txtFName.Text.Trim(); //助记码 ProductItem.FSpell = ChineseSpell.MakeSpellCode(txtFName.Text.Trim(), "", SpellOptions.FirstLetterOnly).ToUpper(); ProductItem.FSpec = txtFSpec.Text.Trim(); ProductItem.FUnit = ddlUnit.SelectedValue.Trim(); ProductItem.FQty = Convert.ToDecimal(txtFQty.Text.Trim()); ProductItem.FMemo = txtFMemo.Text.Trim();//备注 ProductItem.FCompanyId = CurrentUser.AccountComId; ProductItem.FFlag = 0; ProductItem.FInstallDate = txtFInstallDate.SelectedDate; ProjectItem.FFlag = 1; ProductItem.FParms = txtFParms.Text; ProductItem.FPurchaseDate = txtFPurchaseDate.SelectedDate; ProductItem.FStatus = Convert.ToInt32(ddlStatus.SelectedValue); ProductItem.FUser = txtFUser.Text; //产品分类 ProductItem.FCateId = ProjectItem.FSParent; ProductItem.FSubCateId = ProjectItem.FId; return(DeviceService.SaveChanges() >= 0); } return(false); }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { var errorRow = -1; try { using (var ts = new TransactionScope()) { var data = ViewState["dtData"] as DataTable; if (data == null) { return; } var stringBuilder = new StringBuilder(); for (int i = 0; i < data.Rows.Count; i++) { errorRow = i + 1; var item = new LHItems { FCode = data.Rows[i]["商品代码"].ToString(), FName = data.Rows[i]["商品名称"].ToString(), FSpec = data.Rows[i]["规格"].ToString(), FSpell = ChineseSpell.MakeSpellCode(data.Rows[i]["商品名称"].ToString(), "", SpellOptions.FirstLetterOnly).ToUpper(), //设置默认组号 FGroupNum = data.Rows[i]["商品代码"].ToString(), FUnit = data.Rows[i]["计量单位"].ToString(), FCateId = "2002", FSubCateId = "2002", FPurchasePrice = Convert.ToDecimal(data.Rows[i]["采购单价"]), FSalesPrice = Convert.ToDecimal(data.Rows[i]["发货单价"]), FMemo = data.Rows[i]["摘要"].ToString(), FCompanyId = CurrentUser.AccountComId, FFlag = 1 }; ItemsService.AddEntity(item); //ItemsService.Add(item); } //写入数据库 ItemsService.SaveChanges(); ts.Complete(); Alert.Show("引入完成。", MessageBoxIcon.Information); } } catch (Exception ex) { Alert.Show(string.Format(@"引入失败,请排查模版内容是否完善,出错定位行:{0} ", errorRow), MessageBoxIcon.Information); } }
/// <summary> /// 获取拼写别名 /// </summary> public void GetSpellWord_POST() { string title = base.Request["word"].Trim(); string alias = ChineseSpell.GetSpellWord(title, SpellOptions.TranslateUnknowWordToInterrogation | SpellOptions.TranslateSpecialWordToConnect); base.Response.Write(alias); }
/// <summary> /// 获取拼写别名 /// </summary> public void GetSpellWord_POST() { var title = Request.Form("word").ToString().Trim(); var alias = ChineseSpell.GetSpellWord(title, SpellOptions.TranslateUnknowWordToInterrogation | SpellOptions.TranslateSpecialWordToConnect); Response.WriteAsync(alias); }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { // 提配错误行数 var errorRow = -1; try { using (var ts = new TransactionScope()) { var data = ViewState["dtData"] as DataTable; if (data == null) { return; } for (int i = 0; i < data.Rows.Count; i++) { errorRow = i + 1; var item = new LHSupplier { FCode = data.Rows[i]["供应商编码"].ToString(), FName = data.Rows[i]["供应商名称"].ToString(), FSpell = ChineseSpell.MakeSpellCode(data.Rows[i]["供应商名称"].ToString(), "", SpellOptions.FirstLetterOnly).ToUpper(), FLinkman = data.Rows[i]["联系人"].ToString(), FPhome = data.Rows[i]["电话"].ToString(), FMoile = data.Rows[i]["手机"].ToString(), FAddress = data.Rows[i]["地址"].ToString(), FFreight = Convert.ToDecimal(data.Rows[i]["运输服务费"]), //客户分类 FCateId = "2078", FSubCateId = "2078", FDate = DateTime.Now, FIsAllot = 0, FCompanyId = CurrentUser.AccountComId, FFlag = 1 }; SupplierService.AddEntity(item); } //写入数据库 SupplierService.SaveChanges(); ts.Complete(); Alert.Show("引入完成。", MessageBoxIcon.Information); } } catch (Exception ex) { Alert.Show(string.Format(@"引入失败,请排查模版内容是否完善,出错定位行:{0} ", errorRow), MessageBoxIcon.Information); } }
/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { if (ProductItem != null) { ProductItem.FName = txtFName.Text.Trim(); //助记码 ProductItem.FSpell = ChineseSpell.MakeSpellCode(txtFName.Text.Trim(), "", SpellOptions.FirstLetterOnly).ToUpper(); ProductItem.FGroupNum = txtFGroupNum.Text.Trim(); ProductItem.FSpec = txtFSpec.Text.Trim(); ProductItem.FUnit = ddlUnit.SelectedValue.Trim(); ProductItem.FPurchasePrice = Convert.ToDecimal(txtFPurchasePrice.Text.Trim()); ProductItem.FSalesPrice = Convert.ToDecimal(txtFSalesPrice.Text.Trim()); ProductItem.FMemo = txtFMemo.Text.Trim();//备注 ProductItem.FCompanyId = CurrentUser.AccountComId; ProductItem.FGroupNum = txtFGroupNum.Text.Trim(); ProductItem.FIsLiquid = ddlFIsLiquid.SelectedValue; ProductItem.FPieceWork1 = 0;//Convert.ToDecimal(txtFPieceWork.Text.Trim()); ProductItem.FQty = Convert.ToDecimal(txtFQty.Text.Trim()); ProductItem.FPieceWork1 = Convert.ToDecimal(txtFPieceWork1.Text.Trim()); ProductItem.FRack = txtFRack.Text; ProductItem.cinvdefine1 = txtcinvdefine1.Text.Trim(); // 包装物问题 if (!ddlBottleNum.SelectedValue.Equals("-1")) { var bottle = ItemsMapBottleService.Where(p => p.FCode == ProductItem.FCode && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (bottle != null) { bottle.FBottleCode = ddlBottleNum.SelectedValue; bottle.FCompanyId = CurrentUser.AccountComId; ItemsMapBottleService.SaveChanges(); } else { var bot = new LHItemsMapBottle { FCode = ProductItem.FCode, FCompanyId = CurrentUser.AccountComId, FBottleCode = ddlBottleNum.SelectedValue }; ItemsMapBottleService.Add(bot); } } return(ItemsService.SaveChanges() >= 0); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var its = new LHItems { FCode = txtFCode.Text.Trim(), FName = txtFName.Text.Trim(), FSpec = txtFSpec.Text.Trim(), FSpell = ChineseSpell.MakeSpellCode(txtFName.Text.Trim(), "", SpellOptions.FirstLetterOnly).ToUpper(), FFlag = 1, //分类 FCateId = "2000", FSubCateId = ProjectItem.FId, FCompanyId = CurrentUser.AccountComId, FGroupNum = txtFGroupNum.Text, FMemo = txtFMemo.Text.Trim(), FIsLiquid = ddlFIsLiquid.SelectedValue, FRack = txtFRack.Text.Trim(), //单位 FUnit = ddlUnit.SelectedValue, FPurchasePrice = Convert.ToDecimal(txtFPurchasePrice.Text.Trim()), FSalesPrice = Convert.ToDecimal(txtFSalesPrice.Text.Trim()), //FPieceWork1 = 0,//Convert.ToDecimal(txtFPieceWork.Text.Trim()), FQty = Convert.ToDecimal(txtFQty.Text.Trim()), cinvdefine1 = txtcinvdefine1.Text, FPieceWork1 = Convert.ToDecimal(txtFPieceWork1.Text.Trim()) }; // 包装物问题 if (!ddlBottleNum.SelectedValue.Equals("-1")) { var bottle = ItemsMapBottleService.Where(p => p.FCode == ProductItem.FCode && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (bottle != null) { bottle.FBottleCode = ddlBottleNum.SelectedValue; ItemsMapBottleService.SaveChanges(); } else { var bot = new LHItemsMapBottle { FCode = ProductItem.FCode, FBottleCode = ddlBottleNum.SelectedValue }; ItemsMapBottleService.Add(bot); } } return(ItemsService.Add(its)); }
private void ajaxChinese2Pinyin() { this.Admin_Load("", "json"); if (this.Str2Int(this.f("t"), 0) == 1) { this._response = this.JsonResult(1, ChineseSpell.MakeSpellCode(this.f("chinese"), "", SpellOptions.TranslateUnknowWordToInterrogation)); } else { this._response = this.JsonResult(1, ChineseSpell.MakeSpellCode(this.f("chinese"), "", SpellOptions.FirstLetterOnly)); } }
/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { if (Link != null) { Link.FCode = txtFCode.Text.Trim(); Link.FName = tbxFCustomer.Text.Trim(); Link.FAddress = txtFAddress.Text.Trim(); Link.FLinkman = txtFLinkman.Text.Trim(); Link.FPhome = txtFPhome.Text.Trim(); Link.FMoile = txtFMoile.Text.Trim(); Link.FMemo = txtFMemo.Text.Trim(); Link.FSpell = ChineseSpell.MakeSpellCode(tbxFCustomer.Text.Trim(), "", SpellOptions.FirstLetterOnly).ToUpper(); Link.FCity = txtFCity.Text.Trim(); Link.FZip = txtFZip.Text.Trim(); return(CustomerLinkService.SaveChanges() >= 0); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { LHDevice its = new LHDevice { FCode = txtFCode.Text.Trim(), FName = txtFName.Text.Trim(), FSpec = txtFSpec.Text.Trim(), FSpell = ChineseSpell.MakeSpellCode(txtFName.Text.Trim(), "", SpellOptions.FirstLetterOnly).ToUpper(), FFlag = 1, //分类 FCateId = ProjectItem.FSParent, FSubCateId = ProjectItem.FId, //FCompanyId = CurrentUser.AccountComId, //FUnit = ddlUnit.SelectedValue.Trim(), FQty = Convert.ToDecimal(txtFQty.Text.Trim()), FMemo = txtFMemo.Text.Trim(),//备注 FCompanyId = CurrentUser.AccountComId, //FFlag = 0, FInstallDate = txtFInstallDate.SelectedDate, //ProjectItem.FFlag = 1, FParms = txtFParms.Text, FPurchaseDate = txtFPurchaseDate.SelectedDate, FStatus = Convert.ToInt32(ddlStatus.SelectedValue), FUser = txtFUser.Text, //单位 FUnit = ddlUnit.SelectedValue, FInspectionCycle = txtFInspectionCycle.Text, FInstallByName = ddlFInstallByName.SelectedValue //FPurchasePrice = Convert.ToDecimal(txtFPurchasePrice.Text.Trim()), //FSalesPrice = Convert.ToDecimal(txtFSalesPrice.Text.Trim()) }; return(DeviceService.Add(its)); }
private DataTable GetDataTableFromRepeater() { DataRow row; DataTable dataTable = new DataTable(); dataTable.Columns.Add("FieldName"); dataTable.Columns.Add("FieldValue"); dataTable.Columns.Add("FieldType"); dataTable.Columns.Add("FieldLevel"); foreach (RepeaterItem item in this.RepModel.Items) { FieldControl control = (FieldControl)item.FindControl("Field"); switch (control.ControlType) { case FieldType.PictureType: { PictureType type2 = (PictureType)control.FindControl("EasyOne2007"); row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = type2.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); if ((control.Settings.Count > 7) && DataConverter.CBoolean(control.Settings[7])) { DataRow row2 = dataTable.NewRow(); row2["FieldName"] = "UploadFiles"; row2["FieldValue"] = type2.UploadFiles; row2["FieldType"] = FieldType.TextType; row2["FieldLevel"] = 0; dataTable.Rows.Add(row2); } continue; } case FieldType.FileType: { FileType type3 = (FileType)control.FindControl("EasyOne2007"); row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = type3.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); if (DataConverter.CBoolean(control.Settings[3])) { DataRow row3 = dataTable.NewRow(); row3["FieldName"] = control.Settings[4]; row3["FieldValue"] = type3.FileSize; row3["FieldType"] = FieldType.TextType; row3["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row3); } continue; } case FieldType.NodeType: { EasyOne.WebSite.Controls.FieldControl.NodeType type5 = (EasyOne.WebSite.Controls.FieldControl.NodeType)control.FindControl("EasyOne2007"); row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = type5.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); row = dataTable.NewRow(); row["FieldName"] = "infoid"; row["FieldValue"] = type5.InfoNodeId; row["FieldType"] = FieldType.InfoType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); continue; } case FieldType.InfoType: { continue; } case FieldType.AuthorType: { if ((control.Settings.Count > 1) && DataConverter.CBoolean(control.Settings[1])) { this.Session["AuthorValue"] = control.Value; } row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = control.Value; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); continue; } case FieldType.SourceType: { if ((control.Settings.Count > 1) && DataConverter.CBoolean(control.Settings[1])) { this.Session["SourceValue"] = control.Value; } row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = control.Value; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); continue; } case FieldType.KeywordType: { row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = StringHelper.ReplaceChar(control.Value.Trim(), ' ', '|'); row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); continue; } case FieldType.ContentType: { ContentType type = (ContentType)control.FindControl("EasyOne2007"); row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = type.Content; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); if (type.SaveRemotePic) { if (string.IsNullOrEmpty(this.m_ContentFieldName)) { break; } this.m_ContentFieldName = this.m_ContentFieldName + "$" + control.FieldName; } continue; } case FieldType.TitleType: { TitleType type6 = (TitleType)control.FindControl("EasyOne2007"); row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = control.Value; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); string pinyinTitle = type6.PinyinTitle; if (string.IsNullOrEmpty(pinyinTitle)) { pinyinTitle = ChineseSpell.MakeSpellCode(control.Value, SpellOptions.EnableUnicodeLetter); } row = dataTable.NewRow(); row["FieldName"] = "PinyinTitle"; row["FieldValue"] = pinyinTitle; row["FieldType"] = FieldType.TextType; row["FieldLevel"] = 0; dataTable.Rows.Add(row); continue; } case FieldType.MultiplePhotoType: { MultiplePhotoType type4 = (MultiplePhotoType)control.FindControl("EasyOne2007"); row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = type4.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); continue; } default: goto Label_0773; } this.m_ContentFieldName = this.m_ContentFieldName + control.FieldName; continue; Label_0773: row = dataTable.NewRow(); row["FieldName"] = control.FieldName; row["FieldValue"] = control.Value; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; dataTable.Rows.Add(row); } if (this.m_Action == "add") { row = dataTable.NewRow(); row["FieldName"] = "Inputer"; row["FieldValue"] = PEContext.Current.Admin.UserName; row["FieldType"] = FieldType.TextType; row["FieldLevel"] = 0; dataTable.Rows.Add(row); } if (GetStatusFromDataTable(dataTable) == 0x63) { row = dataTable.NewRow(); row["FieldName"] = "Editor"; row["FieldValue"] = PEContext.Current.Admin.AdminName; row["FieldType"] = FieldType.TextType; row["FieldLevel"] = 0; dataTable.Rows.Add(row); row = dataTable.NewRow(); row["FieldName"] = "PassedTime"; row["FieldValue"] = DateTime.Now.ToString("yyyy-MM-dd"); row["FieldType"] = FieldType.DateTimeType; row["FieldLevel"] = 0; dataTable.Rows.Add(row); } return(dataTable); }
/// <summary> /// 提交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { // 提配错误行数 var errorRow = -1; try { using (var ts = new TransactionScope()) { var data = ViewState["dtData"] as DataTable; if (data == null) { return; } //var stringBuilder = new StringBuilder(); for (int i = 0; i < data.Rows.Count; i++) { errorRow = i + 1; var item = new LHCustomer { FCode = data.Rows[i]["客户代码"].ToString(), FName = data.Rows[i]["客户名称"].ToString(), FSpell = ChineseSpell.MakeSpellCode(data.Rows[i]["客户名称"].ToString(), "", SpellOptions.FirstLetterOnly).ToUpper(), FPaymentMethod = data.Rows[i]["付款方式"].ToString(), FLinkman = data.Rows[i]["联系人"].ToString(), FPhome = data.Rows[i]["电话"].ToString(), FMoile = data.Rows[i]["手机"].ToString(), FAddress = data.Rows[i]["地址"].ToString(), FDistric = data.Rows[i]["区域"].ToString(), FIsPrint = Convert.ToInt32(data.Rows[i]["是否打印单价"]), FTipsDay = Convert.ToInt32(data.Rows[i]["提醒天数"]), FFreight = Convert.ToDecimal(data.Rows[i]["运输服务费"]), FCredit = Convert.ToDecimal(data.Rows[i]["信用额度"]), FSalesman = data.Rows[i]["业务员"].ToString(), FMemo = data.Rows[i]["摘要"].ToString(), FGroupNo = data.Rows[i]["客户代码"].ToString(), FGroupNoFlag = "1", FLevel = 0, //客户分类 FCateId = "2077", FSubCateId = "2077", FDate = DateTime.Now, FIsAllot = 0, FIsInvoice = 0, FCompanyId = CurrentUser.AccountComId, FFlag = 1 }; CustomerService.AddEntity(item); } //写入数据库 CustomerService.SaveChanges(); ts.Complete(); Alert.Show("引入完成。", MessageBoxIcon.Information); } } catch (Exception ex) { Alert.Show(string.Format(@"引入失败,请排查模版内容是否完善,出错定位行:{0} ", errorRow), MessageBoxIcon.Information); } }
public string GetPinyinTitles(string title) { return(ChineseSpell.MakeSpellCode(title, SpellOptions.EnableUnicodeLetter | SpellOptions.TranslateUnknowWordToInterrogation)); }
public IActionResult TestCommon() { ViewData["ContentRootPath"] = FileHelper.ContentRootPath; ViewData["WebRootPath"] = FileHelper.WebRootPath; ViewData["WebRootName"] = FileHelper.WebRootName; string strRequestMsg = string.Empty; strRequestMsg += " HasFormContentType:" + MyHttpContext.Current.Request.HasFormContentType + Environment.NewLine; strRequestMsg += " Host:" + MyHttpContext.Current.Request.Host + Environment.NewLine; strRequestMsg += " IsHttps:" + MyHttpContext.Current.Request.IsHttps + Environment.NewLine; strRequestMsg += " Method:" + MyHttpContext.Current.Request.Method + Environment.NewLine; strRequestMsg += " Path:" + MyHttpContext.Current.Request.Path + Environment.NewLine; strRequestMsg += " PathBase:" + MyHttpContext.Current.Request.PathBase + Environment.NewLine; strRequestMsg += " Protocol:" + MyHttpContext.Current.Request.Protocol + Environment.NewLine; strRequestMsg += " Scheme:" + MyHttpContext.Current.Request.Scheme + Environment.NewLine; ViewData["RequestMsg"] = strRequestMsg; ViewData["RequestReferer"] = MyHttpContext.Current.Request.UrlReferrer(); string strHeaders = string.Empty; foreach (String strFormKey in MyHttpContext.Current.Request.Headers.Keys) { strHeaders += strFormKey + ":" + MyHttpContext.Current.Request.Headers[strFormKey] + "#####"; } ViewData["RequestHeaders"] = strHeaders; ViewData["RequestHeadersJSON"] = ""; //MyHttpContext.Current.Request.Headers.ToJson(); string strForm = string.Empty; if (MyHttpContext.Current.Request.Method == "POST") { foreach (String strFormKey in MyHttpContext.Current.Request.Form.Keys) { strForm += strFormKey + ":" + DataConverter.ToString(MyHttpContext.Current.Request.Form[strFormKey]) + "#####"; } } ViewData["RequestFormJSON"] = strForm; //ViewData["RequestFormJSON"] = MyHttpContext.Current.Request.Form.ToJson(); string strCurrentTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"); var resultAdd = CacheHelper.CacheServiceProvider.AddOrUpdate("CurrentTime", strCurrentTime); if (CacheHelper.CacheServiceProvider.Exists("CurrentTime")) { string resultGet = CacheHelper.CacheServiceProvider.Get <string>("CurrentTime"); ViewData["CurrentTime"] = resultGet; } string strMsg = "我是加密文件,请保管好"; string strKey = Guid.NewGuid().ToString().Replace("-", string.Empty); string strEncryptAes = AesRijndael.Encrypt(strMsg, strKey); string strDecryptAes = AesRijndael.Decrypt(strEncryptAes, strKey); ViewData["EncryptAes"] = strEncryptAes; ViewData["DecryptAes"] = strDecryptAes; string strEncryptHmacSha1 = HmacSha1.EncryptUtf8(strMsg, strKey); string strEncryptHmacSha1Base64 = HmacSha1.EncryptBase64(strMsg, strKey); ViewData["EncryptHmacSha1"] = strEncryptHmacSha1; ViewData["EncryptHmacSha1Base64"] = strEncryptHmacSha1Base64; string strEncryptMd5 = Md5.EncryptHexString(strMsg); ViewData["EncryptMd5"] = strEncryptMd5; string strEncryptSha1 = Sha1.Encrypt(strMsg); ViewData["EncryptSha1"] = strEncryptSha1; ViewData["ClientIP"] = IPHelper.GetClientIP(); ViewData["HostIP"] = IPHelper.GetHostIP(); ViewData["RandomFormatedNumeric"] = RandomHelper.GetFormatedNumeric(4, 10); ViewData["RandomString"] = RandomHelper.GetRandString(4); ViewData["RandomStringByPattern"] = RandomHelper.GetRandStringByPattern("JX###???***"); ViewData["StringHelper-GetHashKey"] = StringHelper.GetHashKey(strMsg, StringFilterOptions.HoldChinese); ViewData["StringHelper-GetStringHashKey"] = StringHelper.GetStringHashKey(strMsg); ViewData["StringHelper-MD5"] = StringHelper.MD5(strMsg); ViewData["StringHelper-MD5D"] = StringHelper.MD5D(strMsg); ViewData["StringHelper-MD5GB2312"] = StringHelper.MD5GB2312(strMsg); ViewData["StringHelper-SHA1"] = StringHelper.SHA1(strMsg); ViewData["StringHelper-ValidateMD5"] = StringHelper.ValidateMD5(strEncryptMd5, StringHelper.MD5(strMsg)); ViewData["StringHelper-SubString"] = StringHelper.SubString(strMsg, 12, "..."); ViewData["StringHelper-GetInitial"] = StringHelper.GetInitial(strMsg); ViewData["StringHelper-MakeSpellCode"] = ChineseSpell.MakeSpellCode(strMsg, SpellOptions.EnableUnicodeLetter); ViewData["StringHelper-FirstLetterOnly"] = ChineseSpell.MakeSpellCode(strMsg, SpellOptions.FirstLetterOnly); ViewData["XmlSerializer"] = ConfigHelper.Get <IPLockConfig>().ToXml(); var strXML = "<IPLockConfig> <AdminLockIPBlack>10.123.123.1</AdminLockIPBlack> <AdminLockIPType>30.123.123.3</AdminLockIPType> <AdminLockIPWhite>20.123.123.2</AdminLockIPWhite> <LockIPType>60.123.123.6</LockIPType> <LockIPBlack>40.123.123.4</LockIPBlack> <LockIPWhite>50.123.123.5</LockIPWhite> </IPLockConfig>"; var ipLockConfig = strXML.ToXmlObject <IPLockConfig>(); ViewData["XmlDeserialize"] = "IPLockConfig:" + ipLockConfig.AdminLockIPBlack + " " + ipLockConfig.AdminLockIPType + " " + ipLockConfig.AdminLockIPWhite; ViewData["JsonSerializer"] = ConfigHelper.Get <WebHostConfig>().ToJson(); ConfigHelper.Save(ConfigHelper.Get <ShopConfig>()); ConfigHelper.Save(ConfigHelper.Get <SiteConfig>()); ConfigHelper.Save(ConfigHelper.Get <SiteOptionConfig>()); ConfigHelper.Save(ConfigHelper.Get <SmsConfig>()); ConfigHelper.Save(ConfigHelper.Get <UserConfig>()); ConfigHelper.Save(ConfigHelper.Get <WebHostConfig>()); var strJSON = "{\"AuthenticationType\": 0,\"EnabledSsl\": false,\"MailFrom\": \"[email protected]\",\"MailServer\": \"smtp.qq.com\",\"MailServerPassWord\": \"lx123456\",\"MailServerUserName\": \"2094838895\",\"Port\": \"25\"}"; var mailConfig = strJSON.ToJsonObject <MailConfig>(); ViewData["JsonDeserialize"] = mailConfig.AuthenticationType + " " + mailConfig.EnabledSsl + " " + mailConfig.MailFrom + " " + mailConfig.MailServer; CookieHelper.CreateCookie("cName", "aspnetcore" + strCurrentTime, 10); ViewData["CookieHelper"] = CookieHelper.GetCookie("cName"); //CookieHelper.DeleteCookie("cName"); DateTime beginDate = new DateTime(2015, 12, 5); DateTime endDate = DateTime.Now; ViewData["DateDiff-yyyy"] = Utility.DateDiff(beginDate, endDate, "yyyy"); ViewData["DateDiff-q"] = Utility.DateDiff(beginDate, endDate, "q"); ViewData["DateDiff-m"] = Utility.DateDiff(beginDate, endDate, "m"); ViewData["DateDiff-d"] = Utility.DateDiff(beginDate, endDate, "d"); ViewData["DateDiff-w"] = Utility.DateDiff(beginDate, endDate, "w"); ViewData["DateDiff-h"] = Utility.DateDiff(beginDate, endDate, "h"); ViewData["DateDiff-n"] = Utility.DateDiff(beginDate, endDate, "n"); ViewData["DateDiff-s"] = Utility.DateDiff(beginDate, endDate, "s"); ViewData["Query-name"] = Utility.Query("name"); ViewData["Query-date"] = Utility.Query("date", DateTime.Now).ToString("yyyy-MM-dd HH:mm:ss:fff"); ViewData["Query-age"] = Utility.Query("age", 0); ViewData["Query-mobile"] = Utility.AddQuery("mobile", "15871375589"); var mailConfigSession = ConfigHelper.Get <MailConfig>(); Utility.SetSession("sessionName", mailConfigSession); ViewData["GroupTypeEnum"] = EnumHelper.GetDescription((GroupTypeEnum)(0)); ViewData["GroupTypeEnum1"] = EnumHelper.GetDescription <GroupTypeEnum>(GroupTypeEnum.Agent.ToString()); LogFactory.SaveFileLog("日志标题get", "日志内容"); return(View()); }