private static void asyncClient_DownloadStringComleted(object sender, DownloadStringCompletedEventArgs e) { try { DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List<Role>)); using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(e.Result))) { _role = (List<Role>)serializer.ReadObject(ms); } } catch { Window1 wind = new Window1(); wind.Show(); //_flag = true; } }
private void initLauncherBtn_Click(object sender, RoutedEventArgs e) { string selectedSimulation = simulationChoix.Text; switch (selectedSimulation) { case "Course de natation": Window1 mainWindow = new Window1(); mainWindow.Show(); break; case "Labyrinthe": Window2 windowL = new Window2(selectedSimulation); windowL.Show(); break; case "Trafic routier": Window2 windowT = new Window2(selectedSimulation); windowT.Show(); break; default: break; } this.Close(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { splash = new Window1(); splash.Show(); bg.RunWorkerAsync(); }
protected override void billGoods() { if (PubFunc.FormDataCheck(FormDoc).Length > 1) { return; } if ((",M,R").IndexOf(docFLAG.SelectedValue) < 0) { return; } PubFunc.FormLock(FormDoc, true, ""); docMEMO.Enabled = true; //参数说明:cx-查询内容,bm-商品配置部门,su-供应商 string url = "~/ERPQuery/GoodsWindow_New.aspx?Deptout=" + docDEPTOUT.SelectedValue + "&DeptIn=" + docDEPTID.SelectedValue + "&su="; PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hfdValue.ClientID) + Window1.GetShowReference(url, "商品信息查询")); hdfZP.Text = ""; }
private void add_task_Click(object sender, RoutedEventArgs e) { Window1 addWind = new Window1(); addWind.Show(); }
/// <summary> /// this method is responsible for starting the browsing session, and closing this current form! /// </summary> /// <param name="userID"></param> private void set_overall_userID_and_start_browsing_session(int userID, string user_name) { //IMPORTANT, now set the overall user id for this session login... User_Object.OVERALL_userID = userID; User_Object.OVERALL_USER_NAME = user_name; this.Hide(); Window1 win1 = new Window1(); win1.Show(); }
public MainWindow() { Log.writeToLog("Starting DatasetReviewer " + Assembly.GetExecutingAssembly().GetName().Version.ToString()); do { bool r; do { System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog(); dlg.Title = "Open Header file to be displayed..."; dlg.DefaultExt = ".hdr"; // Default file extension dlg.Filter = "HDR Files (.hdr)|*.hdr"; // Filter files by extension bool result = dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK; if (!result) Environment.Exit(0); directory = System.IO.Path.GetDirectoryName(dlg.FileName); //will use to find other files in dataset headerFileName = System.IO.Path.GetFileNameWithoutExtension(dlg.FileName); try { head = (new HeaderFileReader(dlg.OpenFile())).read(); } catch (Exception e) { r = false; //loop around again ErrorWindow ew = new ErrorWindow(); ew.Message = "Error reading Header file: " + e.Message; continue; } ED = head.Events; try { bdf = new BDFEDFFileStream.BDFEDFFileReader( new FileStream(System.IO.Path.Combine(directory, head.BDFFile), FileMode.Open, FileAccess.Read)); } catch (Exception e) { r = false; //loop around again ErrorWindow ew = new ErrorWindow(); ew.Message = "Error reading BDF file header: " + e.Message; ew.ShowDialog(); continue; } BDFLength = (double)bdf.NumberOfRecords * bdf.RecordDurationDouble; Window1 w = new Window1(this); r = (bool)w.ShowDialog(); } while (r == false); Log.writeToLog(" on dataset " + headerFileName); if (includeANAs) { foreach (EventDictionaryEntry ede in ED.Values) // add ANA channels that are referenced by extrinsic Events { if (ede.IsCovered && ede.IsExtrinsic) { int chan = bdf.ChannelNumberFromLabel(ede.channelName); if (!channelList.Contains(chan)) //don't enter duplicate channelList.Add(chan); } } } } while (channelList.Count == 0); InitializeComponent(); //initialize the individual channel graphs foreach (int i in channelList) { ChannelGraph pg = new ChannelGraph(this, i); GraphCanvas.Children.Add(pg); } Title = headerFileName; //set window title BDFFileInfo.Content = bdf.ToString(); HDRFileInfo.Content = head.ToString(); Event.EventFactory.Instance(head.Events); // set up the factory EventFileReader efr = null; try { efr = new EventFileReader( new FileStream(System.IO.Path.Combine(directory, head.EventFile), FileMode.Open, FileAccess.Read)); // open Event file bool z = false; foreach (Event.InputEvent ie in efr)// read in all Events into dictionary { if (ie.IsNaked) events.Add(ie); else if (events.Count(e => e.GC == ie.GC) == 0) //quietly skip duplicates { if (!z) //use first found covered Event to synchronize clocks z = bdf.setZeroTime(ie); events.Add(ie); } } efr.Close(); //now events is Dictionary of Events in the dataset; lookup by GC } catch (Exception e) { ErrorWindow ew = new ErrorWindow(); ew.Message = "Error reading Event file : " + e.Message + ". Exiting DatasetReviewer."; ew.ShowDialog(); Log.writeToLog(Environment.NewLine + e.StackTrace); Environment.Exit(0); } try { ElectrodeInputFileStream eif = new ElectrodeInputFileStream( new FileStream(System.IO.Path.Combine(directory, head.ElectrodeFile), FileMode.Open, FileAccess.Read)); //open Electrode file electrodes = eif.etrPositions; //read 'em in } catch (Exception e) { ErrorWindow ew = new ErrorWindow(); ew.Message = "Error reading Electrode file : " + e.Message + ". Exitting DatasetReviewer."; ew.ShowDialog(); Log.writeToLog(Environment.NewLine + e.StackTrace); Environment.Exit(0); } EventMarkers.Width = BDFLength; eventTB = new TextBlock(new Run("Events")); Canvas.SetBottom(eventTB, ScrollBarSize + 13D); //initialize gridline array for (int i = 0; i < 18; i++) { Line l = new Line(); Grid.SetRow(l, 0); Grid.SetColumn(l, 0); Grid.SetColumnSpan(l, 2); l.Y1 = 0D; l.HorizontalAlignment = HorizontalAlignment.Left; l.VerticalAlignment = VerticalAlignment.Stretch; l.IsHitTestVisible = false; l.Stroke = Brushes.LightBlue; l.Visibility = Visibility.Hidden; Panel.SetZIndex(l, int.MinValue); MainFrame.Children.Add(l); gridlines[i] = l; } //Initialize timer timer.AutoReset = true; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); //Initialize channel information popup Color c1 = Color.FromArgb(0xFF, 0xF8, 0xF8, 0xF8); Color c2 = Color.FromArgb(0xFF, 0xC8, 0xC8, 0xC8); popupTB.Background = new LinearGradientBrush(c1, c2, 45D); popupTB.Foreground = Brushes.Black; popupTB.Padding = new Thickness(4D); Border b = new Border(); b.BorderThickness = new Thickness(1); b.CornerRadius = new CornerRadius(4); b.BorderBrush = Brushes.Tomato; b.Margin = new Thickness(0, 0, 24, 24); //allows drop shadow to show up b.Effect = new DropShadowEffect(); b.Child = popupTB; channelPopup.Placement = PlacementMode.MousePoint; channelPopup.AllowsTransparency = true; channelPopup.Child = b; //Initialize Event information popup eventPopupTB.Background = new LinearGradientBrush(c1, c2, 45D); eventPopupTB.Foreground = Brushes.Black; eventPopupTB.Padding = new Thickness(4D); b = new Border(); b.BorderThickness = new Thickness(1); b.CornerRadius = new CornerRadius(4); b.BorderBrush = Brushes.Tomato; b.Margin = new Thickness(0, 0, 24, 24); //allows drop shadow to show up b.Effect = new DropShadowEffect(); b.Child = eventPopupTB; eventPopup.Placement = PlacementMode.MousePoint; eventPopup.AllowsTransparency = true; eventPopup.Child = b; //Initialize FOV slider FOV.Maximum = Math.Log10(BDFLength); FOV.Value = 1D; FOVMax.Text = BDFLength.ToString("0"); //Initialize Event selector bool first = true; foreach (EventDictionaryEntry e in head.Events.Values) { MenuItem mi = (MenuItem)EventSelector.FindResource("EventMenuItem"); mi.Header = e.Name; if (first) { mi.IsChecked = true; first = false; } EventSelector.Items.Add(mi); } noteFilePath = System.IO.Path.Combine(directory,System.IO.Path.ChangeExtension(head.BDFFile,".notes.txt")); //from here on the program is GUI-event driven }
private void MenuItem_Click(object sender, RoutedEventArgs e) { Window1 w1 = new Window1(); w1.Show(); }
private void FilterButton_Click(object sender, RoutedEventArgs e) { ProcedureDB1.Window1 window1 = new Window1(); window1.Show(); }
protected string GetEditUrl(object id, object name) { return(Window1.GetShowReference("~/projectsmanage/agent_new.aspx?id=" + id, "编辑 - " + name)); }
static void Main(string[] args) { string filename ; // ensure arguments is correct if (args.Length != 1) { System.Console.WriteLine("RenderStroke2: <filename>"); System.Console.WriteLine(); System.Console.WriteLine("Instructions:"); System.Console.WriteLine(); System.Console.WriteLine("1. To locate Kinematic Templates log files, create and save a drawing."); System.Console.WriteLine("2. Open the File menu and select Developer Options."); System.Console.WriteLine("3. Copy the text in \"Log Directory\" and paste into the dialog box here."); System.Console.WriteLine("4. Select the log file of a previous drawing you created."); // show dialog Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.CheckFileExists = true; dlg.Filter = "Kinematic Template Log Files (*.log)|*.log"; dlg.Title = "Open Log File"; bool? ret = dlg.ShowDialog(); if (ret.HasValue) { if (ret.Value == true) { filename = dlg.FileName; } else return; } else { return; } } else { filename = args[0]; } // load file into a queue int c = 0; Queue<SupportedString> lines = new Queue<SupportedString>(); try { using (TextReader reader = new StreamReader(filename)) { string line = reader.ReadLine(); while (line != null) { c++; lines.Enqueue(new SupportedString() { Line = line, LineNumber = c }); line = reader.ReadLine(); } } } catch (Exception ex) { Console.WriteLine("Cannot read the log file: " + ex.Message); Environment.Exit(1); } // quit if empty if (lines.Count == 0) { System.Console.WriteLine("RenderStroke2: log file is empty"); return; } ThreadStart threadParam = new ThreadStart(() => { // app state AppState s = new AppState() { ViewBox = "", PenType = PenType.Ink, Templates = new Dictionary<TemplateID,TemplateLog>(), EraserSize = 16}; // split up lines string[] split = null; // place to put all the stuff Queue<Stroke> strokes = new Queue<Stroke>(); Stack<Stroke> undoStack = new Stack<Stroke>(); Stack<Stroke> redoStack = new Stack<Stroke>(); while (lines.Count > 0) { split = lines.Peek().Line.Split('/'); // do some processing here if ("viewbox".Equals(split[ACTION])) s.ViewBox = split[OTHER]; else if ("pen".Equals(split[ACTION]) || "use_pen".Equals(split[ACTION]) || "goto_draw_mode".Equals(split[ACTION])) s.PenType = PenType.Ink; else if ("eraser".Equals(split[ACTION]) || "use_eraser".Equals(split[ACTION]) || "goto_eraser_mode".Equals(split[ACTION])) s.PenType = PenType.Eraser; else if ("eraser_size".Equals(split[ACTION])) s.EraserSize = int.Parse(split[OTHER]); else if ("undo".Equals(split[ACTION])) { if (undoStack.Count > 0) { Stroke q = UndoStroke(lines, undoStack, StrokeCreation.Undo); strokes.Enqueue(q); redoStack.Equals(q); } } else if ("redo".Equals(split[ACTION])) { if (redoStack.Count > 0) { Stroke q = UndoStroke(lines, redoStack, StrokeCreation.Redo); strokes.Enqueue(q); undoStack.Equals(q); } } else if ("stroke_started".Equals(split[ACTION])) { Stroke q = ExtractStroke(lines, s); strokes.Enqueue(q); undoStack.Push(q); } else { ExtractTemplate(split, s); } if (lines.Count > 0) lines.Dequeue(); } Window1 window = new Window1(); window.Title = filename; foreach (var i in strokes) { window.listBox1.Items.Add(i); } window.ShowDialog(); } ); Thread test = new Thread(threadParam); test.SetApartmentState(ApartmentState.STA); //Many WPF UI elements need to be created inside STA test.Start(); }
private void MirrorPresentationSpace(Window1 parent) { Dispatcher.adopt(delegate { try { var mirror = new Window { Content = new Projector { viewConstraint = parent.scroll } }; if (Projector.Window != null) Projector.Window.Close(); Projector.Window = mirror; parent.Closed += (_sender, _args) => mirror.Close(); mirror.WindowStyle = WindowStyle.None; mirror.AllowsTransparency = true; setSecondaryWindowBounds(mirror); mirror.Show(); } catch (NotSetException) { //Fine it's not time yet anyway. I don't care. } }); }
private void Button_Click_1(object sender, RoutedEventArgs e) { Window1 window1 = new Window1(); window1.Show(); }
protected void lbtn_his_Click(object sender, EventArgs e) { string pageAddr = string.Format("Attendance_regList.aspx?userid={0}", curUserId); PageContext.RegisterStartupScript(Window1.GetShowReference(pageAddr) + Window1.GetMaximizeReference()); }
/// <summary> /// 选择产品 /// </summary> /// <returns></returns> private string SearchScript() { return(Window1.GetShowReference(string.Format("../../Common/WinProduct.aspx"), "选择产品")); }
private void button2_Click(object sender, RoutedEventArgs e) { var newWindow = new Window1(); newWindow.Show(); }
protected string GetEditUrl(object value) { return("javascript:" + Window1.GetShowReference("AddStorefrontElegance.aspx?Type=1&value=" + value, "编辑店面风采")); //return String.Format("javascript:box.{0}_show(\"AddEnterpriseAfficheList.aspx?value={1}\", \"This is title\");", Window1.ClientID, value); }
public static void Main() { Window1 wnd = new Window1(); wnd.ShowDialog(); }
protected void Page_Load(object sender, EventArgs e) { LoadData(); btnNew.OnClientClick = Window1.GetShowReference("~/Pages/Budget/Budget_Form.aspx", "新增预算模版"); }
public MainWindow() { bool standAlone = Environment.GetCommandLineArgs().Length < 3; Window1 w; string templateFileName; string ETRFileName; bool useMonitor; if (standAlone) { w = new Window1(); try { foreach (string s in Directory.EnumerateFiles(networkFolder + System.IO.Path.DirectorySeparatorChar + templatesFolder)) { string f = System.IO.Path.GetFileNameWithoutExtension(s); w.Templates.Items.Add(f); } } catch (Exception e) { CCIUtilities.ErrorWindow ew = new CCIUtilities.ErrorWindow(); ew.Message = "Unable to access Templates folder; message = " + e.Message; ew.ShowDialog(); Environment.Exit(0); } w.Templates.SelectedIndex = 0; w.WindowStartupLocation = WindowStartupLocation.CenterScreen; if (!(bool)w.ShowDialog()) Environment.Exit(0); mode = w._mode; if (mode == 0) samples = w._sampCount1; else if (mode == 1) samples = w._sampCount2; else if (mode == 3) threshold = w._SDThresh; voice = (bool)w.Voice.IsChecked; hemisphere = w.Hemisphere.SelectedIndex; templateFileName = (string)w.Templates.SelectedValue; ETRFileName = System.IO.Path.GetFileNameWithoutExtension(w._etrFileName); useMonitor = (bool)w.Monitor.IsChecked; } else { mode = 0; //always single click samples = 1; //single sample only voice = true; hemisphere = 0; //X+ templateFileName = Environment.GetCommandLineArgs()[1]; ETRFileName = networkFolder + System.IO.Path.DirectorySeparatorChar + Environment.GetCommandLineArgs()[2]; useMonitor = true; } //Read in electrode array template XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreWhitespace = true; settings.IgnoreComments = true; settings.IgnoreProcessingInstructions = true; settings.CloseInput = true; XmlReader templateReader = XmlReader.Create(networkFolder + System.IO.Path.DirectorySeparatorChar + templatesFolder + System.IO.Path.DirectorySeparatorChar + templateFileName + ".xml", settings); //templates are always on network drive templateReader.MoveToContent(); templateReader.MoveToAttribute("N"); numberOfElectrodes = templateReader.ReadContentAsInt(); //number of items templateList = new List<electrodeTemplateListElement>(numberOfElectrodes); templateReader.ReadStartElement("ElectrodeNames"); for (int i = 0; i < numberOfElectrodes; i++) { templateReader.ReadStartElement("Electrode"); electrodeTemplateListElement ele = new electrodeTemplateListElement(); ele.Name = templateReader.ReadElementContentAsString("Print",""); if (templateReader.Name == "Speak") { ele.speakType = templateReader["Type"]; if (ele.speakType == "String") ele.speakString = templateReader.ReadElementContentAsString("Speak", ""); //read string to speak else { templateReader.ReadStartElement("Speak"); while (templateReader.Name != "Speak") ele.speakString += templateReader.ReadOuterXml(); //read SSML string to speak templateReader.ReadEndElement(/*Speak*/); } } else { ele.speakType = "None"; ele.speakString = null; } templateList.Add(ele); templateReader.ReadEndElement(/*Electrode*/); } templateReader.ReadEndElement(/*ElectrodeNames*/); templateReader.Close(); //Open electrode position file efs = new ElectrodeOutputFileStream( new FileStream(ETRFileName + "." + numberOfElectrodes.ToString("000") + ".etr", FileMode.Create, FileAccess.Write), typeof(XYZRecord)); electrodeLocations = new List<XYZRecord>(numberOfElectrodes); //set up temporary location list, so changes can be made projection = new Projection(eyeDistance); InitializeComponent(); this.MinWidth = (double)SystemInformation.WorkingArea.Width * 96D / screenDPI; this.MinHeight = (double)SystemInformation.WorkingArea.Height * 96D / screenDPI; //Initialize Polhemus into standard state try { PolhemusStream ps = new PolhemusStream(); p = new PolhemusController(ps); p.InitializeSystem(); p.SetEchoMode(PolhemusController.EchoMode.On); //Echo on p.OutputFormat(PolhemusController.Format.Binary); //Binary output int v = hemisphere % 2 == 1 ? -1 : 1; //set correct hemisphere of operation if (hemisphere < 2) p.HemisphereOfOperation(null, v, 0, 0); else if (hemisphere < 4) p.HemisphereOfOperation(null, 0, v, 0); else p.HemisphereOfOperation(null, 0, 0, v); p.SetUnits(PolhemusController.Units.Metric); //Metric measurements Type[] df1 = { typeof(CartesianCoordinates) }; //set up cartesian coordinate output only for stylus p.OutputDataList(1, df1); Type[] df2 = { typeof(CartesianCoordinates), typeof(DirectionCosineMatrix) }; //coordinates and direction cosines for reference sensor p.OutputDataList(2, df2); StylusAcquisition.Monitor c = null; if (useMonitor) c = Monitor; w = null; //free resources, if any if (mode == 0) { StylusAcquisition.SingleShot sm = SinglePoint; sa = new StylusAcquisition(p, sm, c); } else { StylusAcquisition.Continuous sm = ContinuousPoints; sa = new StylusAcquisition(p, sm, c); } AcquisitionFinished += new PointAcquisitionFinishedEventHandler(AcquisitionLoop); electrodeNumber = -3; //Fiducial points are first if(!standAlone) { Window2 w2 = new Window2(); w2.ElecTemplate.Text = Environment.GetCommandLineArgs()[1]; w2.Output.Text = Environment.GetCommandLineArgs()[2]; if (!(bool)w2.ShowDialog()) Environment.Exit(0); } AcquisitionLoop(sa, null); //Prime the pump! } catch (Exception e) { ErrorWindow ew = new ErrorWindow(); ew.Message = "Error in Polhemus initialization: " + e.Message; ew.ShowDialog(); Environment.Exit(1); } }
private void readExcel(string filename) { string bomsn = ""; try { string connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~/BOMFile/" + filename) + ";Extended Properties=\"Excel 8.0;HDR=NO;IMEX=1;\""; using (OleDbConnection conn = new OleDbConnection(connstring)) { conn.Open(); DataTable sheetsName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" }); //得到所有sheet的名字 //for(int k=0;k<sheetsName.Rows.Count;k++) //{ // log.Info(sheetsName.Rows[k][2].ToString()); //} string firstSheetName = sheetsName.Rows[0][2].ToString(); //得到第一个sheet的名字 string sql = string.Format("SELECT * FROM [{0}]", firstSheetName); //查询字符串 OleDbDataAdapter ada = new OleDbDataAdapter(sql, connstring); DataSet set = new DataSet(); ada.Fill(set); DataTable dt = set.Tables[0]; //for(int kk = 0; kk < dt.Columns.Count; kk++) //{ // log.Info(dt.Columns[kk].ColumnName); //} #region 判断版本号是否为数字和是否版本已存在 if (!CommFunction.IsNumeric(dt.Rows[3][9].ToString())) { Alert.Show("版本号必须为数字"); return; } SQLHelper.DbHelperSQL.SetConnectionString(""); sql = "select count(*) from probomheader where ProNo = '" + dt.Rows[3][2].ToString() + "' and Ver = '" + dt.Rows[3][7].ToString() + "'"; if (int.Parse(SQLHelper.DbHelperSQL.GetSingle(sql, 30)) > 0) { Alert.Show("该产品已经存在相同版本的工程BOM,请修改版本再上传!", MessageBoxIcon.Error); return; } #endregion #region 判断料号的合法性 DataTable errdt = new DataTable(); errdt.Columns.Add("Seq", typeof(string)); //数据类型为 文本 errdt.Columns.Add("ItemNo", typeof(string)); //数据类型为 文本 errdt.Columns.Add("ItemName", typeof(string)); //数据类型为 文本 errdt.Columns.Add("Spec", typeof(string)); //数据类型为 文本 errdt.Columns.Add("Material", typeof(string)); //数据类型为 文本 errdt.Columns.Add("SurfaceDeal", typeof(string)); //数据类型为 文本 DataTable errwldt = new DataTable(); errwldt.Columns.Add("Seq", typeof(string)); //数据类型为 文本 errwldt.Columns.Add("ItemNo", typeof(string)); //数据类型为 文本 errwldt.Columns.Add("ItemName", typeof(string)); //数据类型为 文本 errwldt.Columns.Add("Spec", typeof(string)); //数据类型为 文本 errwldt.Columns.Add("Material", typeof(string)); //数据类型为 文本 errwldt.Columns.Add("SurfaceDeal", typeof(string)); //数据类型为 文本 errwldt.Columns.Add("wlFrom", typeof(string)); //数据类型为 文本 int i = 5; int k = 0; Regex reg = new Regex(@"^[A-Z]{2}[\d]{4}$"); bool err = false; string seq = ""; for (; i < dt.Rows.Count; i++) { if (dt.Rows[i][0].ToString() == "锐 麟 铝 制 品 有 限 公 司" || dt.Rows[i][0].ToString() == "物料清单(BOM)" || dt.Rows[i][0].ToString() == "产品名称" || dt.Rows[i][0].ToString() == "产品编号" || dt.Rows[i][0].ToString() == "序号") { continue; } else { #region 判断料号的合法性 if (dt.Rows[i][0].ToString() == "" && dt.Rows[i][1].ToString() == "" && dt.Rows[i][2].ToString() == "" && dt.Rows[i][3].ToString() == "" && dt.Rows[i][4].ToString() == "" && dt.Rows[i][5].ToString() == "" && dt.Rows[i][6].ToString() == "" && dt.Rows[i][7].ToString() == "" && dt.Rows[i][8].ToString() == "" && dt.Rows[i][9].ToString() == "" && dt.Rows[i][10].ToString() == "" && dt.Rows[i][11].ToString() == "") { break; } else if (dt.Rows[i][0].ToString() != "" && dt.Rows[i][1].ToString() == "" && dt.Rows[i][2].ToString() == "" && dt.Rows[i][3].ToString() == "" && dt.Rows[i][4].ToString() == "" && dt.Rows[i][5].ToString() == "" && dt.Rows[i][6].ToString() == "" && dt.Rows[i][7].ToString() == "" && dt.Rows[i][8].ToString() == "" && dt.Rows[i][9].ToString() == "" && dt.Rows[i][10].ToString() == "" && dt.Rows[i][11].ToString() == "") { continue; } else { seq = dt.Rows[i][0].ToString(); string lastseq = dt.Rows[i - 1][0].ToString(); if (lastseq.IndexOf(".") != -1) { lastseq = lastseq.Substring(0, lastseq.LastIndexOf(".")); } #region 料号和序号不规范的物料 string tstr = dt.Rows[i][1].ToString().Replace(" ", ""); if (tstr.Length >= 6) { if (CommFunction.IsNumeric(tstr) && tstr.Length == 7) { #region 序号问题 if (seq.IndexOf(".") != -1 && seq.Substring(0, seq.LastIndexOf(".")) != lastseq && dt.Select("F1='" + seq.Substring(0, seq.LastIndexOf(".")) + "'").Count() == 0) { //如果已经存在错误列表中 不在重复添加 if (errdt.Select("Seq='" + dt.Rows[i - 1][0].ToString() + "'").Count() > 0) { continue; } log.Info("seq::::" + seq.Substring(0, seq.LastIndexOf(".")) + ":::lastseq:::" + lastseq + ":::::" + dt.Select("F1='" + seq.Substring(0, seq.LastIndexOf(".")) + "'").Count().ToString() + "::::::" + "F1='" + seq.Substring(0, seq.LastIndexOf(".")) + "'"); err = true; DataRow dr = errdt.NewRow(); dr[0] = dt.Rows[i - 1][0].ToString() + "(上一条)"; //通过索引赋值 dr[1] = dt.Rows[i - 1][1].ToString(); dr[2] = dt.Rows[i - 1][2].ToString(); //+ reg.Match(tstr).Success.ToString() dr[3] = dt.Rows[i - 1][3].ToString(); dr[4] = dt.Rows[i - 1][4].ToString(); dr[5] = dt.Rows[i - 1][5].ToString(); errdt.Rows.InsertAt(dr, k); k++; dr = errdt.NewRow(); dr[0] = dt.Rows[i][0].ToString(); //通过索引赋值 dr[1] = dt.Rows[i][1].ToString(); dr[2] = dt.Rows[i][2].ToString(); //+ reg.Match(tstr).Success.ToString() dr[3] = dt.Rows[i][3].ToString(); dr[4] = dt.Rows[i][4].ToString(); dr[5] = dt.Rows[i][5].ToString(); errdt.Rows.InsertAt(dr, k); k++; continue; } #endregion } else { #region 序号问题 if (seq.IndexOf(".") != -1 && seq.Substring(0, seq.LastIndexOf(".")) != lastseq && dt.Select("F1='" + seq.Substring(0, seq.LastIndexOf(".")) + "'").Count() == 0) { //如果已经存在错误列表中 不在重复添加 if (errdt.Select("Seq='" + dt.Rows[i - 1][0].ToString() + "'").Count() > 0) { continue; } //&& dt.Select("F1='" + seq.Substring(0, seq.LastIndexOf(".")) + "'").Count() > 0 log.Info("seq::::" + seq.Substring(0, seq.LastIndexOf(".")) + ":::lastseq:::" + lastseq + ":::::" + dt.Select("F1='" + seq.Substring(0, seq.LastIndexOf(".")) + "'").Count().ToString() + "::::::" + "F1='" + seq.Substring(0, seq.LastIndexOf(".")) + "'"); err = true; DataRow dr = errdt.NewRow(); dr[0] = dt.Rows[i - 1][0].ToString() + "(上一条)"; //通过索引赋值 dr[1] = dt.Rows[i - 1][1].ToString(); dr[2] = dt.Rows[i - 1][2].ToString(); //+ reg.Match(tstr).Success.ToString() dr[3] = dt.Rows[i - 1][3].ToString(); dr[4] = dt.Rows[i - 1][4].ToString(); dr[5] = dt.Rows[i - 1][5].ToString(); errdt.Rows.InsertAt(dr, k); k++; dr = errdt.NewRow(); dr[0] = dt.Rows[i][0].ToString(); //通过索引赋值 dr[1] = dt.Rows[i][1].ToString(); dr[2] = dt.Rows[i][2].ToString(); //+ reg.Match(tstr).Success.ToString() dr[3] = dt.Rows[i][3].ToString(); dr[4] = dt.Rows[i][4].ToString(); dr[5] = dt.Rows[i][5].ToString(); errdt.Rows.InsertAt(dr, k); k++; continue; } #endregion tstr = tstr.Substring(0, 6); #region 料号问题 if (!reg.Match(tstr).Success) { err = true; DataRow dr = errdt.NewRow(); dr[0] = dt.Rows[i][0].ToString(); //通过索引赋值 dr[1] = dt.Rows[i][1].ToString(); dr[2] = dt.Rows[i][2].ToString(); //+ reg.Match(tstr).Success.ToString() dr[3] = dt.Rows[i][3].ToString(); dr[4] = dt.Rows[i][4].ToString(); dr[5] = dt.Rows[i][5].ToString(); errdt.Rows.InsertAt(dr, k); k++; continue; } #endregion } } else { err = true; DataRow dr = errdt.NewRow(); dr[0] = dt.Rows[i][0].ToString(); //通过索引赋值 dr[1] = dt.Rows[i][1].ToString(); dr[2] = dt.Rows[i][2].ToString(); //+ reg.Match(tstr).Success.ToString() dr[3] = dt.Rows[i][3].ToString(); dr[4] = dt.Rows[i][4].ToString(); dr[5] = dt.Rows[i][5].ToString(); errdt.Rows.InsertAt(dr, k); k++; continue; } #endregion #region 一物多码 sql = "select sn,ItemNo,ItemName,Spec,Material,SurfaceDeal from RLItems where ItemNo='" + dt.Rows[i][1].ToString() + "' and ( ItemName!='" + dt.Rows[i][2].ToString() + "' or Spec!='" + dt.Rows[i][3].ToString() + "' or Material!='" + dt.Rows[i][4].ToString() + "' or SurfaceDeal!='" + dt.Rows[i][5].ToString() + "')"; log.Info("sql 一物多码::" + sql); DataTable dtwl = SQLHelper.DbHelperSQL.ReturnDataTable(sql, 30); if (dtwl != null && dtwl.Rows.Count > 0) { err = true; DataRow dr = errwldt.NewRow(); dr[0] = dt.Rows[i][0].ToString(); //通过索引赋值 dr[1] = dt.Rows[i][1].ToString(); dr[2] = dt.Rows[i][2].ToString(); //+ reg.Match(tstr).Success.ToString() dr[3] = dt.Rows[i][3].ToString(); dr[4] = dt.Rows[i][4].ToString(); dr[5] = dt.Rows[i][5].ToString(); dr[6] = "导入"; errwldt.Rows.InsertAt(dr, k); k++; DataRow dr2 = errwldt.NewRow(); dr2[0] = dtwl.Rows[0][0].ToString(); //通过索引赋值 dr2[1] = dtwl.Rows[0][1].ToString(); dr2[2] = dtwl.Rows[0][2].ToString(); //+ reg.Match(tstr).Success.ToString() dr2[3] = dtwl.Rows[0][3].ToString(); dr2[4] = dtwl.Rows[0][4].ToString(); dr2[5] = dtwl.Rows[0][5].ToString(); dr2[6] = "物料表"; errwldt.Rows.InsertAt(dr2, k); k++; } else { //物料不存在 DataRow dr = errwldt.NewRow(); dr[0] = dt.Rows[i][0].ToString(); //通过索引赋值 dr[1] = dt.Rows[i][1].ToString(); dr[2] = dt.Rows[i][2].ToString(); //+ reg.Match(tstr).Success.ToString() dr[3] = dt.Rows[i][3].ToString(); dr[4] = dt.Rows[i][4].ToString(); dr[5] = dt.Rows[i][5].ToString(); dr[6] = "物料不存在"; errwldt.Rows.InsertAt(dr, k); k++; } #endregion } #endregion } } if (err) { Session["errdt"] = errdt; Session["errwldt"] = errwldt; //str = str.TrimEnd(new char[] { ',' }); //Alert.Show(str); PageContext.RegisterStartupScript(Window1.GetShowReference("showerr.aspx", "有问题的物料", Unit.Parse("900"), Unit.Parse("800"))); return; } #endregion string sqlbase = "", sqldtl = "", sclass = "", ProName = "", ProNo = "", Ver = "", ClientCode = "", BomDate = "", ClientProNo = "", FileNo = "", Color = "";//产品名称、产品编号、版本、客户代号、日期、客户产品型号 ArrayList al = new ArrayList(); //获取表头 添加bombase if (dt != null && dt.Rows.Count >= 4) { seq = ""; ProName = dt.Rows[2][2].ToString(); ProNo = dt.Rows[3][2].ToString(); Color = dt.Rows[3][4].ToString(); Ver = dt.Rows[3][7].ToString(); //ClientCode = dt.Rows[2][9].ToString(); BomDate = dt.Rows[3][10].ToString().Replace(".", "-"); //ClientProNo = dt.Rows[3][5].ToString(); FileNo = dt.Rows[2][7].ToString(); //料号,名称,规格,材质,表面处理或颜色,底数,类别 //ItemNo,Name,Spec,MaterialNo,ItemColor,AddReserve1,ClassName sql = "select top 1 * from rlitems where itemno='" + ProNo + "' ";// or name='" + dt.Rows[2][2].ToString() + "' DataTable dtitem = SQLHelper.DbHelperSQL.ReturnDataTable(sql, 30); if (dtitem == null || dtitem.Rows.Count == 0) { sql = "insert into rlitems(itemno,itemname) values('" + ProNo + "','" + ProName + "')"; log.Info("sqlallitem::::" + sql); al.Add(sql); //产品名称、产品编号、版本、瑞麟编号、客户编号、客户代号、日期 sqlbase = "insert into ProBomHeader(ProName,ProNo,Ver,ClientProNo,ClientCode,BomDate,AllitemSN,Inputer,InputeDate,BomExcel,FileNo,Color) values('" + ProName + "','" + ProNo + "','" + Ver + "','" + ClientProNo + "','" + ClientCode + "','" + BomDate + "',(select sn from rlitems where itemno='" + ProNo + "'),'" + User.Identity.Name + "',getdate(),'" + filename + "','" + FileNo + "','" + Color + "')"; log.Info("sqlbase::::" + sqlbase); al.Add(sqlbase); SQLHelper.DbHelperSQL.ExecuteSqlTran(al); } else { //产品名称、产品编号、版本、瑞麟编号、客户编号、客户代号、日期 sqlbase = "insert into ProBomHeader(ProName,ProNo,Ver,ClientProNo,ClientCode,BomDate,AllitemSN,Inputer,InputeDate,BomExcel,FileNo,Color) values('" + ProName + "','" + ProNo + "','" + Ver + "','" + ClientProNo + "','" + ClientCode + "','" + BomDate + "'," + dtitem.Rows[0]["sn"].ToString() + ",'" + User.Identity.Name + "',getdate(),'" + filename + "','" + FileNo + "','" + Color + "')"; log.Info("sqlbase::::" + sqlbase); SQLHelper.DbHelperSQL.ExecuteSql(sqlbase, 30); } //查询新增bom的sn sql = "select max(sn) from ProBomHeader where ver='" + Ver + "' and prono='" + ProNo + "'"; log.Info(sql); SQLHelper.DbHelperSQL.SetConnectionString(""); bomsn = SQLHelper.DbHelperSQL.GetSingle(sql).ToString(); log.Info("bombasesn:::" + sql); al.Clear(); #region bomdtl add string proquantity = "0", basenum = "0"; for (i = 5; i < dt.Rows.Count; i++) { #region 判断数量和底数是否为空 proquantity = dt.Rows[i][6].ToString(); if (!string.IsNullOrEmpty(proquantity)) { if (proquantity.IndexOf("/") != -1) { proquantity = (float.Parse(proquantity.Substring(0, proquantity.IndexOf("/"))) / float.Parse(proquantity.Substring(proquantity.IndexOf("/") + 1))).ToString(); } } else { proquantity = "0"; } basenum = dt.Rows[i][7].ToString(); if (string.IsNullOrEmpty(basenum)) { basenum = "0"; } #endregion if (dt.Rows[i][0].ToString() == "锐 麟 铝 制 品 有 限 公 司" || dt.Rows[i][0].ToString() == "物料清单(BOM)" || dt.Rows[i][0].ToString() == "产品名称" || dt.Rows[i][0].ToString() == "锐麟编号" || dt.Rows[i][0].ToString() == "序号") { sclass = ""; continue; } else { #region if (dt.Rows[i][0].ToString() == "" && dt.Rows[i][1].ToString() == "" && dt.Rows[i][2].ToString() == "" && dt.Rows[i][3].ToString() == "" && dt.Rows[i][4].ToString() == "" && dt.Rows[i][5].ToString() == "" && dt.Rows[i][6].ToString() == "" && dt.Rows[i][7].ToString() == "" && dt.Rows[i][8].ToString() == "" && dt.Rows[i][9].ToString() == "") { break; } else if (dt.Rows[i][0].ToString() != "" && dt.Rows[i][1].ToString() == "" && dt.Rows[i][2].ToString() == "" && dt.Rows[i][3].ToString() == "" && dt.Rows[i][4].ToString() == "" && dt.Rows[i][5].ToString() == "" && dt.Rows[i][6].ToString() == "" && dt.Rows[i][7].ToString() == "" && dt.Rows[i][8].ToString() == "" && dt.Rows[i][9].ToString() == "") { sclass = dt.Rows[i][0].ToString(); } else { #region bomdtl add //料号,名称,规格,材质,表面处理或颜色,底数,类别 //ItemNo,Name,Spec,MaterialNo,ItemColor,AddReserve1,ClassName sql = "select top 1 * from rlitems where itemno='" + dt.Rows[i][1].ToString() + "' ";//or name='" + dt.Rows[i][2].ToString() + "' dtitem = SQLHelper.DbHelperSQL.ReturnDataTable(sql, 30); seq = dt.Rows[i][0].ToString(); int num = Regex.Matches(seq, ".").Count; if (dtitem == null || dtitem.Rows.Count == 0) { #region sql = "insert into rlitems(itemno,itemname,Spec,Material,SurfaceDeal,ProUsingQuantity,BaseNum,WorkShop,MainFrom,Sclass,StoreHouse,zongcheng) values('" + dt.Rows[i][1].ToString() + "','" + dt.Rows[i][2].ToString() + "','" + dt.Rows[i][3].ToString() + "','" + dt.Rows[i][4].ToString() + "','" + dt.Rows[i][5].ToString() + "'," + proquantity + "," + basenum + ",'" + dt.Rows[i][8].ToString() + "','" + dt.Rows[i][9].ToString() + "','" + dt.Rows[i][10].ToString() + "','" + dt.Rows[i][11].ToString() + "','" + sclass + "')"; log.Info("sqlallitem::::" + sql); SQLHelper.DbHelperSQL.ExecuteSql(sql, 30); if (seq.IndexOf(".") != -1) { sqldtl = "insert into ProBomDetail(FSN,AllitemSN,ItemNo,ItemName,Spec,Material,SurfaceDeal,ProUsingQuantity,ZongCheng,Inputer,InputeDate,seq,parentsn,ZuHe,BaseNum,WorkShop,MainFrom,Sclass,StoreHouse) values(" + bomsn + ",(select sn from rlitems where itemno='" + dt.Rows[i][1].ToString() + "'),'" + dt.Rows[i][1].ToString() + "','" + dt.Rows[i][2].ToString() + "','" + dt.Rows[i][3].ToString() + "','" + dt.Rows[i][4].ToString() + "','" + dt.Rows[i][5].ToString() + "'," + proquantity + ",'" + sclass + "','" + User.Identity.Name + "',getdate(),'" + dt.Rows[i][0].ToString() + "',(select sn from ProBomDetail where seq='" + seq.Substring(0, seq.LastIndexOf(".")) + "' and fsn=" + bomsn + "),1," + basenum + ",'" + dt.Rows[i][8].ToString() + "','" + dt.Rows[i][9].ToString() + "','" + dt.Rows[i][10].ToString() + "','" + dt.Rows[i][11].ToString() + "')"; } else { //bomsn,物料sn,料号,名称,规格,材质,表面处理,用量,分类 sqldtl = "insert into ProBomDetail(FSN,AllitemSN,ItemNo,ItemName,Spec,Material,SurfaceDeal,ProUsingQuantity,ZongCheng,Inputer,InputeDate,seq,ZuHe,BaseNum,WorkShop,MainFrom,Sclass,StoreHouse) values(" + bomsn + ",(select sn from rlitems where itemno='" + dt.Rows[i][1].ToString() + "'),'" + dt.Rows[i][1].ToString() + "','" + dt.Rows[i][2].ToString() + "','" + dt.Rows[i][3].ToString() + "','" + dt.Rows[i][4].ToString() + "','" + dt.Rows[i][5].ToString() + "'," + proquantity + ",'" + sclass + "','" + User.Identity.Name + "',getdate(),'" + dt.Rows[i][0].ToString() + "',0," + basenum + ",'" + dt.Rows[i][8].ToString() + "','" + dt.Rows[i][9].ToString() + "','" + dt.Rows[i][10].ToString() + "','" + dt.Rows[i][11].ToString() + "')"; } #endregion log.Info("sqldtl::::" + sqldtl); al.Add(sqldtl); SQLHelper.DbHelperSQL.ExecuteSql(sqldtl, 30); } else { //sql = "update rlitems set (itemno,itemname,Spec,Material,SurfaceDeal,ProUsingQuantity,BaseNum,WorkShop,MainFrom,Sclass,StoreHouse,zongcheng) values('" + dt.Rows[i][1].ToString() + "','" + dt.Rows[i][2].ToString() + "','" + dt.Rows[i][3].ToString() + "','" + dt.Rows[i][4].ToString() + "','" + dt.Rows[i][5].ToString() + "'," + proquantity + "," + basenum + ",'" + dt.Rows[i][8].ToString() + "','" + dt.Rows[i][9].ToString() + "','" + dt.Rows[i][10].ToString() + "','" + dt.Rows[i][11].ToString() + "','" + sclass + "')"; #region if (seq.IndexOf(".") != -1) { //bomsn,物料sn,料号,名称,规格,材质,表面处理,用量,分类 sqldtl = "insert into ProBomDetail(FSN,AllitemSN,ItemNo,ItemName,Spec,Material,SurfaceDeal,ProUsingQuantity,ZongCheng,Inputer,InputeDate,seq,parentsn,ZuHe,BaseNum,WorkShop,MainFrom,Sclass,StoreHouse) values(" + bomsn + "," + dtitem.Rows[0]["sn"].ToString() + ",'" + dt.Rows[i][1].ToString() + "','" + dt.Rows[i][2].ToString() + "','" + dt.Rows[i][3].ToString() + "','" + dt.Rows[i][4].ToString() + "','" + dt.Rows[i][5].ToString() + "'," + proquantity + ",'" + sclass + "','" + User.Identity.Name + "',getdate(),'" + dt.Rows[i][0].ToString() + "',(select sn from ProBomDetail where seq='" + seq.Substring(0, seq.LastIndexOf(".")) + "' and fsn=" + bomsn + "),1,'" + basenum + "','" + dt.Rows[i][8].ToString() + "','" + dt.Rows[i][9].ToString() + "','" + dt.Rows[i][10].ToString() + "','" + dt.Rows[i][11].ToString() + "')"; } else { //bomsn,物料sn,料号,名称,规格,材质,表面处理,用量,分类 sqldtl = "insert into ProBomDetail(FSN,AllitemSN,ItemNo,ItemName,Spec,Material,SurfaceDeal,ProUsingQuantity,ZongCheng,Inputer,InputeDate,seq,ZuHe,BaseNum,WorkShop,MainFrom,Sclass,StoreHouse) values(" + bomsn + "," + dtitem.Rows[0]["sn"].ToString() + ",'" + dt.Rows[i][1].ToString() + "','" + dt.Rows[i][2].ToString() + "','" + dt.Rows[i][3].ToString() + "','" + dt.Rows[i][4].ToString() + "','" + dt.Rows[i][5].ToString() + "'," + proquantity + ",'" + sclass + "','" + User.Identity.Name + "',getdate(),'" + dt.Rows[i][0].ToString() + "',0," + basenum + ",'" + dt.Rows[i][8].ToString() + "','" + dt.Rows[i][9].ToString() + "','" + dt.Rows[i][10].ToString() + "','" + dt.Rows[i][11].ToString() + "')"; } #endregion SQLHelper.DbHelperSQL.ExecuteSql(sqldtl, 30); log.Info("sqldtl::::" + sqldtl); sql = "update proBomDetail set subsn=SN where subsn is null"; SQLHelper.DbHelperSQL.ExecuteSql(sqldtl, 30); al.Add(sqldtl); } #endregion } #endregion } } //if (SQLHelper.DbHelperSQL.ExecuteSqlTran(al)) //{ Alert.Show("导入成功"); //} //else //{ // Alert.Show("导入失败"); //} //al.Clear(); #endregion } else { Alert.Show("NO Data"); } } } catch (Exception ee) { string sql = "delete proBomHeader where sn=" + bomsn; ArrayList al = new ArrayList(); al.Add(sql); sql = "delete proBomDetail where fsn=" + bomsn; SQLHelper.DbHelperSQL.SetConnectionString(""); SQLHelper.DbHelperSQL.ExecuteSqlTran(al); log.Info(ee.ToString()); Alert.Show(ee.Message); } finally { BindGrid(); } }
public void TestWPF() { Window1 form = new Window1(); form.Show(); }
protected override void billGoods() { if (PubFunc.FormDataCheck(FormDoc).Length > 1) { return; } PubFunc.FormLock(FormDoc, true, ""); tbxMEMO.Enabled = true; //参数说明:cx-查询内容,bm-商品配置部门,su-供应商 string url = "~/ERPQuery/ContantWindow_His.aspx?bm=" + docDEPTID.SelectedValue + "&cx=&su=N"; PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hfdValue.ClientID) + Window1.GetShowReference(url, "可修改定数商品信息查询")); }
//protected void Button1_Click(object sender, AjaxEventArgs e)//记录走动开始时间 //{ // //PCPersonID(); // RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel; // if (sm.SelectedRows.Count > 0) // { // updateStartTime(Convert.ToInt32(sm.SelectedRows[0].RecordID.Trim())); // bindPlan(); // } //} //protected void Button2_Click(object sender, AjaxEventArgs e)//记录走动结束时间 //{ // //PCPersonID(); // RowSelectionModel sm = this.GridPanel1.SelectionModel.Primary as RowSelectionModel; // if (sm.SelectedRows.Count > 0) // { // updateEndTime(Convert.ToInt32(sm.SelectedRows[0].RecordID.Trim())); // bindPlan(); // } //} protected void Button3_Click(object sender, AjaxEventArgs e) { Window1.Show(); }
/// <summary> /// 点击编制 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCompile_Click(object sender, EventArgs e) { PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("EditManagerRuleTemplate.aspx", "编辑 - "))); }
protected void cmdADD(object sender, DirectEventArgs e) { this.btnAdd.Disabled = true; info_date.Text = toDay; Window1.Show(); }
private void LoadData() { btnNew.OnClientClick = Window1.GetShowReference("~/Pages/HR/Org_Form.aspx", "新增部门"); BindGrid(); }
protected void BtnAccept_Click(object sender, DirectEventArgs e) { DataTable dt; string sql = ""; sql = "SELECT dv_id FROM dv_05 "; sql += "WHERE infoDate = '" + _Get_YMD2(info_date.Text) + "'"; dt = db.Query(sql); if (dt.Rows.Count > 0) { string index = dt.Rows[0]["dv_id"].ToString(); sql = "UPDATE dv_05 "; sql += "SET infoDate='" + _Get_YMD2(info_date.Text) + "', "; sql += "CenterArea='" + txt_centerArea.Text + "', "; sql += "DialysisArea='" + txt_dialysisArea.Text + "', "; sql += "BedZone1='" + txt_bedZone1.Text + "', "; sql += "BedZone2='" + txt_bedZone2.Text + "', "; sql += "BedZone3='" + txt_bedZone3.Text + "', "; sql += "BedZone4='" + txt_bedZone4.Text + "', "; sql += "dvKind1='" + txt_dvKind1.Text + "', "; sql += "dvKind2='" + txt_dvKind2.Text + "', "; sql += "dvKind3='" + txt_dvKind3.Text + "', "; sql += "dvKind4='" + txt_dvKind4.Text + "', "; sql += "Eng1='" + txt_engineer1.Text + "', "; sql += "Eng2='" + txt_engineer2.Text + "', "; sql += "Eng3='" + txt_engineer3.Text + "', "; sql += "Eng4='" + txt_engineer4.Text + "' "; sql += "WHERE dv_id='" + index + "';"; } else { sql = "INSERT INTO dv_05 "; sql += "(infoDate, CenterArea, DialysisArea, BedZone1, BedZone2, BedZone3, BedZone4, dvKind1, dvKind2, dvKind3, dvKind4, Eng1, Eng2, Eng3, Eng4) "; sql += "VALUES ('" + _Get_YMD2(info_date.Text) + "','"; sql += txt_centerArea.Text + "','"; sql += txt_dialysisArea.Text + "','"; sql += txt_bedZone1.Text + "','"; sql += txt_bedZone2.Text + "','"; sql += txt_bedZone3.Text + "','"; sql += txt_bedZone4.Text + "','"; sql += txt_dvKind1.Text + "','"; sql += txt_dvKind2.Text + "','"; sql += txt_dvKind3.Text + "','"; sql += txt_dvKind4.Text + "','"; sql += txt_engineer1.Text + "','"; sql += txt_engineer2.Text + "','"; sql += txt_engineer3.Text + "','"; sql += txt_engineer4.Text + "');"; } try { db.Excute(sql); } catch { } ClearWindow(); Window1.Close(); GridPanelBind(); this.btnAdd.Enable(true); }
protected override void OnExecute(object param) { BSkyMouseBusyHandler.ShowMouseBusy();//ShowProgressbar_old(); IUnityContainer container = LifetimeService.Instance.Container; IDataService service = container.Resolve <IDataService>(); IUIController controller = container.Resolve <IUIController>(); if (controller.GetActiveDocument().isUnprocessed) { NewDatasetProcessor procDS = new NewDatasetProcessor(); bool isProcessed = procDS.ProcessNewDataset("", true); if (isProcessed)//true:empty rows cols removed successfully. False: whole dataset was empty and nothing was removed. { controller.GetActiveDocument().isUnprocessed = false; } else { BSkyMouseBusyHandler.HideMouseBusy(); MessageBox.Show("The dataset is empty. Please populate the dataset and save the file.", "Empty Dataset", MessageBoxButton.OK, MessageBoxImage.Information); return; } } //Get current filetype from loaded dataset. This is file extension and Filter DataSource actds = controller.GetActiveDocument();//06Nov2012 if (actds == null) { return; } string datasetName = "" + actds.Name;//uadatasets$lst$ //string datasetName = "uadatasets$lst$" + controller.GetActiveDocument().Name; //Also try to get the filename of currently loaded file. This is FileName. string extension = controller.GetActiveDocument().Extension; string filename = controller.GetActiveDocument().FileName; SaveFileDialog saveasFileDialog = new SaveFileDialog(); saveasFileDialog.Filter = FileNameFilter; //CheckBox cbox = new CheckBox(); //saveasFileDialog.FileName = filename;////// Window1 appwin = LifetimeService.Instance.Container.Resolve <Window1>(); bool? output = saveasFileDialog.ShowDialog(appwin);//Application.Current.MainWindow); if (output.HasValue && output.Value) { service.SaveAs(saveasFileDialog.FileName, controller.GetActiveDocument()); // #0 controller.GetActiveDocument().Changed = false; //21Mar2014 during close it should not prompt again for saving if (System.IO.File.Exists(saveasFileDialog.FileName)) { //Close current Dataset on whic Save As was run FileCloseCommand fcc = new FileCloseCommand(); fcc.CloseDataset(false); //Open Dataset that was SaveAs-ed. FileOpenCommand fo = new FileOpenCommand(); fo.FileOpen(saveasFileDialog.FileName); } else { BSkyMouseBusyHandler.HideMouseBusy();//HideProgressbar_old(); MessageBox.Show(BSky.GlobalResources.Properties.Resources.SaveAsFailed + saveasFileDialog.FileName, BSky.GlobalResources.Properties.Resources.InternalError, MessageBoxButton.OK, MessageBoxImage.Asterisk); } } BSkyMouseBusyHandler.HideMouseBusy();//HideProgressbar_old(); }
protected void BtnCancel_Click(object sender, DirectEventArgs e) { Window1.Close(); ClearWindow(); this.btnAdd.Enable(true); }
public string AddRubbing(T_Rubbing rubbing, string[] Paths) { string[] photoPaths = GetPhotoPaths(Paths); string[] textPaths = GetTextPaths(Paths); //string errorMsg = IsValidatedPhoto(photoPaths); string errorMsg = GetErrorMsg(Paths, photoPaths, textPaths); if (!string.IsNullOrEmpty(errorMsg)) return errorMsg; //MainViewModel mvm = new MainViewModel(photoPaths); //foreach (var p in photoPaths) //{ // if(p!=null) // mvm.Images.Add(p); //} CalligraphyEditor.App.Entities.AddToT_Rubbing(rubbing); CalligraphyEditor.App.Entities.SaveChanges(); var q = from f in photoPaths orderby f select f; photoPaths = q.ToArray<string>(); rubbingPhotos = new ObservableCollection<T_RubbingPhoto>(); int pageNumber = 1; int i,j; for (i = 0, j = 0; i < Math.Max(photoPaths.Length, textPaths.Length) || j < Math.Max(photoPaths.Length, textPaths.Length); i++, j++) { if (j < textPaths.Length) { string PhotoNameWithoutExtension = GetFileNameWithoutExtension(GetSafeFileName(photoPaths[i])); string TextNameWithoutExtension = GetFileNameWithoutExtension(GetSafeFileName(textPaths[j])); T_RubbingPhoto rubbingPhoto = UploadPhoto(photoPaths[i]); string txtString = GetTxtString(textPaths[j]); if (rubbingPhoto != null) { rubbingPhoto.PageNumber = pageNumber; pageNumber++; if (PhotoNameWithoutExtension.Equals(TextNameWithoutExtension)) { rubbingPhoto.Name = txtString; } } MessageBox.Show(rubbingPhoto.PhotoBitmapImage); rubbingPhotos.Add(rubbingPhoto); } } Window1 w1 = new Window1(); w1.ShowDialog(); ShowPhotoAndText spt = new ShowPhotoAndText(); //spt.DataContext = mvm; spt.ShowDialog(); //foreach (var photoPath in photoPaths) //{ // T_RubbingPhoto rubbingPhoto = UploadPhoto(photoPath); // if (rubbingPhoto != null) // { // rubbingPhoto.PageNumber = pageNumber; // pageNumber++; // rubbingPhotos.Add(rubbingPhoto); // } //} foreach (var rubbingPhoto in rubbingPhotos) { rubbingPhoto.RubbingID = rubbing.ID; rubbingPhoto.T_Rubbing = rubbing; rubbing.T_RubbingPhoto.Add(rubbingPhoto); CalligraphyEditor.App.Entities.AddToT_RubbingPhoto(rubbingPhoto); } CalligraphyEditor.App.Entities.SaveChanges(); _Ocl_Rubbings.Add(rubbing); return string.Empty; }
protected void Page_Load(object sender, EventArgs e) { Button4.OnClientClick = Window1.GetShowReference("~/bugTracer/create_bug.aspx", "新增"); BindGrid(); }
void IComponentConnector.Connect(int connectionId, object target) { int i = connectionId; if (i != 1) { } else { modelWindow = (Window1)target; return; } //_contentLoaded = true; }
protected string GetEditUrl(object id, object name) { return(Window1.GetShowReference("~/bugTracer/bug_details.aspx?id=" + id, "编辑 - " + name)); }
void AppStartingUp(object sender, StartupEventArgs e) { Window1 mainWindow = new Window1(); mainWindow.Show(); }
protected void ShowDetails(object sender, ExtAspNet.GridRowClickEventArgs e) { Alert.ShowInTop(String.Format("你点击了第 {0} 行(双击)", e.RowIndex)); Window1.GetShowReference("~/bugTracer/create_bug.aspx", "查看"); }
public MainWindow() { bool r; do //first get HDR file and open BDF file { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Open Header of dataset to be edited..."; dlg.DefaultExt = ".hdr"; // Default file extension dlg.Filter = "HDR Files (.hdr)|*.hdr"; // Filter files by extension Nullable<bool> result = dlg.ShowDialog(); if (result == null || result == false) Environment.Exit(0); directory = System.IO.Path.GetDirectoryName(dlg.FileName); //will use to find other files in dataset headerFileName = System.IO.Path.GetFileNameWithoutExtension(dlg.FileName); header = (new HeaderFileReader(dlg.OpenFile())).read(); updateFlag = header.Events.ContainsKey("**ArtifactBegin"); //indicates that we are editing a dataset that has already been edited for artifacts bdf = new BDFEDFFileReader(new FileStream(System.IO.Path.Combine(directory, header.BDFFile), FileMode.Open, FileAccess.Read)); //make list of candidate EEG channels, so that channel selection window can use it BDFLength = (double)bdf.NumberOfRecords * bdf.RecordDuration; string trans = bdf.transducer(0); //here we assumne that channel 0 is an EEG channel for (int i = 0; i < bdf.NumberOfChannels - 1; i++) //exclude Status channel if (bdf.transducer(i) == trans) EEGChannels.Add(i); Window1 w = new Window1(this); //open channel selection and file approval window r = (bool)w.ShowDialog(); } while (r == false); InitializeComponent(); Log.writeToLog("Starting EEGArtifactEditor " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + " on dataset " + headerFileName); ViewerGrid.Width = BDFLength; try { //process Events in current dataset; we have to do this now in case this is an update situation, but don't have to when we finish Event.EventFactory.Instance(header.Events); // set up the factory, based on this Event dictionary //and read them in EventFileReader efr = new EventFileReader( new FileStream(System.IO.Path.Combine(directory, header.EventFile), FileMode.Open, FileAccess.Read)); // open Event file foreach (InputEvent ie in efr)// read in all Events into list events.Add(new OutputEvent(ie)); efr.Close(); //now events is list of Events in the dataset //now set zeroTime for this BDF file, after finding an appropriate (non-"naked") Event bool ok = false; foreach (OutputEvent ev in events) if (header.Events[ev.Name].IsCovered) { bdf.setZeroTime(ev); ok = true; break; } if (!ok) { ErrorWindow ew = new ErrorWindow(); ew.Message = "Unable to find a covered Event in this dataset on which to synchronize clocks. Exiting."; ew.ShowDialog(); Log.writeToLog("Unable to synchronize clocks."); this.Close(); } if (updateFlag) //re-editing this dataset for artifacts { Event.EventFactory.Instance(header.Events); // set up the factory, based on this Event dictionary //and read them in OutputEvent ev; int i = 0; double left; while (i < events.Count) { ev = events[i]; if (ev.Name == "**ArtifactBegin") { left = bdf.timeFromBeginningOfFileTo(ev); events.Remove(ev); while (i < events.Count) { ev = events[i]; if (ev.Name == "**ArtifactEnd") { MarkerCanvas.createMarkRegion(left, bdf.timeFromBeginningOfFileTo(ev)); events.Remove(ev); break; } if (ev.Name == "**ArtifactBegin") throw (new Exception("Unmatched artifact Event in Event file " + System.IO.Path.Combine(directory, header.EventFile))); i++; } } else i++; } } //initialize the individual channel canvases foreach (int chan in selectedEEGChannels) { ChannelCanvas cc = new ChannelCanvas(this, chan); currentChannelList.Add(cc); ViewerCanvas.Children.Add(cc); ViewerCanvas.Children.Add(cc.offScaleRegions); } Title = headerFileName; //set window title BDFFileInfo.Content = bdf.ToString(); HDRFileInfo.Content = header.ToString(); ElectrodeInputFileStream eif = new ElectrodeInputFileStream( new FileStream(System.IO.Path.Combine(directory, header.ElectrodeFile), FileMode.Open, FileAccess.Read)); //open Electrode file electrodes = eif.etrPositions; //initialize vertical gridline array; never more than 18 for (int i = 0; i < 18; i++) { Line l = new Line(); Grid.SetRow(l, 0); Grid.SetColumn(l, 0); l.Y1 = 0D; l.HorizontalAlignment = HorizontalAlignment.Left; l.VerticalAlignment = VerticalAlignment.Stretch; l.IsHitTestVisible = false; l.Stroke = Brushes.LightBlue; l.Visibility = Visibility.Hidden; Panel.SetZIndex(l, int.MaxValue); VerticalGrid.Children.Add(l); gridlines[i] = l; } //Initialize timer timer.AutoReset = true; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); //Initialize channel information popup Color c1 = Color.FromArgb(0xFF, 0xF8, 0xF8, 0xF8); Color c2 = Color.FromArgb(0xFF, 0xC8, 0xC8, 0xC8); popupTB.Background = new LinearGradientBrush(c1, c2, 45D); popupTB.Foreground = Brushes.Black; popupTB.Padding = new Thickness(4D); Border b = new Border(); b.BorderThickness = new Thickness(1); b.CornerRadius = new CornerRadius(4); b.BorderBrush = Brushes.Tomato; b.Margin = new Thickness(0, 0, 24, 24); //allows drop shadow to show up b.Effect = new DropShadowEffect(); b.Child = popupTB; channelPopup.Placement = PlacementMode.MousePoint; channelPopup.AllowsTransparency = true; channelPopup.Child = b; //Initialize FOV slider FOV.Maximum = Math.Log10(BDFLength); FOV.Value = 1D; FOVMax.Text = BDFLength.ToString("0"); //Note file always uses the "main" orginal dataset name, which should be the BDFFile name; this keeps notes from all levels of //processing in the same place noteFilePath = System.IO.Path.Combine(directory, System.IO.Path.GetFileNameWithoutExtension(header.BDFFile) + ".notes.txt"); } catch (Exception ex) { ErrorWindow ew = new ErrorWindow(); ew.Message = "Error in EEGArtifactEditor initialization" + ex.Message; ew.ShowDialog(); this.Close(); //exit } //from here on the program is GUI-event driven }
/// <summary> /// 费用明细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUrl_Click(object sender, EventArgs e) { string window = String.Format("HSSECostUnitManageAuditItemView.aspx?HSSECostUnitManageId={0}&Type={1}", this.HSSECostUnitManageId, ((FineUIPro.ControlBase)sender).ID.Replace("btn", ""), "增加 - "); PageContext.RegisterStartupScript(Window1.GetShowReference(window)); }
private void SaveXML_Click(object sender, RoutedEventArgs e) { var newW = new Window1(this); newW.Show(); }
private void ListViewItem_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { Window1 mv = (Window1)Window.GetWindow(this); mv.ProcessChatCommand(this, new CommandEventArgs(Command.Perform, ((PerformanceListViewItem)((ListViewItem)sender).Content).RelativePath)); }
private void StopButton_Click(object sender, RoutedEventArgs e) { Window1 mv = (Window1)Window.GetWindow(this); mv.ProcessChatCommand(this, new CommandEventArgs(Command.PerformStop, string.Empty)); }
public static void ClassInit(TestContext testContext) { metlWindow = new Window1(); //metlWindow.Show(); }