protected void gvProjectXMDeductionSetUpTypeCashBack_RowEditing(object sender, GridViewEditEventArgs e) { this.RowEditIndex = e.NewEditIndex; this.BindGrid(this.Master.PageIndex, this.Master.PageSize); int Id = 0; int.TryParse(this.gvProjectXMDeductionSetUpTypeCashBack.DataKeys[e.NewEditIndex].Value.ToString(), out Id); var row = this.gvProjectXMDeductionSetUpTypeCashBack.Rows[e.NewEditIndex]; var xMDeductionSetUp = base.XMDeductionSetUpService.GetXMDeductionSetUpById(Id); if (xMDeductionSetUp != null) { //平台类型 CodeControl ccPlatformTypeId = (CodeControl)row.FindControl("ccPlatformTypeId"); ccPlatformTypeId.SelectedValue = xMDeductionSetUp.PlatformTypeId.Value; //平台负责人 SelectSingleCustomerControl txtPlatformTypePersonId = (SelectSingleCustomerControl)row.FindControl("txtPlatformTypePersonId"); txtPlatformTypePersonId.SelectSingleCustomer = base.CustomerInfoService.GetCustomerInfoByID(xMDeductionSetUp.PlatformTypePersonId.Value); if (txtPlatformTypePersonId.SelectSingleCustomer != null) { txtPlatformTypePersonId.Value = txtPlatformTypePersonId.SelectSingleCustomer.FullName; } } }
private void Initialize() { var doc = new HtmlDocument(); doc.LoadHtml(PageHtml); var pres = doc.DocumentNode.SelectNodes("//pre"); int i = 0; foreach (var pre in pres) { i++; var codeText = pre.InnerText; codeText = codeText.Replace("<", "<"); codeText = codeText.Replace(">", ">"); Grid g = new Grid(); TextBlock tempTXT = new TextBlock(); tempTXT.Text = codeText; CodeControl tempCode = new CodeControl(codeText); g.Margin = new Thickness(10, 5, 10, 0); g.Children.Add(tempCode); CodeControlList.Add(tempCode); PivotItem item = new PivotItem(); item.Header = "code" + i.ToString(); item.Content = g; PVT.Items.Add(item); PVTitems.Add(item); } }
protected void gvXMProduct_RowEditing(object sender, GridViewEditEventArgs e) { this.RowEditIndex = e.NewEditIndex; //this.RowEditIndex = e.NewEditIndex - 1;//行号减1 (注:减掉第一行编辑行) this.BindGrid(this.Master.PageIndex, this.Master.PageSize); int Id = 0; int index = e.NewEditIndex; //int Nindex = index - 1; int.TryParse(this.gvXMProduct.DataKeys[index].Value.ToString(), out Id); var row = this.gvXMProduct.Rows[index]; var product = base.XMProductService.GetXMProductById(Id); if (product != null) { //品牌 CodeControl CCBrandTypeId = (CodeControl)row.FindControl("CCBrandTypeId"); if (CCBrandTypeId != null) { CCBrandTypeId.SelectedValue = product.BrandTypeId.Value; } //发货方 DropDownList ddlShipper = (DropDownList)row.FindControl("ddlShipper"); if (ddlShipper != null) { ddlShipper.SelectedValue = product.Shipper.ToString(); } } //供应商 var editindex = index + 2 >= 10 ? (index + 2).ToString() : "0" + (index + 2).ToString(); ScriptManager.RegisterStartupScript(this, typeof(UpdatePanel), "", "EditSuppliers('" + editindex + "');", true); }
protected void gvAdvanceApplicationDetail_RowEditing(object sender, GridViewEditEventArgs e) { this.RowEditIndex = e.NewEditIndex; BindGrid(); int Id = 0; int.TryParse(this.gvAdvanceApplicationDetail.DataKeys[e.NewEditIndex].Value.ToString(), out Id); var row = this.gvAdvanceApplicationDetail.Rows[e.NewEditIndex]; var advanceApplicationDetail = base.AdvanceApplicationDetailService.GetAdvanceApplicationDetailById(Id); if (advanceApplicationDetail != null) { //暂支类型 CodeControl ccAdvanceTypeId = (CodeControl)row.FindControl("ccAdvanceTypeId"); ccAdvanceTypeId.SelectedValue = advanceApplicationDetail.AdvanceTypeId.Value; //领/还款类型 CodeControl ccPayTypeId = (CodeControl)row.FindControl("ccPayTypeId"); ccPayTypeId.SelectedValue = advanceApplicationDetail.PayTypeId.Value; //领/还款人 SelectSingleCustomerControl txtRecipientsId = (SelectSingleCustomerControl)row.FindControl("txtRecipientsId"); txtRecipientsId.SelectSingleCustomer = base.CustomerInfoService.GetCustomerInfoByID(advanceApplicationDetail.RecipientsId.Value); if (txtRecipientsId.SelectSingleCustomer != null) { txtRecipientsId.Value = txtRecipientsId.SelectSingleCustomer.FullName; } } }
// Update is called once per frame void Update() { if (justActivated) { startTime = Time.time; justActivated = false; } if (travelling && zipUser != null) { print("Travelling"); print(zipUser.position); float distCovered = (Time.time - startTime) * speed; float fracJourney = distCovered / journeyLegth; zipUser.position = Vector3.Lerp(poleOne.position, poleTwo.position, fracJourney); if (zipUser.position == poleTwo.position) { print("Reached"); travelling = false; CodeControl changeBack = zipUser.GetComponent <CodeControl> (); changeBack.controls.enabled = true; zipUser = null; //Reactivate Movement Code } } }
public MainWindow() { InitializeComponent(); CodeControl.Focus(); Keyboard.Focus(CodeControl); Loaded += OnLoaded; }
private void Clip_Click(object sender, RoutedEventArgs e) { CodeControl temp = CodeControlList[PVT.SelectedIndex]; String code = temp.Code; DataPackage dataPackage = new DataPackage(); dataPackage.SetText(code); Clipboard.SetContent(dataPackage); PopupToast(); }
/// <inheritdoc /> protected override Size ArrangeOverride(Size finalSize) { var s = base.ArrangeOverride(finalSize); var haveControl = CodeControl != null; var physicalOffset = 0.0; if (haveControl) { var stroke = CodeControl.Rectangle.StrokeThickness; var strokeLines = Math.Ceiling(stroke / CodeControl.LineHeight); var lineNo = _scrollData._offset.Y - strokeLines; if (lineNo >= 0) { var lineNode = CodeControl.FindLine((int)lineNo); var line = lineNode?.Value; if (line != null) { physicalOffset = line.Origin.Y + stroke; Debug.WriteLine($"{nameof(CodeViewportPanel)} physical offset is {physicalOffset}"); } } else { var a = strokeLines * CodeControl.LineHeight; var b = a - stroke; var remainder = stroke % CodeControl.LineHeight; var c = lineNo * CodeControl.LineHeight; var d = a + c; physicalOffset = d;// c - stroke - (CodeControl.LineHeight - remainder) } } var size = finalSize; size.Height += physicalOffset; var childrenCount = VisualTreeHelper.GetChildrenCount(this); if (childrenCount != 0) { for (var i = 0; i < childrenCount; i++) { var child = (UIElement)VisualTreeHelper.GetChild(this, i); child.Arrange(new Rect(new Point(0, -1 * physicalOffset), size)); } } ScrollOwner?.InvalidateScrollInfo(); return(finalSize); }
private void VARS_ChangeVar(List <Lib.Parameters> list) { PivotItem item = PVTitems[PVT.SelectedIndex]; String ori = CodeControlList[PVT.SelectedIndex].OriginCode; String changed = ori; foreach (var i in list) { changed = changed.Replace(i.name, i.value); } CodeControl c = new CodeControl(changed); item.Content = c; CodeControlList[PVT.SelectedIndex] = c; }
protected void gvXMProjectList_RowEditing(object sender, GridViewEditEventArgs e) { this.RowEditIndex = e.NewEditIndex; this.BindGrid(this.Master.PageIndex, this.Master.PageSize); int Id = 0; int.TryParse(this.gvXMProjectList.DataKeys[e.NewEditIndex].Value.ToString(), out Id); var row = this.gvXMProjectList.Rows[e.NewEditIndex]; var xMProject = base.XMProjectService.GetXMProjectById(Id); if (xMProject != null) { //负责人 SelectSingleCustomerControl txtcustomerId = (SelectSingleCustomerControl)row.FindControl("txtcustomerId"); if (xMProject.customerId != null) { txtcustomerId.SelectSingleCustomer = base.CustomerInfoService.GetCustomerInfoByID(xMProject.customerId.Value); if (txtcustomerId.SelectSingleCustomer != null) { txtcustomerId.Value = txtcustomerId.SelectSingleCustomer.FullName; } } //负责人 if (xMProject.ClientId != null) { SelectSingleCustomerControl txtClientId = (SelectSingleCustomerControl)row.FindControl("txtClientId"); txtClientId.SelectSingleCustomer = base.CustomerInfoService.GetCustomerInfoByID(xMProject.ClientId.Value); if (txtClientId.SelectSingleCustomer != null) { txtClientId.Value = txtClientId.SelectSingleCustomer.FullName; } } //项目类型 CodeControl ccProjectTypeId = (CodeControl)row.FindControl("ccProjectTypeId"); ccProjectTypeId.SelectedValue = xMProject.ProjectTypeId.Value; //所属部门 DropDownList ddlDepartment = (DropDownList)row.FindControl("ddlDepartment"); if (xMProject.DepartmentID != null) { ddlDepartment.SelectedValue = xMProject.DepartmentID.ToString(); } } }
protected void gvAdvanceApplicationDetail_RowEditing(object sender, GridViewEditEventArgs e) { this.RowEditIndex = e.NewEditIndex; BindGrid(); int Id = 0; int.TryParse(this.gvAdvanceApplicationDetail.DataKeys[e.NewEditIndex].Value.ToString(), out Id); var row = this.gvAdvanceApplicationDetail.Rows[e.NewEditIndex]; var xMProductDetails = base.XMCombinationDetailsService.GetXMProductDetailsById(Id); //暂支类型 CodeControl ccPlatformTypeId = (CodeControl)row.FindControl("ccPlatformTypeId"); ccPlatformTypeId.SelectedValue = xMProductDetails.PlatformTypeId.Value; //领/还款类型 CodeControl ccProductTypeId = (CodeControl)row.FindControl("ccProductTypeId"); ccProductTypeId.SelectedValue = xMProductDetails.ProductTypeId.Value; }
private async Task SetupCodeControlAsync() { CodeControl.DebugLevel = 2; CodeControl.JTF2 = JTF2; CodeControl.Document = Document; var tree = await Document.GetSyntaxTreeAsync(); CodeControl.SyntaxTree = tree; var model = await Document.GetSemanticModelAsync(); CodeControl.SemanticModel = model; if (model != null) { CodeControl.Compilation = model.Compilation; } CodeControl.AddHandler(RoslynCodeControl.ContentChangedEvent, new RoslynCodeControl.ContentChangedRoutedEventHandler(CodeControlContentChanged)); CodeControl.AddHandler(RoslynCodeBase.RenderStartEvent, new RoutedEventHandler((sender, args) => { StartTime = DateTime.Now; Debug.WriteLine("render start"); })); CodeControl.AddHandler(RoslynCodeBase.RenderCompleteEvent, new RoutedEventHandler((sender, args) => { var span = DateTime.Now - StartTime; Debug.WriteLine("render complete " + span); })); await CodeControl.UpdateFormattedTextAsync(); var d = ViewModel.RunAnalyzers(CodeControl, AnalyzerContexts, tree, model); _diagnosticsList.Clear(); foreach (var diagnostic in d) { _diagnosticsList.Add(diagnostic); } }
protected void gvXMProduct_RowEditing(object sender, GridViewEditEventArgs e) { this.RowEditIndex = e.NewEditIndex; //this.RowEditIndex = e.NewEditIndex - 1;//行号减1 (注:减掉第一行编辑行) this.BindGrid(this.Master.PageIndex, this.Master.PageSize); int Id = 0; int index = e.NewEditIndex; int Nindex = index - 1; int.TryParse(this.gvXMProduct.DataKeys[Nindex].Value.ToString(), out Id); var row = this.gvXMProduct.Rows[Nindex]; var product = base.XMProductService.GetXMProductById(Id); if (product != null) { //品牌 CodeControl CCBrandTypeId = (CodeControl)row.FindControl("CCBrandTypeId"); if (CCBrandTypeId != null) { CCBrandTypeId.SelectedValue = product.BrandTypeId.Value; } } }
/// <summary> /// 记录行 操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvXMProduct_RowUpdating(object sender, GridViewUpdateEventArgs e) { int paramparse = 0; //decimal param = 0; if (int.TryParse(this.gvXMProduct.DataKeys[e.RowIndex].Value.ToString(), out paramparse)) { var row = this.gvXMProduct.Rows[e.RowIndex]; #region 字符验证 if (this.NickId == -1) { var ddlNick = row.FindControl("ddlNick") as DropDownList; ddlNick.Enabled = false; } else { var ddlNick = row.FindControl("ddlNick") as DropDownList; ddlNick.Enabled = true; } //品牌 CodeControl CCBrandTypeId = (CodeControl)row.FindControl("CCBrandTypeId"); var txtProductName = row.FindControl("txtProductName") as TextBox; var lblMsgProductNameVaule = row.FindControl("lblMsgProductNameVaule") as Label; lblMsgProductNameVaule.Text = ""; if (txtProductName.Text.Trim() == "") { lblMsgProductNameVaule.Text = "不允许为空"; } //厂家编码 var txtManufacturersCode = row.FindControl("txtManufacturersCode") as TextBox; var hfManufacturersCode = row.FindControl("hfManufacturersCode") as HiddenField; var lblMsgManufacturersCodeVaule = row.FindControl("lblMsgManufacturersCodeVaule") as Label; lblMsgManufacturersCodeVaule.Text = ""; if (txtManufacturersCode.Text.Trim() == "") { lblMsgManufacturersCodeVaule.Text = "不允许为空"; } //尺寸 var txtSpecifications = row.FindControl("txtSpecifications") as TextBox; var lblMsgSpecificationsVaule = row.FindControl("lblMsgSpecificationsVaule") as Label; lblMsgSpecificationsVaule.Text = ""; if (txtSpecifications.Text.Trim() == "") { lblMsgSpecificationsVaule.Text = "不允许为空"; } //厂家库存 var txtManufacturersInventoryE = row.FindControl("txtManufacturersInventoryE") as TextBox; var lblMsgManufacturersInventoryEVaule = row.FindControl("lblMsgManufacturersInventoryEVaule") as Label; lblMsgManufacturersInventoryEVaule.Text = ""; if (txtManufacturersInventoryE.Text.Trim() == "") { lblMsgManufacturersInventoryEVaule.Text = "不允许为空"; } if (!int.TryParse(txtManufacturersInventoryE.Text.Trim(), out paramparse)) { if (txtManufacturersInventoryE.Text.Trim() != "") { lblMsgManufacturersInventoryEVaule.Text = "请输入正确的数值"; } } //预警库存数 var txtWarningQuantityE = row.FindControl("txtWarningQuantityE") as TextBox; var lblMsgWarningQuantityEVaule = row.FindControl("lblMsgWarningQuantityEVaule") as Label; lblMsgWarningQuantityEVaule.Text = ""; if (txtWarningQuantityE.Text.Trim() == "") { lblMsgWarningQuantityEVaule.Text = "不允许为空"; } if (!int.TryParse(txtWarningQuantityE.Text.Trim(), out paramparse)) { if (txtWarningQuantityE.Text.Trim() != "") { lblMsgWarningQuantityEVaule.Text = "请输入正确的数值"; } } //颜色 var txtProductColors = row.FindControl("txtProductColors") as TextBox; //var lblMsgProductColorsVaule = row.FindControl("lblMsgProductColorsVaule") as Label; //lblMsgProductColorsVaule.Text = ""; //if (txtProductColors.Text.Trim() == "") //{ // lblMsgProductColorsVaule.Text = "不允许为空"; //} //计量单位 var txtProductUnit = row.FindControl("txtProductUnit") as TextBox; //体重 var txtProductWeight = row.FindControl("txtProductWeight") as TextBox; //体积 var txtProductVolume = row.FindControl("txtProductVolume") as TextBox; // 是否赠品 var chkIsPremiums = row.FindControl("chkIsPremiums") as CheckBox; //|| lblMsgProductColorsVaule.Text != "" if (lblMsgProductNameVaule.Text != "" || lblMsgManufacturersCodeVaule.Text != "" || lblMsgSpecificationsVaule.Text != "" || lblMsgManufacturersInventoryEVaule.Text != "" || lblMsgWarningQuantityEVaule.Text != "") { return; } #endregion var Product = base.XMProductService.GetXMProductById(int.Parse(this.gvXMProduct.DataKeys[e.RowIndex].Value.ToString())); List <XMProduct> ProductManufacturersCodeList = new List <XMProduct>(); if (txtManufacturersCode.Text.Trim() != "") { ProductManufacturersCodeList = base.XMProductService.getXMProductListByEqusManufacturersCode(txtManufacturersCode.Text.Trim()); } //修改 if (Product != null) { #region if (ProductManufacturersCodeList.Count > 0) { if (!txtManufacturersCode.Text.Trim().Equals(hfManufacturersCode.Value)) { base.ShowMessage("厂家编码已存在"); return; } } Product.BrandTypeId = CCBrandTypeId.SelectedValue; Product.ProductName = txtProductName.Text.Trim(); Product.ManufacturersCode = txtManufacturersCode.Text.Trim(); Product.Specifications = txtSpecifications.Text.Trim(); int paramparse1 = 0; #region 数据转换 if (int.TryParse(txtManufacturersInventoryE.Text.Trim(), out paramparse1)) { Product.ManufacturersInventory = int.Parse(txtManufacturersInventoryE.Text.Trim()); } else { Product.ManufacturersInventory = 0; } if (int.TryParse(txtWarningQuantityE.Text.Trim(), out paramparse1)) { Product.WarningQuantity = int.Parse(txtWarningQuantityE.Text.Trim()); } else { Product.WarningQuantity = 0; } #endregion Product.ProductColors = txtProductColors.Text.Trim(); Product.ProductUnit = txtProductUnit.Text.Trim(); Product.ProductWeight = txtProductWeight.Text.Trim(); Product.ProductVolume = txtProductVolume.Text.Trim(); Product.IsPremiums = chkIsPremiums.Checked; Product.UpdateID = HozestERPContext.Current.User.SCustomerInfo.CustomerID; Product.UpdateDate = DateTime.Now; //修改产品信息 base.XMProductService.UpdateXMProduct(Product); #endregion } // 新增 else { if (ProductManufacturersCodeList.Count > 0) { base.ShowMessage("厂家编码已存在"); return; } XMProduct ProductNew = new XMProduct(); ProductNew.BrandTypeId = CCBrandTypeId.SelectedValue; ProductNew.ProductName = txtProductName.Text.Trim(); ProductNew.ManufacturersCode = txtManufacturersCode.Text.Trim(); ProductNew.Specifications = txtSpecifications.Text.Trim(); int paramparse1 = 0; #region 数据转换 if (int.TryParse(txtManufacturersInventoryE.Text.Trim(), out paramparse1)) { ProductNew.ManufacturersInventory = int.Parse(txtManufacturersInventoryE.Text.Trim()); } else { ProductNew.ManufacturersInventory = 0; } if (int.TryParse(txtWarningQuantityE.Text.Trim(), out paramparse1)) { ProductNew.WarningQuantity = int.Parse(txtWarningQuantityE.Text.Trim()); } else { ProductNew.WarningQuantity = 0; } #endregion ProductNew.ProductColors = txtProductColors.Text.Trim(); ProductNew.ProductUnit = txtProductUnit.Text.Trim(); ProductNew.ProductWeight = txtProductWeight.Text.Trim(); ProductNew.ProductVolume = txtProductVolume.Text.Trim(); ProductNew.IsPremiums = chkIsPremiums.Checked; ProductNew.UpdateID = HozestERPContext.Current.User.SCustomerInfo.CustomerID; ProductNew.UpdateDate = DateTime.Now; ProductNew.IsEnable = false;//默认可用 ProductNew.CreateID = HozestERPContext.Current.User.SCustomerInfo.CustomerID; ProductNew.CreateDate = DateTime.Now; ProductNew.UpdateID = HozestERPContext.Current.User.SCustomerInfo.CustomerID; ProductNew.UpdateDate = DateTime.Now; //新增产品 base.XMProductService.InsertXMProduct(ProductNew); } this.RowEditIndex = -1; this.BindGrid(this.Master.PageIndex, this.Master.PageSize); } }
private async Task SetupCodeControlAsync() { var w = new AdhocWorkspace(Host); w.AddSolution(SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create())); var projectInfo = ProjectInfo.Create(ProjectId.CreateNewId(), VersionStamp.Create(), "Code Project", "code", LanguageNames.CSharp); var w2 = w.CurrentSolution.AddProject(projectInfo); w.TryApplyChanges(w2); DocumentInfo documentInfo; var filename = Filename; if (filename != null) { documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(projectInfo.Id), "Default", null, SourceCodeKind.Regular, new FileTextLoader(filename, Encoding.UTF8), filename); } else { documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(projectInfo.Id), "Default", null, SourceCodeKind.Regular); } w2 = w.CurrentSolution.AddDocument(documentInfo); w.TryApplyChanges(w2); CodeControl.XOffset = 100; CodeControl.JTF2 = JTF2; CodeControl.PreviewKeyDown += CodeControlOnPreviewKeyDown; var doc = w.CurrentSolution.GetDocument(documentInfo.Id); if (doc != null) { ClassDiagram.Document = doc; CodeControl.Document = doc; var tree = await doc.GetSyntaxTreeAsync(); // ReSharper disable once AssignNullToNotNullAttribute CodeControl.SyntaxTree = tree; var model = await doc.GetSemanticModelAsync(); // ReSharper disable once AssignNullToNotNullAttribute CodeControl.SemanticModel = model; CodeControl.Compilation = model.Compilation; } DateTime startTime = default; CodeControl.AddHandler(RoslynCodeBase.RenderStartEvent, new RoutedEventHandler((sender, args) => { startTime = DateTime.Now; Debug.WriteLine("render start"); })); CodeControl.AddHandler(RoslynCodeBase.RenderCompleteEvent, new RoutedEventHandler((sender, args) => { var span = DateTime.Now - startTime; var msg = $"render complete time is {span}"; Debug.WriteLine(msg); ProtoLogger.Instance.LogAction(msg); })); await CodeControl.UpdateFormattedTextAsync(); CodeControlRendered = true; Rendering.Visibility = Visibility.Collapsed; }
/// <summary> /// 记录行 操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvProjectXMDeductionSetUpTypeCashBack_RowUpdating(object sender, GridViewUpdateEventArgs e) { int paramparse = 0; //decimal param = 0; if (int.TryParse(this.gvProjectXMDeductionSetUpTypeCashBack.DataKeys[e.RowIndex].Value.ToString(), out paramparse)) { var row = this.gvProjectXMDeductionSetUpTypeCashBack.Rows[e.RowIndex]; #region 字符验证 decimal paramparseD = 0; //平台类型 CodeControl ccPlatformTypeId = (CodeControl)row.FindControl("ccPlatformTypeId"); var hfPlatformTypeId = row.FindControl("hfPlatformTypeId") as HiddenField; //扣点 var txtDeduction = row.FindControl("txtDeduction") as TextBox; //财务金额 var txtFinance = row.FindControl("txtFinance") as TextBox; var lblMsgDeductionVaule = row.FindControl("lblMsgDeductionVaule") as Label; lblMsgDeductionVaule.Text = ""; if (txtDeduction.Text.Trim() == "") { lblMsgDeductionVaule.Text = "不允许为空"; } if (!decimal.TryParse(txtDeduction.Text.Trim(), out paramparseD)) { if (txtDeduction.Text.Trim() != "") { lblMsgDeductionVaule.Text = "请输入正确的数值"; } } //平台负责人 var txtPlatformTypePersonId = row.FindControl("txtPlatformTypePersonId") as SelectSingleCustomerControl; var PlatformTypePersonId = txtPlatformTypePersonId.SelectSingleCustomer.CustomerID; //备注 var txtRemarks = row.FindControl("txtRemarks") as TextBox; //|| lblMsgProductColorsVaule.Text != "" if (lblMsgDeductionVaule.Text != "") { return; } #endregion int QID = Convert.ToInt32(this.gvProjectXMDeductionSetUpTypeCashBack.DataKeys[e.RowIndex].Value.ToString()); XMDeductionSetUp deductionSetUp = base.XMDeductionSetUpService.GetXMDeductionSetUpById(QID); XMDeductionSetUp deductionSetUpNew = base.XMDeductionSetUpService.GetXMDeductionSetUpByProjectAndPlatformTypeId(this.ProjectId, this.SpeciesTypeId, ccPlatformTypeId.SelectedValue); //修改 if (deductionSetUp != null) { #region if (deductionSetUpNew != null) { if (!ccPlatformTypeId.SelectedValue.Equals(Convert.ToInt32(hfPlatformTypeId.Value))) { base.ShowMessage(ccPlatformTypeId.text + "平台数据已存在请修改!"); return; } } deductionSetUp.ProjectId = this.ProjectId; deductionSetUp.SpeciesTypeId = this.SpeciesTypeId; deductionSetUp.PlatformTypeId = ccPlatformTypeId.SelectedValue; deductionSetUp.PlatformTypePersonId = PlatformTypePersonId; deductionSetUp.Remarks = txtRemarks.Text.Trim(); decimal paramparse1 = 0; decimal paramparse3 = 0; #region 数据转换 返现 if (decimal.TryParse(txtDeduction.Text.Trim(), out paramparse1)) { deductionSetUp.Deduction = Convert.ToDecimal(txtDeduction.Text.Trim()); } else { deductionSetUp.Deduction = 0; } if (decimal.TryParse(txtFinance.Text.Trim(), out paramparse3)) { if (paramparse3 <= paramparse1) { ShowMessage("财务限额必须大于项目限额!"); return; } deductionSetUp.Finance = paramparse3; } else { deductionSetUp.Finance = 0; } #endregion deductionSetUp.UpdateID = HozestERPContext.Current.User.SCustomerInfo.CustomerID; deductionSetUp.UpdateDate = DateTime.Now; //修改扣点信息 base.XMDeductionSetUpService.UpdateXMDeductionSetUp(deductionSetUp); #endregion } // 新增 else { if (deductionSetUpNew != null) { base.ShowMessage(ccPlatformTypeId.text + "平台数据已存在请修改!"); return; } XMDeductionSetUp XMDeductionSetUpNew = new XMDeductionSetUp(); XMDeductionSetUpNew.ProjectId = this.ProjectId; XMDeductionSetUpNew.SpeciesTypeId = this.SpeciesTypeId; XMDeductionSetUpNew.PlatformTypeId = ccPlatformTypeId.SelectedValue; XMDeductionSetUpNew.PlatformTypePersonId = PlatformTypePersonId; XMDeductionSetUpNew.Remarks = txtRemarks.Text.Trim(); decimal paramparse2 = 0; decimal paramparse4 = 0; #region 数据转换 返现 if (decimal.TryParse(txtDeduction.Text.Trim(), out paramparse2)) { XMDeductionSetUpNew.Deduction = Convert.ToDecimal(txtDeduction.Text.Trim()); } else { XMDeductionSetUpNew.Deduction = 0; } if (decimal.TryParse(txtFinance.Text.Trim(), out paramparse4)) { if (paramparse4 <= paramparse2) { ShowMessage("财务限额必须大于项目限额!"); return; } XMDeductionSetUpNew.Finance = paramparse4; } else { XMDeductionSetUpNew.Finance = 0; } #endregion XMDeductionSetUpNew.IsEnable = false;//默认可用 XMDeductionSetUpNew.CreateID = HozestERPContext.Current.User.SCustomerInfo.CustomerID; XMDeductionSetUpNew.CreateDate = DateTime.Now; XMDeductionSetUpNew.UpdateID = HozestERPContext.Current.User.SCustomerInfo.CustomerID; XMDeductionSetUpNew.UpdateDate = DateTime.Now; //新增扣点 base.XMDeductionSetUpService.InsertXMDeductionSetUp(XMDeductionSetUpNew); } this.RowEditIndex = -1; this.BindGrid(this.Master.PageIndex, this.Master.PageSize); } }
private async void FontComboOnSelectionChanged(object sender, SelectionChangedEventArgs e) { CodeControl.FontFamily = (FontFamily)FontCombo.SelectedItem; await CodeControl.UpdateTextSourceAsync(); }
private void BTNvar_Click(object sender, RoutedEventArgs e) { CodeControl temp = CodeControlList[PVT.SelectedIndex]; VARS.Show(temp.vars); }
public Task UpdateFormattedTextAsync() { return(CodeControl.UpdateFormattedTextAsync()); }
private async Task SetupCodeControlAsync() { var w = new AdhocWorkspace(Host); #if false foreach (var fieldInfo in w.GetType().GetFields(BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.NonPublic)) { var v = fieldInfo.GetValue(w); Debug.WriteLine($"{fieldInfo.Name}: {v}"); } var langSvc = w.Services.GetLanguageServices(LanguageNames.CSharp); var method = langSvc.GetType().GetMethod("GetService", BindingFlags.Instance | BindingFlags.Public); List <object> services = new List <object>(); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { try { foreach (var type in assembly.GetTypes()) { if (typeof(ILanguageService).IsAssignableFrom(type)) { try { if (!type.ContainsGenericParameters) { var m = method.MakeGenericMethod(new[] { type }); var result = m.Invoke(langSvc, new object[] { }); if (result != null) { Debug.WriteLine(result); services.Add(result); } } } catch { } if (type.IsPublic) { Debug.WriteLine(String.Format("{0:G5}", type.IsPublic.ToString()) + " " + type.FullName); } } } } catch { } } foreach (object service in services) { foreach (var methodInfo in service.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { Debug.WriteLine((methodInfo.ReturnType?.FullName ?? "") + " " + service.GetType().FullName + "." + methodInfo.Name + "( " + string.Join(", ", methodInfo.GetParameters().Select(p => (p.IsOptional ? " optional " : "") + p.ParameterType + " " + p.Name)) + ")"); } if (service.GetType().Name == "CSharpCodeCleanupService") { } } // w.Services.FindLanguageServices<IFormattingService>(metadata => // { // foreach (var (key, value) in metadata) // { // Debug.WriteLine($"{key} = {value}"); // } // Debug.WriteLine(""); // return false; // }); #endif w.AddSolution(SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create())); var projectInfo = ProjectInfo.Create(ProjectId.CreateNewId(), VersionStamp.Create(), "Code Project", "code", LanguageNames.CSharp); var w2 = w.CurrentSolution.AddProject(projectInfo); w.TryApplyChanges(w2); DocumentInfo documentInfo; var filename = Filename; if (filename != null) { documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(projectInfo.Id), "Default", null, SourceCodeKind.Regular, new FileTextLoader(filename, Encoding.UTF8), filename); } else { documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(projectInfo.Id), "Default", null, SourceCodeKind.Regular); } w2 = w.CurrentSolution.AddDocument(documentInfo); w.TryApplyChanges(w2); Project1 = w.CurrentSolution.GetProject(projectInfo.Id); Document1 = w.CurrentSolution.GetDocument(documentInfo.Id); var qui = w.Services.GetLanguageServices(LanguageNames.CSharp).GetService <QuickInfoService>(); var textAsync = await Document1.GetTextAsync(); if (false) { for (var i = 0; i < textAsync.Length; i++) { var re = await qui.GetQuickInfoAsync(Document1, i); if (re != null) { Debug.WriteLine(re.Span.ToString()); Debug.WriteLine("tags = " + string.Join(";", re.Tags)); foreach (var reRelatedSpan in re.RelatedSpans) { Debug.WriteLine("relatedspan " + reRelatedSpan.ToString()); } foreach (var quickInfoSection in re.Sections) { Debug.WriteLine("" + i + " Text(" + quickInfoSection.Text + ") Kind(" + quickInfoSection.Kind + ") TaggedParts(" + String.Join(", ", quickInfoSection.TaggedParts) + ")"); } } } } CodeControl.DebugLevel = 2; CodeControl.JTF2 = JTF2; CodeControl.Document = Document1; var tree = await Document1.GetSyntaxTreeAsync(); CodeControl.SyntaxTree = tree; var model = await Document1.GetSemanticModelAsync(); CodeControl.SemanticModel = model; CodeControl.Compilation = model.Compilation; // CodeControl.AddHandler(RoslynCodeControl.ContentChangedEvent, new RoslynCodeControl.ContentChangedRoutedEventHandler(CodeControlContentChanged)); CodeControl.AddHandler(RoslynCodeBase.RenderStartEvent, new RoutedEventHandler((sender, args) => { // StartTime = DateTime.Now; Debug.WriteLine("render start"); })); CodeControl.AddHandler(RoslynCodeBase.RenderCompleteEvent, new RoutedEventHandler((sender, args) => { // var span = DateTime.Now - StartTime; Debug.WriteLine("render complete "); })); await CodeControl.UpdateFormattedTextAsync(); }