Ejemplo n.º 1
0
 public int ws_insertCalibration(wsCalibration c, out string OpStatus)
 {
     try
     {
         OpStatus = "Выполнено";
         DeviceDataManager DDM = new DeviceDataManager();
         DDM.insertCalibration(c);
         return 1;
     }
     catch (Exception err)
     {
         OpStatus = err.Message.ToString();
         return 0;
     }
 }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            item = grid_Calibration.DataContext as wsCalibration;

            if ((int)(cbox_result.SelectedItem as wsSimpleItem).ID == 1)
                item.result = true;
            else
                item.result = false;

            item.typeID = (int)(cbox_type.SelectedItem as wsSimpleItem).ID;

            wc.ws_insertCalibrationAsync(item);
        }
Ejemplo n.º 3
0
        public List<wsCalibration> selectNextCalibrations() //lp_sel_NextCalibration
        {
            List<wsCalibration> l = new List<wsCalibration>();
            using (SqlConnection conn = new SqlConnection(Configuration.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_sel_NextCalibration");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@FuturePeriod", 7); //7 дней

                SqlDataReader Reader = cmd.ExecuteReader();

                while (Reader.Read())
                {
                    wsCalibration t = new wsCalibration();

                    if (!Reader.IsDBNull(Reader.GetOrdinal("DevID")))
                        t.ID = (int)Reader["DevID"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("LongDescrRU")))
                        t.Description = (string)Reader["LongDescrRU"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("NextDate")))
                        t.plannedDate = (DateTime)Reader["NextDate"];

                    l.Add(t);

                }
                conn.Close();
            }
            return l;
        }
Ejemplo n.º 4
0
        public int insertCalibration(wsCalibration c)//lp_ins_NewCalibration
        {
            int ret = 0;

            // @DevID		        int						-- Устройство 
            //,@FactDate	        datetime				-- Фактическая дата калибровки
            //,@CalibrationTypeID	int				        -- Тип поверки
            //,@Result	            bit						-- Результат поверки
            //,@DocNo		        nvarchar(50) = null		-- Номер документа
            //,@Comments	        nvarchar(max) = null	-- Комментарии

            using (SqlConnection conn = new SqlConnection(Configuration.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_ins_NewCalibration");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@ReturnVal", SqlDbType.Int);
                cmd.Parameters["@ReturnVal"].Direction = ParameterDirection.ReturnValue;

                cmd.Parameters.AddWithValue("@DevID", c.ID);
                cmd.Parameters.AddWithValue("@FactDate", c.factDate);
                cmd.Parameters.AddWithValue("@CalibrationTypeID", c.typeID);
                cmd.Parameters.AddWithValue("@Result", c.result);
                cmd.Parameters.AddWithValue("@DocNo", c.docNo);
                cmd.Parameters.AddWithValue("@Comments", c.comment);

                cmd.ExecuteNonQuery();
                ret = (int)cmd.Parameters["@ReturnVal"].Value;

                conn.Close();
            }
            return ret;
        }
Ejemplo n.º 5
0
        //-------- CALIBRATION ----------------------------------------------------

        public List<wsCalibration> selectDeviceCalibrations(int id) //lp_sel_DeviceCalibration
        {
            List<wsCalibration> l = new List<wsCalibration>();
            using (SqlConnection conn = new SqlConnection(Configuration.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_sel_DeviceCalibration");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@DevID", id);

                SqlDataReader Reader = cmd.ExecuteReader();

                while (Reader.Read())
                {
                    wsCalibration t = new wsCalibration();

                    t.ID = id;

                    if (!Reader.IsDBNull(Reader.GetOrdinal("FactDate")))
                        t.factDate = (DateTime)Reader["FactDate"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("PlannedDate")))
                        t.plannedDate = (DateTime)Reader["PlannedDate"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("TypeName")))
                        t.typeName = (string)Reader["TypeName"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Result")))
                        t.result = (bool)Reader["Result"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("DocNo")))
                        t.docNo = (string)Reader["DocNo"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Comments")))
                        t.comment = (string)Reader["Comments"];

                    l.Add(t);

                }
                conn.Close();
            }
            return l;
        }