예제 #1
0
 public void insertProducerType(wsProducerType p)
 {
     this.ProducerName           = p.ProducerName;
     this.ProducerCountry        = p.ProducerCountry;
     this.ProducerState          = p.ProducerState;
     this.ProducerCity           = p.ProducerCity;
     this.ProducerStreetBuilding = p.ProducerStreetBuilding;
     this.ProducerPhone          = p.ProducerPhone;
 }
예제 #2
0
        public wsProducerType extractProducerType()
        {
            wsProducerType p = new wsProducerType();

            p.ProducerName           = this.ProducerName;
            p.ProducerCountry        = this.ProducerCountry;
            p.ProducerState          = this.ProducerState;
            p.ProducerCity           = this.ProducerCity;
            p.ProducerStreetBuilding = this.ProducerStreetBuilding;
            p.ProducerPhone          = this.ProducerPhone;

            return(p);
        }
예제 #3
0
        public List<wsProducerType> GetProducerList() //lp_sel_ProducerList
        {
            List<wsProducerType> l = new List<wsProducerType>();
            using (SqlConnection conn = new SqlConnection(Configuration.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_sel_ProducerList");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader Reader = cmd.ExecuteReader();

                if (Reader.HasRows)
                {
                    while (Reader.Read())
                    {
                        wsProducerType temp = new wsProducerType();

                        if (!Reader.IsDBNull(Reader.GetOrdinal("ID")))
                            temp.ProducerID = (int)Reader["ID"];

                        if (!Reader.IsDBNull(Reader.GetOrdinal("Name")))
                            temp.ProducerName = (string)Reader["Name"];

                        if (!Reader.IsDBNull(Reader.GetOrdinal("Country")))
                            temp.ProducerCountry = (string)Reader["Country"];

                        if (!Reader.IsDBNull(Reader.GetOrdinal("State")))
                            temp.ProducerState = (string)Reader["State"];

                        if (!Reader.IsDBNull(Reader.GetOrdinal("City")))
                            temp.ProducerCity = (string)Reader["City"];

                        if (!Reader.IsDBNull(Reader.GetOrdinal("StreetBuilding")))
                            temp.ProducerStreetBuilding = (string)Reader["StreetBuilding"];

                        if (!Reader.IsDBNull(Reader.GetOrdinal("Phone")))
                            temp.ProducerPhone = (string)Reader["Phone"];

                        l.Add(temp);
                    }
                }
                conn.Close();
            }
            return l;
        }
예제 #4
0
        public wsProducerType GetProducerData(int ID)//lp_sel_ProducerData
        {
            wsProducerType l = new wsProducerType();

            using (SqlConnection conn = new SqlConnection(Configuration.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_sel_ProducerData");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ProducerID", ID);
                SqlDataReader Reader = cmd.ExecuteReader();

                while (Reader.Read())
                {
                    l.ProducerID = (int)Reader["ID"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Name")))
                        l.ProducerName = (string)Reader["Name"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Country")))
                        l.ProducerCountry = (string)Reader["Country"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("State")))
                        l.ProducerState = (string)Reader["State"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("City")))
                        l.ProducerCity = (string)Reader["City"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("StreetBuilding")))
                        l.ProducerStreetBuilding = (string)Reader["StreetBuilding"];

                    if (!Reader.IsDBNull(Reader.GetOrdinal("Phone")))
                        l.ProducerPhone = (string)Reader["Phone"];
                }
            }
            return l;
        }
예제 #5
0
 // --- Submit form
 private void btn_okUW_Click(object sender, RoutedEventArgs e)
 {
     switch (ucMode)
     {
         case 1: // mode_U
             wc.ws_updateProducerAsync(globalProducer);
             break;
         case 2: // mode_W
             globalProducer = grid_ProducerType.DataContext as wsProducerType;
             wc.ws_insertProducerAsync(globalProducer);
             break;
     }
    
 }
예제 #6
0
        void wc_ws_selectProducersDataCompleted(object sender, ws_selectProducersDataCompletedEventArgs e)
        {
            if (e.Result != null)
            {

                globalProducer = e.Result;
                grid_ProducerType.DataContext = globalProducer;

            }
            else
            {
                cwnd_ShitHappens w = new cwnd_ShitHappens(ErrorResources.err_SELECT, e.OpStatus.ToString());
                w.Show();
            }
        }
