public static void assignEstimator(estimateInfo estimateToEdit) { MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection(); try { //define the command reference MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand(); msqlCommand.Connection = msqlConnection; msqlCommand.CommandText = "UPDATE estimate SET estimator=@estimator WHERE appNo=@appNo"; msqlCommand.Parameters.AddWithValue("@estimator", estimateToEdit.estimator); msqlCommand.Parameters.AddWithValue("@appNo", estimateToEdit.appsNo); msqlCommand.ExecuteNonQuery(); } catch (Exception er) { } finally { //always close the connection msqlConnection.Close(); } }
private void submitBtn_Click(object sender, RoutedEventArgs e) { estimateInfo estimateData = new ESCMSData.estimateInfo(); estimateData.appsNo = applicationNoTB.Text; estimateData.estimator = assignedEstimatorCB.Text; ESCMSStorage.DbInteraction.assignEstimator(estimateData); this.Close(); }
public AssignContractor(estimateInfo info) { InitializeComponent(); applicationNoTB.Text = info.appsNo; nameTxtbox.Text = info.name; addressTxtbox.Text = info.address; contactNoTxtbox.Text = info.contact; assignedEstimatorTxtbox.Text = info.estimator; wireLengthRequiredTB.Text =Convert.ToString(info.wireLength); angleTypeTB.Text = Convert.ToString(info.angleType); weightofAngleCalculationTB.Text = Convert.ToString(info.angleWeight); quotationAmountTB.Text =Convert.ToString(info.quotationAmount); }
public AddEstimator(estimateInfo info) { InitializeComponent(); applicationNoTB.Text = info.appsNo; nameTxtbox.Text = info.name; addressTxtbox.Text = info.address; contactNoTxtbox.Text = info.contact; assignedEstimatorCB.Text = info.estimator; List<EmployeeInfo> estimators = ESCMSStorage.DbInteraction.GetAllEstimatorList(); _estimatorCollection.Clear(); foreach (EmployeeInfo estimator in estimators) { _estimatorCollection.Add(estimator); } }
public AddQuotation(estimateInfo info) { InitializeComponent(); applicationNoTB.Text = info.appsNo; nameTxtbox.Text = info.name; addressTxtbox.Text = info.address; contactNoTxtbox.Text = info.contact; assignedEstimatorCB.Text = info.estimator; wireLengthRequiredTB.Text = Convert.ToString(info.wireLength); weightofAngleCalculationTB.Text = Convert.ToString(info.angleWeight); quotationAmountTB.Text = Convert.ToString(info.quotationAmount); List<EmployeeInfo> estimators = ESCMSStorage.DbInteraction.GetAllEstimatorList(); _estimatorCollection.Clear(); foreach (EmployeeInfo estimator in estimators) { _estimatorCollection.Add(estimator); } }
public static List<estimateInfo> GetAllEstimateListWithContractor() { List<estimateInfo> estimateList = new List<estimateInfo>(); MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection(); try { //define the command reference MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand(); msqlCommand.Connection = msqlConnection; msqlCommand.CommandText = "Select * From estimate;"; MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader(); while (msqlReader.Read()) { estimateInfo estimate = new estimateInfo(); estimate.appsNo = msqlReader.GetString("appNo"); estimate.wireLength = msqlReader.GetDouble("wireLength"); estimate.angleType = (AngleType)Enum.Parse(typeof(AngleType), msqlReader.GetString("angleType"), true); estimate.angleWeight = msqlReader.GetDouble("angleWeight"); estimate.quotationAmount = msqlReader.GetDouble("amountQuotation"); estimate.estimator = msqlReader.GetString("estimator"); estimate.contractor = msqlReader.GetString("contractor"); estimateList.Add(estimate); } } catch (Exception er) { } finally { //always close the connection msqlConnection.Close(); } return estimateList; }
public static void EditEstimate(estimateInfo estimateToEdit) { MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection(); try { //define the command reference MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand(); msqlCommand.Connection = msqlConnection; msqlCommand.CommandText = "UPDATE estimate SET estimator=@estimator,wireLength=@wireLength,angleType=@angleType,angleWeight=@angleWeight,amountQuotation=@amountQuotation WHERE appNo=@appNo"; msqlCommand.Parameters.AddWithValue("@estimator", estimateToEdit.estimator); msqlCommand.Parameters.AddWithValue("@wireLength", estimateToEdit.wireLength); msqlCommand.Parameters.AddWithValue("@angleType", estimateToEdit.angleType); msqlCommand.Parameters.AddWithValue("@angleWeight", estimateToEdit.angleWeight); msqlCommand.Parameters.AddWithValue("@amountQuotation", estimateToEdit.quotationAmount); msqlCommand.Parameters.AddWithValue("@appNo", estimateToEdit.appsNo); msqlCommand.ExecuteNonQuery(); } catch (Exception er) { } finally { //always close the connection msqlConnection.Close(); } }
public static int DoRegisterNewEstimate(estimateInfo estimateToEdit) { int returnVal = 0; MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection(); try { //define the command reference MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand(); //define the connection used by the command object msqlCommand.Connection = msqlConnection; msqlCommand.CommandText = "insert into estimate(appNo)" + "values(@appNo)"; msqlCommand.Parameters.AddWithValue("@appNo", estimateToEdit.appsNo); msqlCommand.ExecuteNonQuery(); // msqlCommand.ExecuteNonQuery(); returnVal = 1; } catch (Exception er) { returnVal = 0; } finally { //always close the connection msqlConnection.Close(); } return returnVal; }
private void submitBtn_Click(object sender, RoutedEventArgs e) { NewConnectionInfo newConnection = new ESCMSData.NewConnectionInfo(); newConnection.paymentId = paymentIDTxtbox.Text; newConnection.customerId = customerIdlabel.Content.ToString(); newConnection.receivedDate = applicationReceivedDateDatePicker.SelectedDate.Value; if (isEdit == false) { newConnection.appsNo = GenerateId(); ESCMSStorage.DbInteraction.DoRegisterNewNewConnection(newConnection); estimateInfo esInfo = new estimateInfo(); esInfo.appsNo = newConnection.appsNo; ESCMSStorage.DbInteraction.DoRegisterNewEstimate(esInfo); } else { newConnection.appsNo = newConnectionId; ESCMSStorage.DbInteraction.EditNewConnection(newConnection); } this.Close(); }
private void submitBtn_Click(object sender, RoutedEventArgs e) { estimateInfo estimateData = new ESCMSData.estimateInfo(); estimateData.appsNo = applicationNoTB.Text; estimateData.estimator = assignedEstimatorCB.Text; estimateData.wireLength = Convert.ToDouble(wireLengthRequiredTB.Text); estimateData.angleType = (AngleType)Enum.Parse(typeof(AngleType), angleTypeCB.Text, true); estimateData.angleWeight = Convert.ToDouble(weightofAngleCalculationTB.Text); estimateData.quotationAmount = Convert.ToDouble(quotationAmountTB.Text); ESCMSStorage.DbInteraction.EditEstimate(estimateData); this.Close(); }