private void BindData() { time Time = new time(); DateTime T1, T2; T1 = Convert.ToDateTime(Time.GetStartTime()); T2 = Convert.ToDateTime(Time.GetEndTime()); date1.Text = T1.ToString("yyyy-MM-dd"); date2.Text = T2.ToString("yyyy-MM-dd"); }
private void button_PrintDetail_Click(object sender, EventArgs e) { // Print MyTools.sPrintTopic = "操作员汇总打印功能"; MyTools.sPrintID = ""; MyTools.oPrintData = new string[3000]; int i = 0; //MyTools.oPrintData[i++] = "操作员号:" + MyStart.giUserID.ToString(); //MyTools.oPrintData[i++] = "操作员名:" + MyStart.gszUsername.ToString(); MyTools.oPrintData[i++] = "开始统计:" + T1.ToString("yyyy-MM-dd HH:mm:ss"); MyTools.oPrintData[i++] = "结束统计:" + T2.ToString("yyyy-MM-dd HH:mm:ss"); MyTools.oPrintData[i++] = "----------------------------------------"; MyTools.oPrintData[i++] = "明细情况:"; if (dataGridView1.Rows.Count > 0) //已经找到记录了 { for (int j = 0; j < dataGridView1.Rows.Count; j++) { MyTools.oPrintData[i++] = "IC 卡 号:" + dataGridView1.Rows[j].Cells[0].Value.ToString(); MyTools.oPrintData[i++] = "交易时间:" + dataGridView1.Rows[j].Cells[1].Value.ToString(); MyTools.oPrintData[i++] = "操作类型:" + dataGridView1.Rows[j].Cells[2].Value.ToString(); MyTools.oPrintData[i++] = "变化金额:" + dataGridView1.Rows[j].Cells[3].Value.ToString(); MyTools.oPrintData[i++] = "金额小计:" + dataGridView1.Rows[j].Cells[4].Value.ToString(); if (j < dataGridView1.Rows.Count - 1) { MyTools.oPrintData[i++] = "---------------"; } } } MyTools.oPrintData[i++] = "----------------------------------------"; MyTools.oPrintData[i++] = "汇总情况:"; MyTools.oPrintData[i++] = "买方充值:" + dataGridView2.Rows[0].Cells[1].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[1].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "卖方充值:" + dataGridView2.Rows[0].Cells[2].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[2].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "收入合计:" + dataGridView2.Rows[0].Cells[3].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[3].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "----------------------------------------"; MyTools.oPrintData[i++] = "买方取款:" + dataGridView2.Rows[0].Cells[4].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[4].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "卖方取款:" + dataGridView2.Rows[0].Cells[5].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[5].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "支出合计:" + dataGridView2.Rows[0].Cells[6].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[6].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "----------------------------------------"; MyTools.oPrintData[i++] = "结余合计:" + dataGridView2.Rows[0].Cells[7].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[7].Value.ToString().PadLeft(11) + "元"; MyTools.iPrintData = i; MyTools.PrintTicket(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) { Response.Redirect("~/login.html"); } if (!IsPostBack) { time Time = new time(); DateTime T1, T2; T1 = Convert.ToDateTime(Time.GetStartTime()); T2 = Convert.ToDateTime(Time.GetEndTime()); date1.Text = T1.ToString("yyyy-MM-dd"); date2.Text = T2.ToString("yyyy-MM-dd"); BindData(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("~/login.html"); } if (!IsPostBack) { role_User user = new role_User(); time Time = new time(); llname.Text = user.GetUserName(Session["user"].ToString());//Session["user"].ToString()是teachername DateTime T1, T2; T1 = Convert.ToDateTime(Time.GetStartTime()); T2 = Convert.ToDateTime(Time.GetEndTime()); date1.Text = T1.ToString("yyyy-MM-dd"); date2.Text = T2.ToString("yyyy-MM-dd"); BindData(); } }
private void button_Print_Click(object sender, EventArgs e) { // Print MyTools.sPrintTopic = "操作员汇总打印功能"; MyTools.sPrintID = ""; MyTools.oPrintData = new string[50]; int i = 0; //MyTools.oPrintData[i++] = "操作员号:" + MyStart.giUserID.ToString(); //MyTools.oPrintData[i++] = "操作员名:" + MyStart.gszUsername.ToString(); MyTools.oPrintData[i++] = "开始统计:" + T1.ToString("yyyy-MM-dd HH:mm:ss"); MyTools.oPrintData[i++] = "结束统计:" + T2.ToString("yyyy-MM-dd HH:mm:ss"); MyTools.oPrintData[i++] = ""; MyTools.oPrintData[i++] = "工作情况:"; MyTools.oPrintData[i++] = "买方充值:" + dataGridView2.Rows[0].Cells[1].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[1].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "卖方充值:" + dataGridView2.Rows[0].Cells[2].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[2].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "收入合计:" + dataGridView2.Rows[0].Cells[3].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[3].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "----------------------------------------"; MyTools.oPrintData[i++] = "买方取款:" + dataGridView2.Rows[0].Cells[4].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[4].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "卖方取款:" + dataGridView2.Rows[0].Cells[5].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[5].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "支出合计:" + dataGridView2.Rows[0].Cells[6].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[6].Value.ToString().PadLeft(11) + "元"; MyTools.oPrintData[i++] = "----------------------------------------"; MyTools.oPrintData[i++] = "结余合计:" + dataGridView2.Rows[0].Cells[7].Value.ToString().PadLeft(8) + "笔," + dataGridView2.Rows[1].Cells[7].Value.ToString().PadLeft(11) + "元"; MyTools.iPrintData = i; MyTools.PrintTicket(); }
private void calFreq_Click(object sender, RoutedEventArgs e) { double T1, T2, Fr; string freq, chargeTime, dischargeTime; string[] an = new string[3]; R1 = Convert.ToInt32(slR1.Value); R2 = Convert.ToInt32(slR2.Value); T1 = (R1 + R2) * C1 * 0.693; T2 = R1 * C1 * 0.693; Fr = 1 / ((R1 + (2 * R2)) * C1 * 0.693); chargeTime = T1.ToString("F6"); dischargeTime = T2.ToString("F6"); freq = Fr.ToString("F3"); an[0] = "T1 = " + chargeTime + Environment.NewLine; an[1] = "T2 = " + dischargeTime + Environment.NewLine; an[2] = "Frequency = " + freq; tbOut.Text = an[0] + an[1] + an[2]; }
private void button_Search_Click(object sender, EventArgs e) { int iNum = 0; int iValue = 0; int iRet = 0; float fi = 0; string sMsg = ""; string sSqlString = ""; string sTmp = ""; DataSet DS = null; ClearGrid(); iNum = 0; iValue = 0; iUserAddNum = 0; fUserAddValue = 0; iFirmAddNum = 0; fFirmAddValue = 0; iAddNum = 0; fAddValue = 0; iUserCashNum = 0; fUserCashValue = 0; iFirmCashNum = 0; fFirmCashValue = 0; iCashNum = 0; fCashValue = 0; if (dateTimePicker1.Value <= dateTimePicker2.Value) { T1 = DateTime.Parse(dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss")); T2 = DateTime.Parse(dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss")); } else { T1 = DateTime.Parse(dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss")); T2 = DateTime.Parse(dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss")); } try { int j = 0; sSqlString = "SELECT Card_No, Oper_Time, Oper_Type, Chg_Val FROM rec_user WHERE Oper_ID = " + MyStart.giUserID + " AND (Oper_Type = 'ADD' OR Oper_Type = 'CASH') AND Oper_Time Between '" + T1.ToString("yyyy-MM-dd HH:mm:ss") + "' AND '" + T2.ToString("yyyy-MM-dd HH:mm:ss") + "'"; iRet = MyStart.oMyDb.ReadData(sSqlString, "tableA", ref DS, ref sMsg); if (iRet == 0) { if (DS.Tables[0].Rows.Count > 0) { iNum = DS.Tables[0].Rows.Count; for (j = 0; j < iNum; j++) { dataGridView1.Rows.Add(); dataGridView1.Rows[j].Cells[0].Value = DS.Tables[0].Rows[j]["Card_No"].ToString(); dataGridView1.Rows[j].Cells[1].Value = DateTime.Parse(DS.Tables[0].Rows[j]["Oper_Time"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); dataGridView1.Rows[j].Cells[2].Value = DS.Tables[0].Rows[j]["Oper_Type"].ToString(); iValue = int.Parse(DS.Tables[0].Rows[j]["Chg_Val"].ToString()); fi = iValue; fi /= 100; dataGridView1.Rows[j].Cells[3].Value = fi.ToString("0.00"); dataGridView1.Rows[j].Cells[5].Value = "User"; } } } sSqlString = "SELECT Card_No, Oper_Time, Oper_Type, Chg_Val FROM rec_firm WHERE Oper_ID = " + MyStart.giUserID + " AND (Oper_Type = 'ADD' OR Oper_Type = 'CASH') AND Oper_Time Between '" + T1.ToString("yyyy-MM-dd HH:mm:ss") + "' AND '" + T2.ToString("yyyy-MM-dd HH:mm:ss") + "'"; iRet = MyStart.oMyDb.ReadData(sSqlString, "tableA", ref DS, ref sMsg); if (iRet == 0) { if (DS.Tables[0].Rows.Count > 0) { for (j = 0; j < DS.Tables[0].Rows.Count; j++) { dataGridView1.Rows.Add(); dataGridView1.Rows[j + iNum].Cells[0].Value = DS.Tables[0].Rows[j]["Card_No"].ToString(); dataGridView1.Rows[j + iNum].Cells[1].Value = DateTime.Parse(DS.Tables[0].Rows[j]["Oper_Time"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); dataGridView1.Rows[j + iNum].Cells[2].Value = DS.Tables[0].Rows[j]["Oper_Type"].ToString(); iValue = int.Parse(DS.Tables[0].Rows[j]["Chg_Val"].ToString()); fi = iValue; fi /= 100; dataGridView1.Rows[j + iNum].Cells[3].Value = fi.ToString("0.00"); dataGridView1.Rows[j + iNum].Cells[5].Value = "Firm"; } } //iNum += DS.Tables[0].Rows.Count; } if (dataGridView1.Rows.Count > 0) //已经找到记录了 { float fii = 0; for (int i = 0; i < dataGridView1.Rows.Count; i++) { sTmp = dataGridView1.Rows[i].Cells[2].Value.ToString(); fi = float.Parse(dataGridView1.Rows[i].Cells[3].Value.ToString()); switch (sTmp) { case "ADD": dataGridView1.Rows[i].Cells[2].Value = "充值"; fii += fi; iAddNum++; fAddValue += fi; if (dataGridView1.Rows[i].Cells[5].Value.ToString() == "User") { iUserAddNum++; fUserAddValue += fi; } else { iFirmAddNum++; fFirmAddValue += fi; } break; case "CASH": dataGridView1.Rows[i].Cells[2].Value = "取款"; fii -= fi; iCashNum++; fCashValue += fi; if (dataGridView1.Rows[i].Cells[5].Value.ToString() == "User") { iUserCashNum++; fUserCashValue += fi; } else { iFirmCashNum++; fFirmCashValue += fi; } break; //case "CHG": // dataGridView1.Rows[i].Cells[2].Value = "换卡"; // fii += fi; // iChangeNum++; // fChangeValue += fi; // break; //case "SETT": // dataGridView1.Rows[i].Cells[2].Value = "结算"; // fii += fi; // iSettNum++; // fSettValue += fi; // break; // //case "TRADE": // // dataGridView1.Rows[i].Cells[2].Value = "消费"; // // break; // //case "CANC": // // dataGridView1.Rows[i].Cells[2].Value = "取消"; // // break; } dataGridView1.Rows[i].Cells[4].Value = fii.ToString("0.00"); } dataGridView2.Rows[0].Cells[1].Value = iUserAddNum.ToString(); dataGridView2.Rows[1].Cells[1].Value = fUserAddValue.ToString("0.00"); dataGridView2.Rows[0].Cells[2].Value = iFirmAddNum.ToString(); dataGridView2.Rows[1].Cells[2].Value = fFirmAddValue.ToString("0.00"); dataGridView2.Rows[0].Cells[3].Value = iAddNum.ToString(); dataGridView2.Rows[1].Cells[3].Value = fAddValue.ToString("0.00"); dataGridView2.Rows[0].Cells[4].Value = iUserCashNum.ToString(); dataGridView2.Rows[1].Cells[4].Value = fUserCashValue.ToString("0.00"); dataGridView2.Rows[0].Cells[5].Value = iFirmCashNum.ToString(); dataGridView2.Rows[1].Cells[5].Value = fFirmCashValue.ToString("0.00"); dataGridView2.Rows[0].Cells[6].Value = iCashNum.ToString(); dataGridView2.Rows[1].Cells[6].Value = fCashValue.ToString("0.00"); dataGridView2.Rows[0].Cells[7].Value = dataGridView1.Rows.Count.ToString(); dataGridView2.Rows[1].Cells[7].Value = fii.ToString("0.00"); dataGridView1.Focus(); dataGridView1.Rows[0].Selected = true; } else { MessageBox.Show("没有找到符合条件的记录。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } // log MyFunc.WriteToDbLog("当班人员-收银结算", "", "MSG", MyStart.giUserID); groupBox1.Enabled = false; groupBox2.Visible = true; button_New.Focus(); //return; } catch (Exception ex) { MessageBox.Show("检索失败:" + ex, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } MyStart.oMyDb.Close(); }
private void Timer_Tick(object sender, EventArgs e) { if (Running == true) { //Lauf ist wurde beendet if (Run == "stopped") { Run = "inactiv"; Console.WriteLine("Run had been finished"); log.Items.Insert(0, "Lauf beendet"); logTime.Items.Insert(0, "--:--"); logTime2.Items.Insert(0, "---"); Console.WriteLine("=========================="); log.Items.Insert(0, "====================="); logTime.Items.Insert(0, "==:=="); logTime2.Items.Insert(0, "==="); //Abfrage von streamdata.php WebClient wc = new WebClient(); string livetiming = wc.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/streamdata.php"); Console.WriteLine(livetiming); //streamdata auswerten string[] words = livetiming.Split('?'); string lane = "0"; string lane_1_meters = "0"; string lane_2_meters = "0"; string lane_3_meters = "0"; string lane_4_meters = "0"; string lane_1_time = "0"; string lane_2_time = "0"; string lane_3_time = "0"; string lane_4_time = "0"; foreach (string word in words) { string[] words2 = word.Split('#'); foreach (string word2 in words2) { if (word2 == "1") { lane = "1"; } if (word2 == "2") { lane = "2"; } if (word2 == "3") { lane = "3"; } if (word2 == "4") { lane = "4"; } if (word2 == "50" || word2 == "100" || word2 == "200") { if (lane == "1") { lane_1_meters = word2; } if (lane == "2") { lane_2_meters = word2; } if (lane == "3") { lane_3_meters = word2; } if (lane == "4") { lane_4_meters = word2; } } if (lane != "0" || word2 != "1" || word2 != "2" || word2 != "3" || word2 != "4" || word2 != "50" || word2 != "100" || word2 != "200") { if (lane == "1") { lane_1_time = word2; } if (lane == "2") { lane_2_time = word2; } if (lane == "3") { lane_3_time = word2; } if (lane == "4") { lane_4_time = word2; } } } } Console.WriteLine("====================="); Console.WriteLine("Run before:"); Console.WriteLine("====================="); Console.WriteLine("Lane 1:"); Console.WriteLine("Meters: " + lane_1_meters); Console.WriteLine("Time: " + lane_1_time); Console.WriteLine("====================="); Console.WriteLine("Lane 2:"); Console.WriteLine("Meters: " + lane_2_meters); Console.WriteLine("Time: " + lane_2_time); Console.WriteLine("====================="); Console.WriteLine("Lane 3:"); Console.WriteLine("Meters: " + lane_3_meters); Console.WriteLine("Time: " + lane_3_time); Console.WriteLine("====================="); Console.WriteLine("Lane 4:"); Console.WriteLine("Meters: " + lane_4_meters); Console.WriteLine("Time: " + lane_4_time); Console.WriteLine("====================="); //streamdata auswerten string[] words3 = livetiming.Split('#'); Wk_l = "0"; Meters = "0"; int forcount = 0; foreach (string word3 in words3) { forcount++; if (forcount == 1) { Wk_l = word3; } if (forcount == 2) { int forcount2 = 0; string[] words4 = word3.Split('m'); foreach (string word4 in words4) { forcount2++; if (forcount2 == 1) { Meters = word4; } } } } Console.WriteLine(""); Console.WriteLine("WK: " + Wk_l); Console.WriteLine("Strecke: " + Meters + "m"); Console.WriteLine(""); Console.WriteLine("====================="); //Zeiten mit richtigen Metern in Array string StrRuntimes = ""; if (lane_1_meters == Meters) { StrRuntimes = StrRuntimes + "#" + lane_1_time; Console.WriteLine(StrRuntimes); } if (lane_2_meters == Meters) { StrRuntimes = StrRuntimes + "#" + lane_2_time; Console.WriteLine(StrRuntimes); } if (lane_3_meters == Meters) { StrRuntimes = StrRuntimes + "#" + lane_3_time; Console.WriteLine(StrRuntimes); } if (lane_4_meters == Meters) { StrRuntimes = StrRuntimes + "#" + lane_4_time; Console.WriteLine(StrRuntimes); } string[] Runtimes = StrRuntimes.Split('#'); int TimeFast = 10000000; foreach (string Time in Runtimes) { if (!String.IsNullOrEmpty(Time)) { Console.WriteLine("Zeit:"); Console.WriteLine(Time); //Sekunden berechnen string Time_min_str = Time.Substring(0, 2); string Time_sek_str = Time.Substring(3, 2); int Time_min = Int32.Parse(Time_min_str); int Time_sek = Int32.Parse(Time_sek_str); if (Time_min == 1) { Time_sek = Time_sek + 60; } if (Time_min == 02) { Time_sek = Time_sek + 120; } if (Time_min == 03) { Time_sek = Time_sek + 180; } if (Time_sek <= TimeFast) { TimeFast = Time_sek; } } } Run_sek = TimeFast; } //während keinem Lauf if (Run == "inactiv") { //Abfrage, ob Lauf wieder gestartet WebClient wc2 = new WebClient(); string livetimingD = wc2.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/livetime2.php"); if (livetimingD.Contains("Bahn")) { Run = "started"; } } //wenn Lauf gestartet: if (Run == "started") { Run = "activ"; //Abfrage welche Strecke geschwommen wird WebClient wc3 = new WebClient(); string livetimingD = wc3.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/streamdata.php"); Console.WriteLine(livetimingD); Console.WriteLine("Run has been started!"); Console.WriteLine(""); log.Items.Insert(0, "Lauf wurde gestartet"); logTime.Items.Insert(0, "00:00"); logTime2.Items.Insert(0, "0"); //Werte aktueller Lauf string distance = Meters; //Szenenwechsel berechnen //für 50m Stecken if (distance == "50") { T1 = Math.Round(Run_sek * 0.3); T2 = Math.Round(Run_sek * 0.7); Time1.Text = T1.ToString(); Time2.Text = T2.ToString(); Time3.Text = " "; Time4.Text = " "; Time5.Text = " "; Time6.Text = " "; Time7.Text = " "; Time8.Text = " "; } if (distance == "100") { T1 = Math.Round(Run_sek * 0.15); T2 = Math.Round(Run_sek * 0.35); T3 = Math.Round(Run_sek * 0.65); T4 = Math.Round(Run_sek * 0.85); Time1.Text = T1.ToString(); Time2.Text = T2.ToString(); Time3.Text = T3.ToString(); Time4.Text = T4.ToString(); Time5.Text = " "; Time6.Text = " "; Time7.Text = " "; Time8.Text = " "; } if (distance == "200") { T1 = Math.Round(Run_sek * 0.075); T2 = Math.Round(Run_sek * 0.175); T3 = Math.Round(Run_sek * 0.325); T4 = Math.Round(Run_sek * 0.425); T5 = Math.Round(Run_sek * 0.575); T6 = Math.Round(Run_sek * 0.675); T7 = Math.Round(Run_sek * 0.825); T8 = Math.Round(Run_sek * 0.925); Time1.Text = T1.ToString(); Time2.Text = T2.ToString(); Time3.Text = T3.ToString(); Time4.Text = T4.ToString(); Time5.Text = T5.ToString(); Time6.Text = T6.ToString(); Time7.Text = T7.ToString(); Time8.Text = T8.ToString(); } Console.WriteLine(Run_sek); log.Items.Insert(0, "Sekunden: " + Run_sek); logTime.Items.Insert(0, "00:00"); logTime2.Items.Insert(0, "0"); progressBar.Maximum = Run_sek; TimeCount = 0; Count = 0; Count2 = 0; clock.Text = "00:00"; //Auslesen streamdata.php für WK WebClient wc = new WebClient(); string livetiming = wc.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/streamdata.php"); //WK ermitteln string[] words3 = livetiming.Split('#'); Wk_c = "0"; Meters = "0"; int forcount = 0; foreach (string word3 in words3) { forcount++; if (forcount == 1) { Wk_c = word3; } if (forcount == 2) { int forcount2 = 0; string[] words4 = word3.Split('m'); foreach (string word4 in words4) { forcount2++; if (forcount2 == 1) { Meters_c = word4; } } } } Console.WriteLine("WK: " + Wk_c); Console.WriteLine("WK (l): " + Wk_l); WkBox.Text = Wk_c; DistanceBox.Text = Meters_c + "m"; } //während des Laufes: if (Run == "activ") { //timer hochzählen TimeCount = TimeCount + 1; Console.WriteLine(TimeCount); Count = Count + 1; string display; string display2; if (Count >= 60) { Count = 0; Count2++; } if (Count < 10) { display = "0" + Count.ToString(); } else { display = Count.ToString(); } if (Count2 < 10) { display2 = "0" + Count2.ToString(); } else { display2 = Count2.ToString(); } string output = display2 + ":" + display; clock.Text = output; TimeBox.Text = "" + TimeCount; //wenn stichzeiten gleich aktueller Zeit Kamera wechseln if (Wk_c == Wk_l) { if (TimeCount == T1) { Console.WriteLine("Change Scene to webcam 2"); log.Items.Insert(0, "Wechsle Szene zu Webcam 2"); logTime.Items.Insert(0, output); logTime2.Items.Insert(0, TimeCount); //OBS Anweisungen SendKeys.Send("^M"); T1 = 0; } if (TimeCount == T2) { Console.WriteLine("Change Scene to webcam 1"); log.Items.Insert(0, "Wechsle Szene zu Webcam 1"); logTime.Items.Insert(0, output); logTime2.Items.Insert(0, TimeCount); //OBS Anweisungen SendKeys.Send("^N"); T2 = 0; } if (TimeCount == T3) { Console.WriteLine("Change Scene to webcam 2"); log.Items.Insert(0, "Wechsle Szene zu Webcam 2"); logTime.Items.Insert(0, output); logTime2.Items.Insert(0, TimeCount); //OBS Anweisungen SendKeys.Send("^M"); T3 = 0; } if (TimeCount == T4) { Console.WriteLine("Change Scene to webcam 1"); log.Items.Insert(0, "Wechsle Szene zu Webcam 1"); logTime.Items.Insert(0, output); logTime2.Items.Insert(0, TimeCount); //OBS Anweisungen SendKeys.Send("^N"); T4 = 0; } if (TimeCount == T5) { Console.WriteLine("Change Scene to webcam 2"); log.Items.Insert(0, "Wechsle Szene zu Webcam 2"); logTime.Items.Insert(0, output); logTime2.Items.Insert(0, TimeCount); //OBS Anweisungen SendKeys.Send("^M"); T5 = 0; } if (TimeCount == T6) { Console.WriteLine("Change Scene to webcam 1"); log.Items.Insert(0, "Wechsle Szene zu Webcam 1"); logTime.Items.Insert(0, output); logTime2.Items.Insert(0, TimeCount); //OBS Anweisungen SendKeys.Send("^N"); T6 = 0; } if (TimeCount == T7) { Console.WriteLine("Change Scene to webcam 2"); log.Items.Insert(0, "Wechsle Szene zu Webcam 2"); logTime.Items.Insert(0, output); logTime2.Items.Insert(0, TimeCount); //OBS Anweisungen SendKeys.Send("^M"); T7 = 0; } if (TimeCount == T8) { Console.WriteLine("Change Scene to webcam 1"); log.Items.Insert(0, "Wechsle Szene zu Webcam 1"); logTime.Items.Insert(0, output); logTime2.Items.Insert(0, TimeCount); //OBS Anweisungen SendKeys.Send("^N"); T8 = 0; } } //Lauffortschritt in Progressbar if (TimeCount <= Run_sek) { progressBar.Value = TimeCount; } //Abfrage, ob Lauf beendet WebClient wc2 = new WebClient(); string livetimingD = wc2.DownloadString("http://erzgebirgsschwimmcup.de/Livetiming/livetime2.php"); if (!livetimingD.Contains("Bahn")) { Run = "stopped"; } } } else { textBox1.Text = "angehalten"; } }
public void WriteBoth() { // minLineDebug = 132 Console.Write(X + Y.ToString()); // minLineRelease = 133 } // maxLineDebug = maxLineRelease = 134
public void WriteBoth() { // expectedLineDebug Console.Write(x + y.ToString()); // expectedLineRelease }
static void Main(string[] args) { Console.Write("Energiförbrukning N ? "); int N = Convert.ToInt32(Console.ReadLine()); int sum = 0; int antal = 0; int oldi1 = 0; int oldi2 = 0; int oldi3 = 0; for (int i1 = 0; i1 < 24; i1++) { for (int i2 = 0; i2 < 60; i2++) { for (int i3 = 0; i3 < 60; i3++) { if (sum == 0) { oldi1 = i1; oldi2 = i2; oldi3 = i3; } sum += energySum(i1, i2, i3); if (sum == N) { antal++; sum = 0; i1 = oldi1; i2 = oldi2; i3 = oldi3; } else if (sum > N) { sum = 0; i1 = oldi1; i2 = oldi2; i3 = oldi3; } } } } Console.WriteLine("Antal möjligheter : " + antal); int energySum(int T1, int T2, int T3) { int[] energyNumber = new int[] { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 }; char[] T1S; char[] T2S; char[] T3S; if (T1 < 10) { T1S = ("0" + T1.ToString()).ToCharArray(); } else { T1S = T1.ToString().ToCharArray(); } if (T2 < 10) { T2S = ("0" + T2.ToString()).ToCharArray(); } else { T2S = T2.ToString().ToCharArray(); } if (T3 < 10) { T3S = ("0" + T3.ToString()).ToCharArray(); } else { T3S = T3.ToString().ToCharArray(); } int S1 = Convert.ToInt32(T1S[0].ToString()); int S2 = Convert.ToInt32(T1S[1].ToString()); int S3 = Convert.ToInt32(T2S[0].ToString()); int S4 = Convert.ToInt32(T2S[1].ToString()); int S5 = Convert.ToInt32(T3S[0].ToString()); int S6 = Convert.ToInt32(T3S[1].ToString()); //Console.WriteLine(S1 + ", " + S2 + ", " + S3 + ", " + S4 + ", " + S5 + ", " + S6); int sum = energyNumber[S1] + energyNumber[S2] + energyNumber[S3] + energyNumber[S4] + energyNumber[S5] + energyNumber[S6]; return(sum); } }
public void CalculatePerformance(double pressure, double temperature, double velocity, double commandedThrottle) { if (Tt7 == 0) { mainThrottle = commandedThrottle; } else { mainThrottle = Math.Min(commandedThrottle * 1.5, 1.0); abThrottle = Math.Max(commandedThrottle - 0.667, 0); } p0 = pressure * 1000; //freestream t0 = temperature; gamma_c = CalculateGamma(t0, 0); Cp_c = CalculateCp(t0, 0); Cv_c = Cp_c / gamma_c; R_c = Cv_c * (gamma_c - 1); M0 = velocity / Math.Sqrt(gamma_c * R_c * t0); T1 = t0 * (1 + 0.5 * (gamma_c - 1) * M0 * M0); //inlet P1 = p0 * Math.Pow(T1 / t0, gamma_c / (gamma_c - 1)) * TPR; double prat3 = CPR; double prat2 = FPR; double k = FPR / CPR; double p = Math.Pow(k, (gamma_c - 1) / eta_c / gamma_c); for (int i = 0; i < 20; i++) //use iteration to calculate CPR { P2 = prat2 * P1; P3 = prat3 * P1; T2 = T1 * Math.Pow(prat2, (gamma_c - 1) / gamma_c / eta_c); //fan T3 = T1 * Math.Pow(prat3, (gamma_c - 1) / gamma_c / eta_c); //compressor T4 = (Tt4 - T3) * mainThrottle + T3; //burner P4 = P3; ff = Cp_c * (T4 - T3) / (Cp_c * (T4 - T3) + h_f); //fuel fraction Cp_t = CalculateCp(T4, ff); T5 = T4 * TTR; //turbine double x = prat3; prat3 = (1 + ff) * Cp_t * (T4 - T5) / T1 / Cp_c + 1 + BPR; prat3 /= 1 + BPR * p; prat3 = Math.Pow(prat3, eta_c * gamma_c / (gamma_c - 1)); prat2 = k * prat3; if (Math.Abs(x - prat3) < 0.01) { break; } } gamma_t = CalculateGamma(T5, ff);//gas parameters Cp_t = CalculateCp(T5, ff); Cv_t = Cp_t / gamma_t; R_t = Cv_t * (gamma_t - 1); P5 = P4 * Math.Pow((1 - 1 / eta_t * (1 - TTR)), gamma_t / (gamma_t - 1)); if (exhaustMixer && BPR > 0) //exhaust mixer { double Cp6 = (Cp_c * BPR + Cp_t) / (1 + BPR); //Cp of mixed flow -- kind of T6 = T5 * Cp_t / Cp6 * (1 + BPR * Cp_c * T2 / Cp_t / T5) / (1 + BPR); P6 = (P5 + BPR * 0.98 * P2) / (1 + BPR); ff /= (1 + ff + BPR); gamma_t = CalculateGamma(T6, ff);//gas parameters Cp_t = CalculateCp(T6, ff); Cv_t = Cp_t / gamma_t; R_t = Cv_t * (gamma_t - 1); } else { T6 = T5; P6 = P5; } if (Tt7 > 0) { T7 = (Tt7 - T6) * abThrottle * 3 + T6;//afterburner } else { T7 = T6; } P7 = P6; //rayleigh loss? ff_ab = ff + Cp_t * (T7 - T6) / (Cp_t * (T7 - T6) + h_f); //fuel fraction gamma_ab = CalculateGamma(T7, ff_ab); //gas parameters Cp_ab = CalculateCp(T7, ff_ab); Cv_ab = Cp_ab / gamma_ab; R_ab = Cv_ab * (gamma_ab - 1); //Nozzle code is from NASA double P8 = P7; double T8 = T7; double p8, V8, A8; double epr = P8 / P1; double etr = T8 / T1; double area8max = .75 * Math.Sqrt(etr) / epr;//ratio of nozzle area to ref area A8 = area8max * Aref; if (exhaustMixer && BPR > 0) { A8 *= (1 + BPR); } double eair = P8 * Math.Sqrt(gamma_ab / R_ab / T8) * Math.Pow((.5 + .5 * gamma_ab), .5 * (1 + gamma_ab) / (1 - gamma_ab));//corrected mass flow per area mdot = eair * A8; double npr = P8 / p0; double fac1 = (gamma_ab - 1.0) / gamma_ab; V8 = Math.Sqrt(2.0 * R_c / fac1 * T8 * eta_n * (1.0 - Math.Pow(1.0 / npr, fac1))); //exit velocity p8 = (npr <= 1.893) ? p0 : .52828 * P8; thrust = V8 * mdot + (p8 - p0) * A8; if (BPR > 0 && FPR > 1 && exhaustMixer == false) { fac1 = (gamma_c - 1) / gamma_c; //fan thrust from NASA double snpr = P2 / p0; double ues = Math.Sqrt(2.0 * R_c / fac1 * T2 * eta_n * (1.0 - Math.Pow(1.0 / snpr, fac1))); double pfexit = (snpr <= 1.893) ? p0 : .52828 * P2; //exit pressure of fan thrust += BPR * ues * mdot / (1 + ff_ab) + (pfexit - p0) * BPR * Aref; } double netthrust = thrust - mdot / (1 + ff_ab) * (1 + (exhaustMixer ? 0 : BPR)) * (velocity);//ram drag Isp = thrust / (mdot * ff_ab * 9.81); debugstring = ""; debugstring += "TTR:\t" + TTR.ToString("F3") + "\r\n"; debugstring += "CPR:\t" + prat3.ToString("F3") + "\r\n"; debugstring += "M0:\t" + M0.ToString("F3") + "\r\n"; debugstring += "p0: " + p0.ToString("F2") + "\tt0: " + t0.ToString("F2") + "\r\n"; debugstring += "P1: " + P1.ToString("F2") + "\tT1: " + T1.ToString("F2") + "\r\n"; debugstring += "P2: " + P2.ToString("F2") + "\tT2: " + T2.ToString("F2") + "\r\n"; debugstring += "P3: " + P3.ToString("F2") + "\tT3: " + T3.ToString("F2") + "\r\n"; debugstring += "P4: " + P4.ToString("F2") + "\tT4: " + T4.ToString("F2") + "\r\n"; debugstring += "P5: " + P5.ToString("F2") + "\tT5: " + T5.ToString("F2") + "\r\n"; debugstring += "P6: " + P6.ToString("F2") + "\tT6: " + T6.ToString("F2") + "\r\n"; debugstring += "P7: " + P7.ToString("F2") + "\tT7: " + T7.ToString("F2") + "\r\n"; debugstring += "EPR: " + epr.ToString("F2") + "\tETR: " + etr.ToString("F2") + "\r\n"; debugstring += "FF: " + ff.ToString("P") + "\t"; debugstring += "FF_AB: " + ff_ab.ToString("P") + "\r\n"; debugstring += "V8: " + V8.ToString("F2") + "\tA8: " + A8.ToString("F2") + "\r\n"; debugstring += "Thrust: " + (thrust / 1000).ToString("F1") + "\tmdot: " + mdot.ToString("F2") + "\r\n"; debugstring += "NetThrust: " + (netthrust / 1000).ToString("F1") + "\tSFC: " + (3600 / Isp).ToString("F3") + "\r\n"; //Debug.Log(debugstring); }
private static void TimePeriodInterface() { #region time_period_interface void PrintFirstAndLastPeriods <T, T2>(T timePeriod) where T : ITimePeriod <T> where T2 : ITimePeriod <T2> { string periodType = typeof(T).Name; string period2Type = typeof(T2).Name; T2 firstHour = timePeriod.First <T2>(); T2 lastHour = timePeriod.Last <T2>(); Console.WriteLine($"The {periodType} period '{timePeriod}' has first {period2Type} '{firstHour.ToString()}' and last {period2Type} '{lastHour.ToString()}'"); } var dec20 = new Month(2020, 12); PrintFirstAndLastPeriods <Month, Hour>(dec20); Console.WriteLine(); #endregion }
public void WriteBoth() { // expectedLineDebug = 132 Console.Write(X + Y.ToString()); // expectedLineRelease = 133 }
public override string ToString() { return(Id + ", T1: " + T1.ToString("F3") + ", T2: " + T2.ToString("F3") + ", T3: " + T3.ToString("F3") + ", T4: " + T4.ToString("F3") + " " + Power); }