public int Modify(Account _item) { int result = -1; DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@I_ID_MASTER", util.userid); dt.Rows.Add("@I_ID", _item.ID); dt.Rows.Add("@I_PWD", util.GetSHA1(_item.PWD)); dt.Rows.Add("@I_PWD_NEW", util.GetSHA1(_item.PWD_NEW)); dt.Rows.Add("@I_NAME", _item.NAME); dt.Rows.Add("@I_MEMO", _item.MEMO); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); result = int.Parse(db.GetDataSP("UDT_USR", dt).ToString()); db.Commit(); Account __obj = _list.FirstOrDefault(x => x.ID == _item.ID); __obj.NAME = _item.NAME; __obj.MEMO = _item.MEMO; } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } return(result); }
public void remove(Customer item) { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_IDX", FbDbType.Integer, item.Idx); db.BeginTran(); db.ExcuteSP("RMV_CUSTOMER"); db.Commit(); if (this.Items.Count > 0) { if (this.Items[0].Group_Idx == item.Group_Idx) { this.Remove(item); } } } catch (FbException e) { // util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); throw e; } } }
public void add(Sms item) { DataTable dt; using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_CUST_TEL", FbDbType.VarChar, item.Cust_Tel); db.SetParameters("@I_MEMO", FbDbType.Text, item.Memo); db.SetParameters("@I_RESULT", FbDbType.SmallInt, item.Result); db.BeginTran(); dt = db.GetDataTableSP("INS_SMS_LIST"); db.Commit(); foreach (DataRow row in dt.Rows) { item.Idx = string.IsNullOrEmpty(row[0].ToString()) == false?int.Parse(row[0].ToString()) : -1; item.Cust_Idx = string.IsNullOrEmpty(row[1].ToString()) == false?int.Parse(row[1].ToString()) : -1; } this.Insert(0, item); } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); } } }
public void ADD(INTERNATIONAL item) { StringBuilder sb = new StringBuilder(); sb.Append("insert into INTERNATIONAL"); sb.Append("( areacode, nation_num, nation_local_num, natione, nationk, lm )"); sb.Append(" values "); sb.AppendFormat("( {0}, '{1}', '{2}', '{3}', '{4}', '{5}' )", item.areacode, item.nation_num, item.nation_local_num, item.natione, item.nationk, item.lm); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { db.BeginTran(); int count = db.GetEffectedCount(); db.Commit(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} ADD ERR : {1}", this.GetType(), fex.Message)); return; } } INIT(); }
public void MODIFY(DOMESTICRATE item) { StringBuilder sb = new StringBuilder(); sb.Append("update DOMESTIC_RATE set"); sb.AppendFormat(" type='{0}', rate={1}, sec={2} where prefix='{3}'", item.type, item.rate, item.sec, item.prefix); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { db.BeginTran(); int count = db.GetEffectedCount(); db.Commit(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} MODIFY ERR : {1}", this.GetType(), fex.Message)); return; } } //INIT(); }
public void Add(Account _item) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@I_ID", _item.ID); dt.Rows.Add("@I_PWD", util.GetSHA1(_item.PWD)); dt.Rows.Add("@I_NAME", _item.NAME); dt.Rows.Add("@I_MEMO", _item.MEMO); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("INS_USR", dt); db.Commit(); _list.Add(_item); } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
public void add(CallList item) { DataTable dt; using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_DIRECTION", FbDbType.Integer, item.Direction); db.SetParameters("@I_CUST_TEL", FbDbType.VarChar, item.Cust_Tel); db.SetParameters("@I_STARTDATE", FbDbType.TimeStamp, item.Startdate); db.BeginTran(); dt = db.GetDataTableSP("INS_CALL_LIST"); db.Commit(); foreach (DataRow row in dt.Rows) { item.Idx = string.IsNullOrEmpty(row[0].ToString()) == false?int.Parse(row[0].ToString()) : 0; item.Cust_Idx = string.IsNullOrEmpty(row[1].ToString()) == false?int.Parse(row[1].ToString()) : 0; } this.Insert(0, item); } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); } } }
public void REMOVE(DOMESTICRATE item) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete from DOMESTIC_RATE where prefix={0}", item.prefix); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { db.BeginTran(); int count = db.GetEffectedCount(); db.Commit(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} REMOVE ERR : {1}", this.GetType(), fex.Message)); return; } } _list.Remove(item); //INIT(); }
public void ADD(DOMESTICRATE item) { StringBuilder sb = new StringBuilder(); sb.Append("insert into DOMESTIC_RATE"); sb.Append(" ( prefix, type, rate, sec )"); sb.Append(" values "); sb.AppendFormat("( '{0}', '{1}', {2}, {3} )", item.prefix, item.type, item.rate, item.sec); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { db.BeginTran(); int count = db.GetEffectedCount(); db.Commit(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} ADD ERR : {1}", this.GetType(), fex.Message)); return; } } //INIT(); _list.Add(item); }
public void modify(CallList item) { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_IDX", FbDbType.Integer, item.Idx); db.SetParameters("@I_ENDDATE", FbDbType.TimeStamp, item.Enddate); db.BeginTran(); db.ExcuteSP("MODI_CALL_LIST"); db.Commit(); var itm = this.FirstOrDefault(x => x.Idx == item.Idx); //if (itm != null) //{ // int idx = this.IndexOf(itm); // this.RemoveAt(idx); // this.Insert(idx, item); //} } catch (FbException e) { // util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); throw e; } catch (Exception e) { util.WriteLog(e.Message); } } }
public void MODIFY(INTERNATIONAL item) { StringBuilder sb = new StringBuilder(); sb.Append("update INTERNATIONAL set"); sb.AppendFormat(" areacode={0}, nation_num='{1}', nation_local_num='{2}', natione='{3}', nationk='{4}', lm='{5}' where idx={6}", item.areacode, item.nation_num, item.nation_local_num, item.natione, item.nationk, item.lm, item.idx); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { db.BeginTran(); int count = db.GetEffectedCount(); db.Commit(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} MODIFY ERR : {1}", this.GetType(), fex.Message)); return; } } INIT(); }
private void FileName2DB(string fn, string ext, string peernum) { try { using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn)) { db.SetParameters("@EXTENTION", FbDbType.VarChar, ext); db.SetParameters("@PEERNUMBER", FbDbType.VarChar, peernum); db.SetParameters("@FN", FbDbType.VarChar, fn); try { db.BeginTran(); db.ExcuteSP("INS_RECINFO"); db.Commit(); } catch (FbException e) { util.WriteLog(string.Format("SQL INS ERROR (INS_RECINF)\r\nMessage : {0}", e.Message)); db.Rollback(); } } } catch (FbException e) { util.WriteLog(string.Format("SQL INS ERROR (INS_RECINF)\r\nMessage : {0}", e.Message)); } }
public void update(GroupList item) { if (item.Idx == -1) { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_NAME", FbDbType.VarChar, item.Name); db.BeginTran(); string idx = db.GetDataSP("INS_GROUPS").ToString(); db.Commit(); item.Idx = string.IsNullOrEmpty(idx) == false?int.Parse(idx) : -1; } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); } } } else { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_IDX", FbDbType.Integer, item.Idx); db.SetParameters("@I_NAME", FbDbType.VarChar, item.Name); db.BeginTran(); db.ExcuteSP("MODI_GROUPS"); db.Commit(); } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); throw e; } } } }
public void savememo() { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_IDX", FbDbType.Integer, this.Idx); db.SetParameters("@I_MEMO", FbDbType.VarChar, util.encStr(this.Memo)); db.BeginTran(); db.ExcuteSP("MODI_CALL_LIST_MEMO"); db.Commit(); } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); throw e; } } }
public void remove(Sms item) { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_IDX", FbDbType.Integer, item.Idx); db.BeginTran(); db.ExcuteSP("RMV_SMS_LIST"); db.Commit(); this.Remove(item); } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); } } }
public void add(Customer item) { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_GROUP_IDX", FbDbType.Integer, item.Group_Idx); db.SetParameters("@I_NAME", FbDbType.VarChar, item.Name); db.SetParameters("@I_COMPANY", FbDbType.VarChar, item.Company); db.SetParameters("@I_TITLE", FbDbType.VarChar, item.Title); db.SetParameters("@I_TEL", FbDbType.VarChar, item.Tel); db.SetParameters("@I_CELLULAR", FbDbType.VarChar, item.Cellular); db.SetParameters("@I_EXTENSION", FbDbType.VarChar, item.Extension); db.SetParameters("@I_EMAIL", FbDbType.VarChar, item.Email); db.SetParameters("@I_ADDR", FbDbType.VarChar, item.Addr); db.BeginTran(); string idx = db.GetDataSP("INS_CUSTOMER").ToString(); db.Commit(); item.Idx = string.IsNullOrEmpty(idx) == false?int.Parse(idx) : -1; // var itm = this.Items.FirstOrDefault(x => x.Group_Idx == item.Group_Idx); // if (itm != null) this.Add(item); //if (this.Items.Count > 0) //{ // if (this.Items[0].Group_Idx == item.Group_Idx) // this.Add(item); //} } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); } } }
public static void Log2DB(string ext, string msg, string chk) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@I_ROOM", ext); dt.Rows.Add("@I_MEMO", msg); dt.Rows.Add("@I_CHK", chk); using (FirebirdDBHelper db = new FirebirdDBHelper(strDBConn)) { try { db.BeginTran(); db.ExcuteSP("INS_LOG", dt); db.Commit(); } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
public void Remove(InnerTel _itel) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@seq", _itel.Seq); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("RMV_INNERTELS", dt); db.Commit(); InnerTel __obj = _list.FirstOrDefault(x => x.Seq == _itel.Seq); _list.Remove(__obj); } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
public void modify(Customer item) { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_IDX", FbDbType.Integer, item.Idx); db.SetParameters("@I_GROUP_IDX", FbDbType.Integer, item.Group_Idx); db.SetParameters("@I_NAME", FbDbType.VarChar, item.Name); db.SetParameters("@I_COMPANY", FbDbType.VarChar, item.Company); db.SetParameters("@I_TITLE", FbDbType.VarChar, item.Title); db.SetParameters("@I_TEL", FbDbType.VarChar, item.Tel); db.SetParameters("@I_CELLULAR", FbDbType.VarChar, item.Cellular); db.SetParameters("@I_EXTENSION", FbDbType.VarChar, item.Extension); db.SetParameters("@I_EMAIL", FbDbType.VarChar, item.Email); db.SetParameters("@I_ADDR", FbDbType.VarChar, item.Addr); db.BeginTran(); db.ExcuteSP("MODI_CUSTOMER"); db.Commit(); if (this.Items.Count > 0) { if (this.Items[0].Group_Idx == item.Group_Idx) { var itm = this.FirstOrDefault(x => x.Idx == item.Idx); int idx = this.IndexOf(itm); this.RemoveAt(idx); this.Insert(idx, item); } } } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); } } }
public void Add(InnerTel _itel) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@telnum", _itel.Telnum); dt.Rows.Add("@tellername", _itel.TellerName); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("INS_INNERTELS", dt); db.Commit(); _list.Add(_itel); } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
public void Remove(Account _item) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@I_ID", _item.ID); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("RMV_USR", dt); db.Commit(); Account __obj = _list.FirstOrDefault(x => x.ID == _item.ID); _list.Remove(__obj); } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
public void remove(GroupList item) { using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_IDX", FbDbType.Integer, item.Idx); db.BeginTran(); db.ExcuteSP("RMV_GROUPS"); db.Commit(); var itm = this.Items[0].Children.FirstOrDefault(x => x.Idx == item.Idx); this.Items[0].Children.Remove(itm); } catch (FbException e) { // util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); throw e; } } }
public void importExcel(Customer item) { if (string.IsNullOrEmpty(item.Group_Name.Trim())) { return; } using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn())) { try { db.SetParameters("@I_GROUP_NAME", FbDbType.VarChar, item.Group_Name); db.SetParameters("@I_NAME", FbDbType.VarChar, item.Name); db.SetParameters("@I_COMPANY", FbDbType.VarChar, item.Company); db.SetParameters("@I_TITLE", FbDbType.VarChar, item.Title); db.SetParameters("@I_TEL", FbDbType.VarChar, item.Tel); db.SetParameters("@I_CELLULAR", FbDbType.VarChar, item.Cellular); db.SetParameters("@I_EXTENSION", FbDbType.VarChar, item.Extension); db.SetParameters("@I_EMAIL", FbDbType.VarChar, item.Email); db.SetParameters("@I_ADDR", FbDbType.VarChar, item.Addr); db.BeginTran(); string idx = db.GetDataSP("INS_CUSTOMERS").ToString(); db.Commit(); item.Idx = string.IsNullOrEmpty(idx) == false?int.Parse(idx) : -1; this.Add(item); } catch (FbException e) { util.WriteLog(e.ErrorCode, e.Message); db.Rollback(); } } }
public void Modify(InnerTel _itel) { DataTable dt = util.CreateDT2SP(); dt.Rows.Add("@seq", _itel.Seq); dt.Rows.Add("@telnum", _itel.Telnum); dt.Rows.Add("@tellername", _itel.TellerName); using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2)) { try { db.BeginTran(); db.ExcuteSP("UDT_INNERTELS", dt); db.Commit(); InnerTel __obj = _list.FirstOrDefault(x => x.Telnum == _itel.Telnum); __obj.TellerName = _itel.TellerName; } catch (FirebirdSql.Data.FirebirdClient.FbException fe) { db.Rollback(); } } }
public void REMOVE(INTERNATIONAL item) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete from INTERNATIONAL where idx={0}", item.idx); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { db.BeginTran(); int count = db.GetEffectedCount(); db.Commit(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} REMOVE ERR : {1}", this.GetType(), fex.Message)); return; } } INIT(); }
private void CdrToDB(CdrRequest_t _cdr, CdrList _cdrdata) { CDRData _cdrd = new CDRData() { OFFICE_NAME = _cdrdata.office_name , STARTDATE = new DateTime(_cdrdata.start_yyyy, _cdrdata.start_month, _cdrdata.start_day, _cdrdata.start_hour, _cdrdata.start_min, _cdrdata.start_sec) , ENDDATE = new DateTime(_cdrdata.end_yyyy, _cdrdata.end_month, _cdrdata.end_day, _cdrdata.end_hour, _cdrdata.end_min, _cdrdata.end_sec) , CALLER = _cdrdata.caller , CALLER_TYPE = _cdrdata.caller_type , CALLER_IPN_NUMBER = _cdrdata.caller_ipn_number , CALLER_GROUP_CODE = _cdrdata.caller_group_code , CALLER_GROUP_NAME = _cdrdata.caller_group_name , CALLER_HUMAN_NAME = _cdrdata.caller_human_name , CALLEE = _cdrdata.callee , CALLEE_TYPE = _cdrdata.callee_type , CALLEE_IPN_NUMBER = _cdrdata.callee_ipn_number , CALLEE_GROUP_CODE = _cdrdata.callee_group_code , CALLEE_GROUP_NAME = _cdrdata.callee_group_name , CALLEE_HUMAN_NAME = _cdrdata.callee_human_name , RESULT = _cdrdata.result , SEQ = _cdrdata.seq }; StringBuilder __slqsb = new StringBuilder(); __slqsb.Append(" insert into CDRINFO "); __slqsb.Append(" ( "); __slqsb.Append(" OFFICE_NAME "); __slqsb.Append(" , STARTDATE "); __slqsb.Append(" , ENDDATE "); __slqsb.Append(" , CALLER "); __slqsb.Append(" , CALLER_TYPE "); __slqsb.Append(" , CALLER_IPN_NUMBER "); __slqsb.Append(" , CALLER_GROUP_CODE "); __slqsb.Append(" , CALLER_GROUP_NAME "); __slqsb.Append(" , CALLER_HUMAN_NAME "); __slqsb.Append(" , CALLEE "); __slqsb.Append(" , CALLEE_TYPE "); __slqsb.Append(" , CALLEE_IPN_NUMBER "); __slqsb.Append(" , CALLEE_GROUP_CODE "); __slqsb.Append(" , CALLEE_GROUP_NAME "); __slqsb.Append(" , CALLEE_HUMAN_NAME "); __slqsb.Append(" , RESULT "); __slqsb.Append(" , SEQ "); __slqsb.Append(" ) values ( "); __slqsb.AppendFormat(" '{0}' ", _cdrd.OFFICE_NAME); __slqsb.AppendFormat(" , '{0}' ", _cdrd.STARTDATE.ToString("yyyy-MM-dd HH:mm:ss")); __slqsb.AppendFormat(" , '{0}' ", _cdrd.ENDDATE.ToString("yyyy-MM-dd HH:mm:ss")); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_TYPE); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_IPN_NUMBER); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_GROUP_CODE); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_GROUP_NAME); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLER_HUMAN_NAME); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_TYPE); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_IPN_NUMBER); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_GROUP_CODE); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_GROUP_NAME); __slqsb.AppendFormat(" , '{0}' ", _cdrd.CALLEE_HUMAN_NAME); __slqsb.AppendFormat(" , '{0}' ", _cdrd.RESULT); __slqsb.AppendFormat(" , '{0}' ", _cdrd.SEQ); __slqsb.Append(" ); "); using (FirebirdDBHelper db = new FirebirdDBHelper(__slqsb.ToString(), util.strDBConn)) { try { db.BeginTran(); int __count = db.GetEffectedCount(); db.Commit(); CdrResponse_t __cdrRes = this.GetCdrRtnMsg(_cdr); byte[] __buffer = util.GetBytes(__cdrRes); try { _sockCdrSrv.SendTo(__buffer, SocketFlags.None, _remoteep); } catch (SocketException __se) { util.WriteLog(string.Format("Socket send message error : {0}", __se.Message)); } } catch (FirebirdSql.Data.FirebirdClient.FbException __fex) { db.Rollback(); util.WriteLog(string.Format("{0} : {1}\r\nMessage : {2}", "Rollback Exception Type", __fex.GetType(), __fex.Message)); } catch (SocketException __se) { util.WriteLog(string.Format("Socket send message error : {0}", __se.Message)); } } }