예제 #7
0
 public int ws_insertProducer(wsProducerType LocalProducer, out string OpStatus)
 {
     int res = 555;
     try
     {
         OpStatus = "Выполнено";
         CatalogsDataManager CDM = new CatalogsDataManager();
         if ((res = CDM.insertProducer(LocalProducer)) == 0) return 1;
         else return res;
     }
     catch (Exception err)
     {
         OpStatus = err.Message.ToString();
         return 0;
     }
 }
예제 #8
0
 public int ws_updateProducer(wsProducerType LocalProducer, out string OpStatus)
 {
     try
     {
         OpStatus = "Выполнено";
         CatalogsDataManager CDM = new CatalogsDataManager();
         CDM.updateProducer(LocalProducer);
         return 1;
     }
     catch (Exception err)
     {
         OpStatus = err.Message.ToString();
         return 0;
     }
 }
예제 #9
0
        public int ws_checkPassportProducer(wsProducerType P, out int OpValue, out string OpStatus)
        {
            OpValue = 555;
            wsProducerType RP = new wsProducerType();
            try
            {
                DeviceDataManager DDM = new DeviceDataManager();
                DDM.checkPassport(P, out OpValue, out OpStatus);

                if (OpValue == 50018) return 1; // Можно вставлять паспорт
                else return 0;
            }
            catch (Exception err)
            {
                OpStatus = "Ошибка SQL: " + err.Message.ToString();
                return 0;
            }
        }
예제 #10
0
 private void btn_deleteProducer_Click(object sender, RoutedEventArgs e)
 {
     producerType = list_Catalogs.SelectedItem as wsProducerType;
     if (producerType != null)
     {
         wc.ws_checkProducerAsync((int)producerType.ProducerID);
     }
     else
     {
         InfoWindow iw = new InfoWindow(Messages.m_Message,"Не выбран элемент для удаления");
         iw.Show();
     }
 }
예제 #11
0
        public void insertProducerType(wsProducerType p)
        {

            this.ProducerName = p.ProducerName;
            this.ProducerCountry = p.ProducerCountry; 
            this.ProducerState = p.ProducerState;
            this.ProducerCity = p.ProducerCity;
            this.ProducerStreetBuilding = p.ProducerStreetBuilding;
            this.ProducerPhone = p.ProducerPhone;
        }
예제 #12
0
        public wsProducerType extractProducerType()
        {
            wsProducerType p = new wsProducerType();

            p.ProducerName = this.ProducerName;
            p.ProducerCountry = this.ProducerCountry;
            p.ProducerState = this.ProducerState;
            p.ProducerCity = this.ProducerCity;
            p.ProducerStreetBuilding = this.ProducerStreetBuilding;
            p.ProducerPhone = this.ProducerPhone;

            return p;
        }
예제 #13
0
        public int insertProducer(wsProducerType P)//lp_ins_Producer
        {
            int ReturnVal = 999;
            using (SqlConnection conn = new SqlConnection(Configuration.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_ins_Producer");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@ProducerID_out", SqlDbType.Int);
                cmd.Parameters["@ProducerID_out"].Direction = ParameterDirection.Output;
                

                cmd.Parameters.AddWithValue("@Name", P.ProducerName);
                cmd.Parameters.AddWithValue("@Country", P.ProducerCountry);
                cmd.Parameters.AddWithValue("@State", P.ProducerState);
                cmd.Parameters.AddWithValue("@City", P.ProducerCity);
                cmd.Parameters.AddWithValue("@StreetBuilding", P.ProducerStreetBuilding);
                cmd.Parameters.AddWithValue("@Phone", P.ProducerPhone);

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

                cmd.ExecuteNonQuery();

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

                conn.Close();
            }

            return ReturnVal;
        }
예제 #14
0
 public cwnd_Producer(wsProducerType P)
 {
     InitializeComponent();
     ContentControl_Producer.Content = P;
     Loaded += new RoutedEventHandler(cwnd_Producer_Loaded);
 }
예제 #15
0
        public void checkPassport(wsProducerType P, out int OutVal, out string OutText)//lp_sel_CheckDevicePassportData
        {
            wsProducerType l = new wsProducerType();
            using (SqlConnection conn = new SqlConnection(Configuration.ConnectionString))
            {
                SqlCommand cmd = new SqlCommand("lp_sel_CheckDevicePassportData");
                conn.Open();
                cmd.Connection = conn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Name", P.ProducerName);
                cmd.Parameters.AddWithValue("@Country", P.ProducerCountry);

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

                SqlDataReader Reader = cmd.ExecuteReader();

                Reader.Close();
                OutVal = (int)cmd.Parameters["@ReturnVal"].Value;
                OutText = selectMessageText(OutVal);
                conn.Close();
            }
        }