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); }
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)); }
public TelephoneModel AddTelephone(TelephoneModel telephoneModel) { if (GetOneBeforeTelephone(telephoneModel.beforeTelephone) == null) { _telephones.InsertOne(telephoneModel); } TelephoneModel tmpTelephoneModel = GetOneBeforeTelephone(telephoneModel.beforeTelephone); return(tmpTelephoneModel); }
static public MySqlCommand UpdateTelephone(TelephoneModel telephoneModel) { if (GlobalVariable.queryType == 0) { return(CreateSqlCommand(telephoneModel, queryTelephonesUpdate)); } else { return(CreateSqlCommand(telephoneModel, procedureTelephonesUpdate)); } }
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); }
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); }
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)); }