예제 #1
0
        private void BtnFtoC_Click(object sender, EventArgs e)
        {
            double f = Convert.ToDouble(TxtTemp.Text);
            double c = (f - 32) * 5 / 9;

            TxtAns.Text = "攝氏" + c.ToString("f2") + "度";
            TxtTemp.Focus();
        }
예제 #2
0
        private void BtnCtoF_Click(object sender, EventArgs e)
        {
            double c = Convert.ToDouble(TxtTemp.Text);
            double f = c * 9 / 5 + 32;

            TxtAns.Text = "華氏" + f.ToString("f2") + "度";
            TxtTemp.Focus();
        }
예제 #3
0
        private void Savebtn_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (lblFrmType.Text == "Vamping")
            {
                if (lblStatus.Text == "Status")
                {
                    MessageBox.Show("Please select if the workplace is Safe or Unsafe");
                    return;
                }

                // do checks
                if (TxtTemp.Text == "0.0")
                {
                    MessageBox.Show("Missing Data", "Please add a temperature reading", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    TxtTemp.Focus();
                    return;
                }

                // do temp
                MWDataManager.clsDataAccess _dbManNeil = new MWDataManager.clsDataAccess();
                _dbManNeil.ConnectionString = TConnections.GetConnectionString(_theSystemDBTag, _UserCurrentInfoConnection);
                _dbManNeil.SqlStatement     = " ";
                _dbManNeil.SqlStatement     = _dbManNeil.SqlStatement + "Delete from PLANNINGTemperature where workplaceid =  '" + lblWorkplaceid.Text + "' and calendardate = '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "' ";
                //    "and sectionid = '" + MSecLbl.Text + "' and activity =  '" + MActLbl.Text + "' " +

                if (TxtTemp.Text != "0")
                {
                    _dbManNeil.SqlStatement = _dbManNeil.SqlStatement + "insert into PLANNINGTemperature values ('" + lblWorkplaceid.Text + "', '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "', '" + TxtTemp.Text + "') ";
                }

                _dbManNeil.SqlStatement       = _dbManNeil.SqlStatement + "  ";
                _dbManNeil.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
                _dbManNeil.queryReturnType    = MWDataManager.ReturnType.longNumber;
                _dbManNeil.ExecuteInstruction();

                MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess();
                _dbMan.ConnectionString = TConnections.GetConnectionString(_theSystemDBTag, _UserCurrentInfoConnection);
                _dbMan.SqlStatement     = " " +
                                          "Delete from PLANNINGOther where workplaceid =  '" + lblWorkplaceid.Text + "' and calendardate = '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "' " +
                                          "and sectionid = '" + MoSecLbl.Text + "' and activity =  '" + ActLbl.Text + "' " +


                                          "insert into PLANNINGOther  \r\n" +
                                          "(WorkplaceID,SectionID,Activity,CalendarDate,  \r\n" +
                                          " SupportType,SupTop,SupMid,SupBot,  \r\n" +
                                          " SweepDist,SWTop,SWMid,SWBottom  \r\n" +
                                          " )   \r\n" +
                                          "values ('" + lblWorkplaceid.Text + "', '" + MoSecLbl.Text + "', '" + ActLbl.Text + "', '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "' " +
                                          ", '" + SupTypeCombo.Text + "' , '" + SupTopTxt.Text + "', '" + SupMidTxt.Text + "', '" + SupBotTxt.Text + "',  " +

                                          " '" + SwpTxt.Text + "' ,'" + swtextEdit1.Text + "','" + swtextEdit2.Text + "','" + swtextEdit3.Text + "' )  ";
                _dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
                _dbMan.queryReturnType    = MWDataManager.ReturnType.longNumber;
                _dbMan.ExecuteInstruction();


                if (lblStatus.Text == "Safe")
                {
                    TheABSCode = "Safe";
                }

                if (lblStatus.Text == "UnSafe")
                {
                    TheABSCode = "UnSafe";
                }

                if (lblStatus.Text == "No Vis.")
                {
                    TheABSCode = "No Vis.";
                }
            }
            else
            {
                if (ActLbl.Text != "1")
                {
                    if (lblStatus.Text == "Status")
                    {
                        MessageBox.Show("Please select if the workplace is Safe or Unsafe");
                        return;
                    }

                    // do checks
                    if (TxtTemp.Text == "0.0")
                    {
                        MessageBox.Show("Missing Data", "Please add a temperature reading", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        TxtTemp.Focus();
                        return;
                    }

                    if (SupTopTxt.Text == "")
                    {
                        MessageBox.Show("You Must Enter a support top", "Enter Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }


                    if (SupMidTxt.Text == "")
                    {
                        MessageBox.Show("You Must Enter a support mid", "Enter Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    if (SupBotTxt.Text == "")
                    {
                        MessageBox.Show("You Must Enter a support bottom", "Enter Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    if (SwpTxt.Text == "")
                    {
                        MessageBox.Show("You Must Enter a sweeping distance", "Enter Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }


                    if (SupTopTxt.Text == "0.0")
                    {
                        MessageBox.Show("You Must Enter a support top not 0", "Enter Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }


                    if (SupMidTxt.Text == "0.0")
                    {
                        MessageBox.Show("You Must Enter a support mid not 0", "Enter Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    if (SupBotTxt.Text == "0.0")
                    {
                        MessageBox.Show("You Must Enter a support bottom not 0", "Enter Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }


                    if (SwpTxt.Text == "0.0")
                    {
                        MessageBox.Show("You Must Enter a sweeping distance not 0", "Enter Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }


                    // do temp
                    MWDataManager.clsDataAccess _dbManNeil = new MWDataManager.clsDataAccess();
                    _dbManNeil.ConnectionString = TConnections.GetConnectionString(_theSystemDBTag, _UserCurrentInfoConnection);
                    _dbManNeil.SqlStatement     = " ";
                    _dbManNeil.SqlStatement     = _dbManNeil.SqlStatement + "Delete from PLANNINGTemperature where workplaceid =  '" + lblWorkplaceid.Text + "' and calendardate = '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "' ";
                    //    "and sectionid = '" + MSecLbl.Text + "' and activity =  '" + MActLbl.Text + "' " +

                    if (TxtTemp.Text != "0")
                    {
                        _dbManNeil.SqlStatement = _dbManNeil.SqlStatement + "insert into PLANNINGTemperature values ('" + lblWorkplaceid.Text + "', '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "', '" + TxtTemp.Text + "') ";
                    }

                    _dbManNeil.SqlStatement       = _dbManNeil.SqlStatement + "  ";
                    _dbManNeil.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
                    _dbManNeil.queryReturnType    = MWDataManager.ReturnType.longNumber;
                    _dbManNeil.ExecuteInstruction();


                    MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess();
                    _dbMan.ConnectionString = TConnections.GetConnectionString(_theSystemDBTag, _UserCurrentInfoConnection);
                    _dbMan.SqlStatement     = " " +
                                              "Delete from PLANNINGOther where workplaceid =  '" + lblWorkplaceid.Text + "' and calendardate = '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "' " +
                                              "and sectionid = '" + MoSecLbl.Text + "' and activity =  '" + ActLbl.Text + "' " +


                                              "insert into PLANNINGOther  \r\n" +
                                              "(WorkplaceID,SectionID,Activity,CalendarDate,  \r\n" +
                                              " SupportType,SupTop,SupMid,SupBot,  \r\n" +
                                              " SweepDist,SWTop,SWMid,SWBottom  \r\n" +
                                              " )   \r\n" +
                                              "values ('" + lblWorkplaceid.Text + "', '" + MoSecLbl.Text + "', '" + ActLbl.Text + "', '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "' " +
                                              ", '" + SupTypeCombo.Text + "' , '" + SupTopTxt.Text + "', '" + SupMidTxt.Text + "', '" + SupBotTxt.Text + "',  " +

                                              " '" + SwpTxt.Text + "' ,'" + swtextEdit1.Text + "','" + swtextEdit2.Text + "','" + swtextEdit3.Text + "' )  ";
                    _dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
                    _dbMan.queryReturnType    = MWDataManager.ReturnType.longNumber;
                    _dbMan.ExecuteInstruction();
                }
                else
                {
                    ///////////////////////DEVELOPEMENT//////////////////////////////
                    if (VentPipesTxt.Visible == true)
                    {
                        if (VentPipesTxt.Text == "0.0")
                        {
                            MessageBox.Show("Please add a Vent Pipe dist.", "Unselected Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                    }

                    if (PermSupTxt.Visible == true)
                    {
                        //if (PermSupTxt.Text == "0.0")
                        //{
                        //    MessageBox.Show("Please add a Permanent Support dist.", "Unselected Item", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        //    return;
                        //}
                    }

                    // save other
                    MWDataManager.clsDataAccess _dbManOther = new MWDataManager.clsDataAccess();
                    _dbManOther.ConnectionString = TConnections.GetConnectionString(_theSystemDBTag, _UserCurrentInfoConnection);
                    _dbManOther.SqlStatement     = " ";
                    _dbManOther.SqlStatement     = _dbManOther.SqlStatement + "Delete from PLANNINGOtherDev where workplaceid =  '" + lblWorkplaceid.Text + "' and calendardate = '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "' ";

                    _dbManOther.SqlStatement = _dbManOther.SqlStatement + "insert into PLANNINGOtherDev values ('" + lblWorkplaceid.Text + "', '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "', '" + VentPipesTxt.Text + "', '" + PermSupTxt.Text + "') ";
                    _dbManOther.SqlStatement = _dbManOther.SqlStatement + "  ";

                    _dbManOther.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
                    _dbManOther.queryReturnType    = MWDataManager.ReturnType.longNumber;
                    _dbManOther.ExecuteInstruction();

                    // do temp
                    MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess();
                    _dbMan.ConnectionString = TConnections.GetConnectionString(_theSystemDBTag, _UserCurrentInfoConnection);
                    _dbMan.SqlStatement     = " ";
                    _dbMan.SqlStatement     = _dbMan.SqlStatement + "Delete from PLANNINGTemperature where workplaceid =  '" + lblWorkplaceid.Text + "' and calendardate = '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "' ";

                    if (TxtTemp.Text != "0")
                    {
                        _dbMan.SqlStatement = _dbMan.SqlStatement + "insert into PLANNINGTemperature values ('" + lblWorkplaceid.Text + "', '" + String.Format("{0:yyyy-MM-dd}", OtherdateTimePicker1.Value) + "', '" + TxtTemp.Text + "') ";
                    }

                    _dbMan.SqlStatement       = _dbMan.SqlStatement + "  ";
                    _dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
                    _dbMan.queryReturnType    = MWDataManager.ReturnType.longNumber;
                    _dbMan.ExecuteInstruction();
                }



                TheActivity = Convert.ToInt32(ActLbl.Text);
                TheSection  = MoSecLbl.Text;

                if (lblStatus.Text == "Safe")
                {
                    TheABSCode = "Safe";
                }

                if (lblStatus.Text == "UnSafe")
                {
                    TheABSCode = "UnSafe";
                }

                if (lblStatus.Text == "No Vis.")
                {
                    TheABSCode = "No Vis.";
                }
            }

            Mineware.Systems.Global.sysNotification.TsysNotification.showNotification("Data Saved", "Data saved", Color.CornflowerBlue);
            this.Close();
        }