Esempio n. 1
0
        public TelephoneModel UpdateTelephone(TelephoneModel telephoneModel)
        {
            _telephones.ReplaceOne(telephone => telephone.beforeTelephone.Equals(telephoneModel.beforeTelephone), telephoneModel);
            TelephoneModel tmpTelephoneModel = GetOneBeforeTelephone(telephoneModel.beforeTelephone);

            return(tmpTelephoneModel);
        }
        static private OleDbCommand CreateOleDbCommand(TelephoneModel telephoneModel, string commandText)
        {
            OleDbCommand command = new OleDbCommand(commandText);

            command.Parameters.AddWithValue("@beforeTelephone", telephoneModel.beforeTelephone);
            return(command);
        }
Esempio n. 3
0
        public static TelephoneModel ToObject(DataRow reader)
        {
            TelephoneModel telephoneModel = new TelephoneModel();

            telephoneModel.beforeTelephone = reader[0].ToString();

            Debug.WriteLine("TelephoneModel:" + telephoneModel.ToString());
            return(telephoneModel);
        }
        public TelephoneModel UpdateTelephone(TelephoneModel telephoneModel)
        {
            int i = -1;

            using (OleDbCommand command = new OleDbCommand())
            {
                i = ExecuteNonQuery(TelephoneStringsInner.UpdateTelephone(telephoneModel));
            }
            return(GetOneBeforeTelephone(telephoneModel.beforeTelephone));
        }
Esempio n. 5
0
        public TelephoneModel AddTelephone(TelephoneModel telephoneModel)
        {
            if (GetOneBeforeTelephone(telephoneModel.beforeTelephone) == null)
            {
                _telephones.InsertOne(telephoneModel);
            }

            TelephoneModel tmpTelephoneModel = GetOneBeforeTelephone(telephoneModel.beforeTelephone);

            return(tmpTelephoneModel);
        }
Esempio n. 6
0
 static public MySqlCommand UpdateTelephone(TelephoneModel telephoneModel)
 {
     if (GlobalVariable.queryType == 0)
     {
         return(CreateSqlCommand(telephoneModel, queryTelephonesUpdate));
     }
     else
     {
         return(CreateSqlCommand(telephoneModel, procedureTelephonesUpdate));
     }
 }
Esempio n. 7
0
        public TelephoneModel UpdateTelephone(TelephoneModel telephoneModel)
        {
            DataTable dt = new DataTable();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(TelephoneStringsSql.UpdateTelephone(telephoneModel));
            }
            foreach (DataRow ms in dt.Rows)
            {
                telephoneModel = TelephoneModel.ToObject(ms);
            }
            return(telephoneModel);
        }
Esempio n. 8
0
        public List <TelephoneModel> GetAllTelephones()
        {
            DataTable dt = new DataTable();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(TelephoneStringsSql.GetAllTelephones());
            }

            List <TelephoneModel> arrTelephone = new List <TelephoneModel>();

            foreach (DataRow ms in dt.Rows)
            {
                arrTelephone.Add(TelephoneModel.ToObject(ms));
            }
            return(arrTelephone);
        }
Esempio n. 9
0
        public TelephoneModel GetOneBeforeTelephone(string beforeTelephone)
        {
            DataTable dt = new DataTable();

            if (beforeTelephone.Equals(string.Empty) || beforeTelephone.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }
            TelephoneModel telephoneModel = new TelephoneModel();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(TelephoneStringsSql.GetOneBeforeTelephone(beforeTelephone));
            }

            foreach (DataRow ms in dt.Rows)
            {
                telephoneModel = TelephoneModel.ToObject(ms);
            }
            return(telephoneModel);
        }
 static public OleDbCommand UpdateTelephone(TelephoneModel telephoneModel)
 {
     return(CreateOleDbCommand(telephoneModel, queryTelephonesUpdate));
 }
 static public OleDbCommand AddTelephone(TelephoneModel telephoneModel)
 {
     return(CreateOleDbCommand(telephoneModel, queryTelephonesPost));
 }