public string ShowMatInText(string strCondition) { string[] strArr = strCondition.Split(':'); System.Collections.ArrayList mass = new System.Collections.ArrayList(); System.Collections.ArrayList key1 = new System.Collections.ArrayList(); System.Collections.ArrayList key2 = new System.Collections.ArrayList(); System.Collections.ArrayList key3 = new System.Collections.ArrayList(); using (SqlText sql = new SqlText(String.Format("select m.MassPartsIDFlag, m.ExpansionKey1, m.ExpansionKey2, m.ExpansionKey3 from MaterialNumber as m join Customer as c on m.ShiptoParty = c.Code where c.PlantCode = '{1}' and shiptoParty like '{0}%' and m.customerItemNumber = '{2}'", strArr[0], strArr[1], strArr[2]))) { System.Data.Common.DbDataReader readerSender = sql.ExecuteReader(); while (readerSender.Read()) { mass.Add(readerSender["MassPartsIDFlag"].ToString()); key1.Add(readerSender["ExpansionKey1"].ToString()); key2.Add(readerSender["ExpansionKey2"].ToString()); key3.Add(readerSender["ExpansionKey3"].ToString()); } readerSender.Close(); readerSender.Dispose(); } MN[] l = new MN[mass.Count]; for (int i = 0; i <= mass.Count - 1; i++) { l[i] = new MN(); l[i].MassPartsIDFlag = mass[i].ToString(); l[i].ExpansionKey1 = key1[i].ToString(); l[i].ExpansionKey2 = key2[i].ToString(); l[i].ExpansionKey3 = key3[i].ToString(); } return(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(l)); }
public async Task <IActionResult> SearchForLineAsync([FromBody] MN model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } try { var material = new Material() { beton = new BetonModelEC(model.material.betonClass), armatura = ReinforcementType .GetArmatura() .First(n => n.name == model.material.armtype), }; var geometry = new ElementGeometryWithReinfI() { b_eff_top = model.geometry.b_eff, h_f_top = model.geometry.h_f, b = model.geometry.b, d1 = model.geometry.d1, d2 = model.geometry.d2, h = model.geometry.h, As_1 = model.geometry.as1, As_2 = model.geometry.as2, }; var s = new Solver(material, geometry); await s.CalcAsync(); //s.GetWorrnings(model.m, model.n); var isValid = s.List.IsMNValid(model.m, model.n); var listMaxMin = new List <SectionStrainsModel>(); listMaxMin.AddRange( s.List .OrderBy(n => Math.Abs(n.M_Rd - model.m)) .Take(2) ); listMaxMin.AddRange(s.List.OrderBy(n => Math.Abs(n.N_Rd - model.n)) .Take(2)); return(Ok( new { extrims = InfoDetailModel.Converts(listMaxMin.ToArray()), isValid = isValid, worrnings = s.Worrnings, })); } catch (Exception ex) { return(BadRequest(new { error = ex.Message })); } }
private void selected_button_Click(object sender, EventArgs e) //снятие выделение со строки в dgv о очищение tb { button_off(); foreach (DataGridViewRow row in Data_Person.SelectedRows) { row.Selected = false; } LN.Clear(); N.Clear(); MN.Clear(); DOB.Clear(); Act.Checked = false; Pasp.Clear(); DOE.Clear(); pos.Clear(); DOD.Clear(); Reas.Clear(); }
private void button1_Click(object sender, EventArgs e) { float x_M, x_N, x_P; float y_M, y_N, y_P; float MN, MP, NP; float P_MNP; try { x_M = float.Parse(textBox1.Text); y_M = float.Parse(textBox2.Text); x_N = float.Parse(textBox4.Text); y_N = float.Parse(textBox3.Text); x_P = float.Parse(textBox6.Text); y_P = float.Parse(textBox5.Text); } catch (System.FormatException) { MessageBox.Show("Неверно заполнены поля.", "Ошибка ввода!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MN = (float)Math.Sqrt((double)((x_N - x_M) * (x_N - x_M) + (y_N - y_M) * (y_N - y_M))); NP = (float)Math.Sqrt((double)((x_P - x_N) * (x_P - x_N) + (y_P - y_N) * (y_P - y_N))); MP = (float)Math.Sqrt((double)((x_P - x_M) * (x_P - x_M) + (y_P - y_M) * (y_P - y_M))); P_MNP = MN + NP + MP; string solution; string task; string given; string search; task = "Найдите периметр треугольника $MNP$, если $M(" + x_M.ToString() + "; " + y_M.ToString() + ")$; $N(" + x_N.ToString() + "; " + y_N.ToString() + ")$; $P(" + x_P.ToString() + ";" + y_P.ToString() + ")$."; given = "$\\triangle MNP, M(" + x_M.ToString() + "; " + y_M.ToString() + "); N(" + x_N.ToString() + "; " + y_N.ToString() + "), P(" + x_P.ToString() + ";" + y_P.ToString() + ")$."; search = " $P_{\\triangle MNP}$"; solution = "$MN=\\sqrt{(x_M-x_N)^2+(y_M-y_N)^2}=\\sqrt{(" + x_M.ToString() + "-" + x_N.ToString() + ")^2+(" + y_M.ToString() + "-" + y_N.ToString() + ")^2}=" + MN.ToString() + "$;\\\\"; solution += " $NP=\\sqrt{(x_N-x_P)^2+(y_N-y_P)^2}=\\sqrt{(" + x_N.ToString() + "-" + x_P.ToString() + ")^2+(" + y_N.ToString() + "-" + y_P.ToString() + ")^2}=" + NP.ToString() + "$;\\\\"; solution += " $MP=\\sqrt{(x_P-x_M)^2+(y_P-y_M)^2}=\\sqrt{(" + x_P.ToString() + "-" + x_M.ToString() + ")^2+(" + y_P.ToString() + "-" + y_M.ToString() + ")^2}=" + MP.ToString() + "$;\\\\"; solution += "$P_{\\triangle MNP}=MN+NP+MP=" + MN.ToString() + "+" + NP.ToString() + "+" + MP.ToString() + "=" + P_MNP.ToString() + "$"; GeneratorTexText generator = new GeneratorTexText(); generator.Finish(task, given, search, solution); }
public string cbPlantCode(string strCondition) { System.Collections.ArrayList receiverList = new System.Collections.ArrayList(); using (SqlText sql = new SqlText(String.Format("select distinct(PlantCode) from Customer where Code like '{0}%' and PlantCode is not null", strCondition))) { System.Data.Common.DbDataReader readerSender = sql.ExecuteReader(); while (readerSender.Read()) { receiverList.Add(readerSender["PlantCode"].ToString()); } readerSender.Close(); readerSender.Dispose(); } MN[] l = new MN[receiverList.Count]; for (int i = 0; i <= receiverList.Count - 1; i++) { l[i] = new MN(); l[i].strItem = receiverList[i].ToString(); } return(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(l)); }
public string cbMatCode(string strCondition) { string[] strArr = strCondition.Split(':'); System.Collections.ArrayList receiverList = new System.Collections.ArrayList(); using (SqlText sql = new SqlText(String.Format("select m.customerItemNumber from MaterialNumber as m join Customer as c on m.ShiptoParty = c.Code where c.PlantCode = '{1}' and shiptoParty like '{0}%'", strArr[0], strArr[1]))) { System.Data.Common.DbDataReader readerSender = sql.ExecuteReader(); while (readerSender.Read()) { receiverList.Add(readerSender["customerItemNumber"].ToString()); } readerSender.Close(); readerSender.Dispose(); } MN[] l = new MN[receiverList.Count]; for (int i = 0; i <= receiverList.Count - 1; i++) { l[i] = new MN(); l[i].strItem = receiverList[i].ToString(); } return(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(l)); }
public async Task <IActionResult> GetListOfAllLines([FromBody] MN model) { if (model == null) { Logger.LogError("model not valid"); throw new System.ArgumentNullException(nameof(model)); } try { var material = new Material() { beton = new BetonModelEC(model.material.betonClass), armatura = ReinforcementType.GetArmatura().First(n => n.name == model.material.armtype), }; var geometry = new ElementGeometryWithReinfI() { b_eff_top = model.geometry.b_eff, h_f_top = model.geometry.h_f, b = model.geometry.b, d1 = model.geometry.d1, d2 = model.geometry.d2, h = model.geometry.h, As_1 = model.geometry.as1, As_2 = model.geometry.as2, }; var s = new Solver(material, geometry); await s.CalcAsync(0.5); Logger.LogInformation("API send interacion curves"); return(Ok(s.List.Select(x => new { x = x.M_Rd, y = x.N_Rd }))); } catch (System.Exception ex) { Logger.LogError("something went wrrong: " + ex.Message); return(BadRequest(new { error = ex.Message })); } }
private void add_button_Click(object sender, EventArgs e) //добавление записи { if (LN.Text != "" && N.Text != "" && MN.Text != "" && DOB.Text != "" && pos.Text != "" && Pasp.Text != "" && DOE.Text != "") { DialogResult dr = MessageBox.Show("Добавить запись?", "Добавление", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.OK) { bool flag = false; for (int i = 0; i < Objects.Count; i++) { if (LN.Text == Objects[i].Lastname && N.Text == Objects[i].Name && MN.Text == Objects[i].Midname && Pasp.Text == Objects[i].passport) { flag = true; } } if (!flag) { DataRow nRow = course_workDataSet.Tables[0].NewRow(); Base.add(List_Text_Box, Act, nRow); course_workDataSet.Tables[0].Rows.Add(nRow); info1TableAdapter.Update(course_workDataSet.Info1); course_workDataSet.Tables[0].AcceptChanges(); Data_Person.Refresh(); Base.data_update(this.Data_Person, this.Objects); MessageBox.Show("Запись добавлена!"); LN.Clear(); N.Clear(); MN.Clear(); Pasp.Clear(); pos.Clear(); Reas.Clear(); } if (flag) { MessageBox.Show("Такая запись уже существует!", "Добавление", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } } } else { MessageBox.Show("Некорректный ввод! Поля пусты.", "Добавление", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } }