Example #1
0
        private void GridView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            ControlNavigatorButtons cnb  = controlNavigator1.Buttons;
            ControlNavigatorButtons cnb2 = controlNavigator2.Buttons;

            if (e.FocusedRowHandle < 0)
            {
                cnb.CustomButtons[0].Enabled = false;// cnb.Remove.Enabled;

                controlNavigator2.Visible = false;

                /*for (int i = 0; i < cnb2.CustomButtons.Count; i++)
                 * {
                 *  cnb2.CustomButtons[i].Enabled = false;
                 * }*/
            }
            else
            {
                cnb.CustomButtons[0].Enabled = true;

                // проверяем существование обследований для типа
                Equipment.EquipmentKind EquipmentKindID = (Equipment.EquipmentKind)Convert.ToInt64(GridView.GetRowCellValue(GridView.FocusedRowHandle, "EquipmentKindID"));
                controlNavigator2.Visible = true;

                for (int i = 0; i < cnb2.CustomButtons.Count; i++)
                {
                    Inspection.InspectionType type = Inspection.InspectionType.Visual;
                    if (cnb2.CustomButtons[i].Tag.ToString() == "Visual")
                    {
                        type = Inspection.InspectionType.Visual;
                    }
                    if (cnb2.CustomButtons[i].Tag.ToString() == "FHA")
                    {
                        type = Inspection.InspectionType.FHA;
                    }
                    if (cnb2.CustomButtons[i].Tag.ToString() == "HARG")
                    {
                        type = Inspection.InspectionType.HARG;
                    }
                    if (cnb2.CustomButtons[i].Tag.ToString() == "Warm")
                    {
                        type = Inspection.InspectionType.Warm;
                    }
                    if (cnb2.CustomButtons[i].Tag.ToString() == "Vibro")
                    {
                        type = Inspection.InspectionType.Vibro;
                    }
                    if (cnb2.CustomButtons[i].Tag.ToString() == "Parameter")
                    {
                        type = Inspection.InspectionType.Parameter;
                    }
                    if (cnb2.CustomButtons[i].Tag.ToString() == "Electrical")
                    {
                        type = Inspection.InspectionType.Electrical;
                    }

                    if (Inspection.m_listEquipmentInspections[EquipmentKindID].IndexOf(type) >= 0)
                    {
                        cnb2.CustomButtons[i].Visible = true;
                    }
                    else
                    {
                        cnb2.CustomButtons[i].Visible = false;
                    }
                }

                controlNavigator2.Width = Inspection.m_listEquipmentInspections[EquipmentKindID].Count * m_cnWidth;
            }
        }
Example #2
0
        internal static string AddInspection(
            string SectionID,
            DateTime InspectionDate,
            bool Sampling,
            Inspection.InspectionType InspectionType,
            string InspectionComments = "",
            string SampleLocation     = "",
            int DirectRating          = -1,
            string DirectComments     = "",
            int PaintRating           = -1,
            string PaintComments      = "")
        {
            string    str        = "SELECT * FROM Inspection_Data WHERE [INSP_DATA_INSP_DATE]>=#" + Conversions.ToString(DateAndTime.DateAdd(DateInterval.Day, (double)checked (-1 * Inspection.IInspectionWindow), DateAndTime.Today)) + "# AND [INSP_DATA_SEC_ID]={" + SectionID + "}";
            DataTable dataTable1 = mdUtility.DB.GetDataTable(str);
            DataTable dataTable2 = mdUtility.DB.GetDataTable("SELECT * FROM [Section Info] WHERE [sec_id]={" + SectionID + "}");
            string    uniqueId;

            if (dataTable1.Rows.Count == 0)
            {
                DataRow row     = dataTable1.NewRow();
                DataRow dataRow = row;
                dataRow["INSP_DATA_SEC_ID"] = (object)SectionID;
                uniqueId = mdUtility.GetUniqueID();
                dataRow["INSP_DATA_ID"]        = (object)uniqueId;
                dataRow["inspectorlink"]       = (object)mdUtility.strCurrentInspector;
                dataRow["INSP_Source"]         = (object)nameof(Inspection);
                dataRow["INSP_DATA_INSP_DATE"] = (object)InspectionDate;
                dataRow["INSP_DATA_SAMP"]      = (object)Sampling;
                dataRow["bred_status"]         = (object)"N";
                dataRow["insp_data_type"]      = (object)InspectionType;
                if ((uint)Microsoft.VisualBasic.CompilerServices.Operators.CompareString(InspectionComments, "", false) > 0U)
                {
                    dataRow["INSP_DATA_COMMENTS"] = (object)InspectionComments;
                }
                dataTable1.Rows.Add(row);
            }
            else
            {
                DataRow row = dataTable1.Rows[0];
                uniqueId           = Conversions.ToString(row["INSP_DATA_ID"]);
                row["bred_status"] = (object)"U";
            }
            mdUtility.DB.SaveDataTable(ref dataTable1, str);
            DataTable dataTable3  = mdUtility.DB.GetDataTable("SELECT SUM(SAMP_DATA_QTY) AS SAMP_QTY_SUM FROM Sample_Data WHERE [SAMP_DATA_INSP_DATA_ID]={" + uniqueId + "}");
            DataTable tableSchema = mdUtility.DB.GetTableSchema("Sample_Data");
            DataRow   row1        = tableSchema.NewRow();
            DataRow   dataRow1    = row1;

            dataRow1["BRED_Status"]            = (object)"N";
            dataRow1["samp_data_id"]           = (object)mdUtility.GetUniqueID();
            dataRow1["samp_data_insp_data_id"] = (object)uniqueId;
            double num = Conversions.ToDouble(Microsoft.VisualBasic.CompilerServices.Operators.SubtractObject(dataTable2.Rows[0]["sec_qty"], UtilityFunctions.FixDBNull(RuntimeHelpers.GetObjectValue(dataTable3.Rows[0]["SAMP_QTY_SUM"]), (object)0)));

            dataRow1["samp_data_qty"]   = RuntimeHelpers.GetObjectValue(Interaction.IIf(num < 0.0, (object)0, (object)num));
            dataRow1["samp_data_paint"] = RuntimeHelpers.GetObjectValue(dataTable2.Rows[0]["sec_paint"]);
            if (Sampling && Microsoft.VisualBasic.CompilerServices.Operators.CompareString(SampleLocation, "", false) != 0)
            {
                dataRow1["samp_data_loc"] = (object)mdUtility.fMainForm.tvInspection.GetNodeByKey(mdUtility.fMainForm.CurrentLocation).Tag.ToString();
            }
            if (DirectRating != -1 || PaintRating != -1)
            {
                DataTable dataTable4 = mdUtility.DB.GetDataTable("SELECT * FROM RO_CIRating");
                if (DirectRating > 0)
                {
                    DataRow[] dataRowArray = dataTable4.Select("CIIndex=" + Conversions.ToString(DirectRating));
                    if (dataRowArray != null)
                    {
                        dataRow1["samp_data_comp_rate"] = RuntimeHelpers.GetObjectValue(dataRowArray[0]["CIRateValue"]);
                        if ((uint)Microsoft.VisualBasic.CompilerServices.Operators.CompareString(DirectComments, "", false) > 0U)
                        {
                            dataRow1["samp_data_comp_rate_comments"] = (object)DirectComments;
                        }
                    }
                }
                if (PaintRating > 0)
                {
                    DataRow[] dataRowArray = dataTable4.Select("CIIndex=" + Conversions.ToString(PaintRating));
                    if (dataRowArray != null)
                    {
                        dataRow1["samp_data_paint_rate"] = RuntimeHelpers.GetObjectValue(dataRowArray[0]["CIRateValue"]);
                        if ((uint)Microsoft.VisualBasic.CompilerServices.Operators.CompareString(PaintComments, "", false) > 0U)
                        {
                            dataRow1["samp_data_paint_rate_comments"] = (object)PaintComments;
                        }
                    }
                }
            }
            tableSchema.Rows.Add(row1);
            mdUtility.DB.SaveDataTable(ref tableSchema, "SELECT * FROM Sample_Data");
            return(uniqueId);
        }
Example #3
0
 public InspectionForm(long equipmentID, Inspection.InspectionType type)
 {
     m_EquipmentID = equipmentID;
     m_type        = type;
     InitializeComponent();
 }