public OSupport InsertSupport(CSupport objSuffer) { DALExceptionManagment objExceptionlog = new DALExceptionManagment(); OSupport obj_Support = new OSupport(); try { using (SqlConnection sqlconn_obj = new SqlConnection(SqlHelper.GetDBConnectionString())) { using (SqlCommand sqlcmd_obj = new SqlCommand("CTAPP_PROC_INSERTSUPPORT", sqlconn_obj)) { sqlcmd_obj.CommandType = CommandType.StoredProcedure; sqlcmd_obj.Parameters.AddWithValue("@CustomerID", objSuffer.CustomerID); sqlcmd_obj.Parameters.AddWithValue("@Name", objSuffer.Name); sqlcmd_obj.Parameters.AddWithValue("@PhoneNumber", objSuffer.PhoneNumber); sqlcmd_obj.Parameters.AddWithValue("@Email", objSuffer.Email); sqlcmd_obj.Parameters.AddWithValue("@Message", objSuffer.Message); sqlconn_obj.Open(); SqlDataAdapter sqldap = new SqlDataAdapter(sqlcmd_obj); DataTable resultdt = new DataTable(); sqldap.Fill(resultdt); if (resultdt.Rows.Count > 0) { obj_Support.SupportRequestID = Convert.ToInt32(resultdt.Rows[0]["SupportRequestID"]); } } } } catch (Exception ex) { objExceptionlog.InsertException(ex.Message, "DALSupport", "Proc: " + "CTAPP_PROC_INSERTSUPPORT", "InsertSupport"); throw; } return(obj_Support); }
private void btnOK_Click(object sender, EventArgs e) { spt = new CSupport(); spt.nodeNo = SpFuncs.getInt(txtNodeNo.Text); spt.dof0 = chkXt.Checked; spt.dof1 = chkYt.Checked; spt.dof2 = chkZt.Checked; spt.dof3 = chkXr.Checked; spt.dof4 = chkYr.Checked; spt.dof5 = chkZr.Checked; int indx = this.iApp.AppDocument.Support.IndexOf(spt.nodeNo); if (indx == -1) { if (spt.nodeNo > 0) { iApp.AppDocument.Support.Add(spt); txtNodeNo.Text = ""; txtNodeNo.Focus(); } } else { this.iApp.AppDocument.Support[indx] = spt; } SetAllSupport(); }
private string setComboString(CSupport csp) { string str = ""; if (csp.dof0 == true && csp.dof1 == true && csp.dof2 == true && csp.dof3 == true && csp.dof4 == true && csp.dof5 == true) { str = csp.nodeNo + " \t FIXED"; } else if (csp.dof0 == true && csp.dof1 == true && csp.dof2 == true && csp.dof3 == false && csp.dof4 == false && csp.dof5 == false) { str = csp.nodeNo + " \t PINNED"; } else { str = csp.nodeNo + " \t DEG_FRDM"; } return(str); }
public OSupport InsertSupport(string accessToken, CSupport objSupport) { OSupport obj_Support = new OSupport(); try { string baseUrl = Convert.ToString(App.Current.Properties["BaseURL"]); using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseUrl); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // Add the Authorization header with the AccessToken. client.DefaultRequestHeaders.Add("Authorization", "bearer " + accessToken); // create the URL string. string url = "api/InstaConsumer/InsertSupport"; // make the request var json = JsonConvert.SerializeObject(objSupport); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(url, content).Result; if (response.IsSuccessStatusCode) { string jsonString = response.Content.ReadAsStringAsync().Result; if (jsonString != null) { APIResponse apiResult = JsonConvert.DeserializeObject <APIResponse>(jsonString); if (apiResult.Result) { obj_Support = JsonConvert.DeserializeObject <OSupport>(Convert.ToString(apiResult.Object)); } } } } } catch (Exception ex) { } return(obj_Support); }
public bool Read(string FilePath) { ClearVars(); //To Do: read from file FileStream kFs = new FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite); StreamReader sr = new StreamReader(kFs); string str = ""; while (sr.EndOfStream == false) { str = sr.ReadLine(); if (BasicInfo.UsersTitle == "") { if (str.Contains("ASTRA")) { if (str.Length > 12) { str = str.Remove(0, 12); BasicInfo.UsersTitle = str; continue; } } } //if (ProjectTitle == "") //{ // ProjectTitle = str; // continue; //} if (str.Contains("UNIT") && this.LUnit == "" && this.MUnit == "") { string[] ss = CAstraUnits.GetBasicLengthMassUnits(str); this.MUnit = ss[0]; this.LUnit = ss[1]; switch (this.MUnit.ToUpper()) { case "MTON": this.wfct_flag = 1; break; case "KN": this.wfct_flag = 2; break; case "KG": this.wfct_flag = 3; break; case "NEW": this.wfct_flag = 4; break; case "N": this.wfct_flag = 4; break; case "GM": this.wfct_flag = 5; break; case "GMS": this.wfct_flag = 5; break; case "KIP": this.wfct_flag = 6; break; case "LBS": this.wfct_flag = 7; break; } switch (this.LUnit.ToUpper()) { case "MM": this.lfct_flag = 1; break; case "CM": this.lfct_flag = 2; break; case "M": this.lfct_flag = 3; break; case "ME": this.lfct_flag = 3; break; case "METRES": this.lfct_flag = 3; break; case "YDS": this.lfct_flag = 4; break; case "FT": this.lfct_flag = 5; break; case "INCH": this.lfct_flag = 6; break; case "IN": this.lfct_flag = 6; break; } } if (str.ToUpper().Contains("STRUCTURE")) { str = str.Replace('\t', ' '); string[] values = str.Split(new char[] { ' ' }); while (str.IndexOf(" ") != -1) { str = str.Replace(" ", " "); } if (values.Length == 3) { int.Parse(values[1]); BasicInfo.Type = (StructureType)int.Parse(values[1]); BasicInfo.RunningOption = short.Parse(values[2]); } //str = str.Remove(0, 10); //str = str.Trim(); //string[] values = str.Split(new char[] { ' ' }); //while (str.IndexOf(" ") != -1) //{ // str = str.Replace(" ", " "); //} //str = str.Replace('\t', ' '); //values = str.Split(new char[] { ' ' }); //str = values[0]; //StructureType = ((str == "1") ? StructureType.SPACE : (str == "2") ? StructureType.FLOOR : StructureType.PLANE); //try { this.Modex = short.Parse(values[1]); } //catch (Exception ex) { this.Modex = -1; } } string find = getNodeName(str); if (find == "N000") { str = str.Replace('\t', ' '); string[] values = str.Split(new char[] { ' ' }); while (str.IndexOf(" ") != -1) { str = str.Replace(" ", " "); } if (values.Length == 3) { BasicInfo.MassUnit = CAstraUnits.GetMassUnit(values[1]); BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(values[2]); } } if (find == "N001") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); NodeData.MassFactor = d[0]; NodeData.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); NodeData.MassUnit = CAstraUnits.GetMassUnit(unt[2]); NodeData.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { NodeData.Add(CNodeData.Parse(str)); } catch (Exception ex) { } } else if (find == "N002") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); BeamConnectivity.MassFactor = d[0]; BeamConnectivity.LengthFactor = d[1]; } try { BeamConnectivity.Add(CMemberConnectivity.Parse(str)); } catch (Exception ex) { } } else if (find == "N003") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); SectionProperty.MassFactor = d[0]; SectionProperty.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); SectionProperty.MassUnit = CAstraUnits.GetMassUnit(unt[2]); SectionProperty.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { SectionProperty.Add(CSectionProperty.Parse(str)); } catch (Exception ex) { } } else if (find == "N004") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); MaterialProperty.MassFactor = d[0]; MaterialProperty.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); MaterialProperty.MassUnit = CAstraUnits.GetMassUnit(unt[2]); MaterialProperty.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { MaterialProperty.Add(CMaterialProperty.Parse(str)); } catch (Exception ex) { } } else if (find == "N005") { try { Support.Add(CSupport.Parse(str)); } catch (Exception ex) { } } else if (find == "N008") { try { MemberTruss.Add(CMemberTruss.Parse(str)); } catch (Exception ex) { } } else if (find == "N010") { try { SelfWeight = (CSelfWeight.Parse(str)); } catch (Exception ex) { } } else if (find == "N007") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); MemberBeamLoad.MassFactor = d[0]; MemberBeamLoad.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); MemberBeamLoad.MassUnit = CAstraUnits.GetMassUnit(unt[2]); MemberBeamLoad.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { MemberBeamLoad.Add(CMemberBeamLoading.Parse(str)); } catch (Exception ex) { } } else if (find == "N009") { try { BeamConnectivityRelease.Add(CBeamConnectivityRelease.Parse(str)); } catch (Exception ex) { } } else if (find == "N006") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); JointNodalLoad.MassFactor = d[0]; JointNodalLoad.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); JointNodalLoad.MassUnit = CAstraUnits.GetMassUnit(unt[2]); JointNodalLoad.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { //CJointNodalLoad jntLoad = new CJointNodalLoad(); //jntLoad = CJointNodalLoad.Parse(str); JointNodalLoad.Add(CJointNodalLoad.Parse(str)); } catch (Exception ex) { } } else if (find == "N099") { try { Analysis = CAnalysis.Parse(str); } catch (Exception ex) { } } else if (find == "N011") { if (str.Contains("FILE")) { int j = str.IndexOf("FILE"); str = str.Remove(0, j + 5); str = str.ToUpper().Trim(); MovingLoad.FileName = str; } try { MovingLoad.Add(CMovingLoad.Parse(str)); } catch (Exception ex) { } } else if (find == "N012") { string[] values = str.Split(new char[] { ' ' }); if (values.Length == 4) { try { LoadGeneration.repeatTime = int.Parse(values[3]); } catch (Exception ex) { } } try { LoadGeneration.Add(CLoadGeneration.Parse(str)); } catch (Exception ex) { } } else if (find == "N013") { try { LoadCombination.Add(CLoadCombination.Parse(str)); } catch (Exception ex) { } } else if (find == "N014") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); AreaLoad.MassFactor = d[0]; AreaLoad.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); AreaLoad.MassUnit = CAstraUnits.GetMassUnit(unt[2]); AreaLoad.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { AreaLoad.Add(CAreaLoad.Parse(str)); } catch (Exception ex) { } } else if (find == "N019") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); MatPropertyInfo.MassFactor = d[0]; MatPropertyInfo.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); MatPropertyInfo.MassUnit = CAstraUnits.GetMassUnit(unt[2]); MatPropertyInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { MatPropertyInfo.Add(CMaterialPropertyInformation.Parse(str)); } catch (Exception ex) { } } else if (find == "N016") { if (str.Contains("UNIT")) { double[] d = CAstraUnits.GetLengthMassUnits(str); ElementData.MassFactor = d[0]; ElementData.LengthFactor = d[1]; string[] unt = CAstraUnits.GetUnits(str); //BasicInfo.MassUnit = CAstraUnits.GetMassUnit(unt[0]); //BasicInfo.LengthUnit = CAstraUnits.GetLengthUnit(unt[1]); ElementData.MassUnit = CAstraUnits.GetMassUnit(unt[2]); ElementData.LengthUnit = CAstraUnits.GetLengthUnit(unt[3]); } try { //ElementData.Add(CElementData.Parse(str)); } catch (Exception ex) { } } else if (find == "N020") { try { ElementMultiplier.Add(CElementMultiplier.Parse(str)); } catch (Exception ex) { } } else if (find == "N018") { try { ElementData.Add(CElementData.Parse(str)); } catch (Exception ex) { } } if (Analysis.NDYN == 2) { if (find == "N101") { try { TimeHistory.THist_1 = CTimeHistory1.Parse(str); } catch (Exception exx) { } } else if (find == "N102") { try { TimeHistory.THist_2 = CTimeHistory2.Parse(str); } catch (Exception exx) { } } else if (find == "N103") { try { TimeHistory.THist_3 = CTimeHistory3.Parse(str); } catch (Exception exx) { } } else if (find == "N104") { try { TimeHistory.THist_4 = CTimeHistory4.Parse(str); } catch (Exception exx) { } } else if (find == "N105") { try { if (TimeHistory.THist_5.Count > 0) { TimeHistory.THist_5.NodalConstraint = true; } TimeHistory.THist_5.Add(CTimeHistory5.Parse(str)); } catch (Exception exx) { } } else if (find == "N106") { try { TimeHistory.THist_6.Add(CTimeHistory6.Parse(str)); } catch (Exception exx) { } } } else if (Analysis.NDYN == 3) { Response.ReadFromStream(sr); } } kFs.Close(); sr.Close(); return(true); }
private async void btn_SubmitClicked(object sender, EventArgs e) { try { IsOnline = VerifyInternet(); if (IsOnline) { ShowLoading(true); btnSubmit.IsVisible = false; if (App.Current.Properties.ContainsKey("CustomerID")) { if (Convert.ToInt32(App.Current.Properties["CustomerID"]) != 0) { if (txtName.Text == "" || txtName.Text == null) { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Please enter your Name", "Ok"); return; } if (txtName.Text.Trim() == "") { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Please enter your Name", "Ok"); return; } txtName.Text = txtName.Text.Trim(); if (txtName.Text.Length >= 3 && txtName.Text.Length <= 20) { } else { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Name must be atleast 3 characters and maximum 20 characters", "Ok"); return; } var regexName = new Regex("^[a-zA-Z ]*$"); if (!regexName.IsMatch(txtName.Text.Trim())) { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Please enter only alphabets for Name", "Ok"); return; } if (txtPhoneNumber.Text == "" || txtPhoneNumber.Text == null) { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Please enter your Phone Number", "Ok"); return; } if (txtEmail.Text == "" || txtEmail.Text == null) { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Please enter your Email", "Ok"); return; } if (!RegexUtilities.IsEmailValid(txtEmail.Text.Trim())) { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Please enter valid Email", "Ok"); return; } if (txtMessage.Text == "" || txtMessage.Text == null) { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Please enter Message", "Ok"); return; } if (txtMessage.Text.Trim() == "") { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Please enter Message", "Ok"); return; } txtMessage.Text = txtMessage.Text.Trim(); if (txtMessage.Text.Length >= 10 && txtMessage.Text.Length <= 200) { } else { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Message must be atleast 10 characters and maximum 200 characters", "Ok"); return; } CSupport objOfferMySpace = new CSupport(); objOfferMySpace.CustomerID = Convert.ToInt32(App.Current.Properties["CustomerID"]); objOfferMySpace.Name = txtName.Text.Trim(); objOfferMySpace.Email = txtEmail.Text.Trim(); objOfferMySpace.PhoneNumber = txtPhoneNumber.Text.Trim(); objOfferMySpace.Message = txtMessage.Text.Trim(); if (App.Current.Properties.ContainsKey("apitoken")) { var json = JsonConvert.SerializeObject(objOfferMySpace); var content = new StringContent(json, Encoding.UTF8, "application/json"); OSupport resultObj = new OSupport(); await Task.Run(() => { ShowLoading(true); resultObj = dal_Support.InsertSupport(Convert.ToString(App.Current.Properties["apitoken"]), objOfferMySpace); }); if (resultObj.SupportRequestID != 0) { /* * await Task.Run(() => * { * SendEmail(); * }); */ int CustomerID = 0; if (App.Current.Properties.ContainsKey("CustomerID")) { CustomerID = Convert.ToInt32(App.Current.Properties["CustomerID"]); } ShowLoading(false); await DisplayAlert("", "Thank you for contacting Support. Our team will get back to you soon!", "Ok"); btnSubmit.IsVisible = true; await Navigation.PushAsync(new Home(null, CustomerID)); } else { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("Failed - InsertSupport", "Insert Failed", "Ok"); return; } } else { btnSubmit.IsVisible = true; ShowLoading(false); } } else { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Profile not found!", "Ok"); } } else { btnSubmit.IsVisible = true; ShowLoading(false); DisplayAlert("", "Customer Key does not exists", "Ok"); } ShowLoading(false); } else { await DisplayAlert("", "Please check your network connectivity", "Ok"); return; } } catch (Exception ex) { btnSubmit.IsVisible = true; ShowLoading(false); } }