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 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(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(); } } }
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 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(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 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 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(); }
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(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 MODIFY(INTERNATIONALRATE item) { StringBuilder sb = new StringBuilder(); sb.Append("update INTERNATIONAL_RATE set"); sb.AppendFormat(" lrate={0}, lsec={1}, mrate={2}, msec={3} where areacode={4}", item.lrate, item.lsec, item.mrate, item.msec, item.areacode); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { int count = db.GetEffectedCount(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} MODIFY ERR : {1}", this.GetType(), fex.Message)); return; } } INTERNATIONALRATE _tmpobj = (INTERNATIONALRATE)_list.Where(x => x.areacode == item.areacode); _tmpobj.lrate = item.lrate; _tmpobj.lsec = item.lsec; _tmpobj.mrate = item.mrate; _tmpobj.msec = item.msec; //INIT(); }
public void ADD(INTERNATIONALRATE item) { StringBuilder sb = new StringBuilder(); sb.Append("insert into INTERNATIONAL_RATE"); sb.Append("( areacode, lrate, lsec, mrate, msec )"); sb.Append(" values "); sb.AppendFormat("( {0}, {1}, {2}, {3}, {4} )", item.areacode, item.lrate, item.lsec, item.mrate, item.msec); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { int count = db.GetEffectedCount(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} ADD ERR : {1}", this.GetType(), fex.Message)); return; } } _list.Add(item); //INIT(); }
public void ADD(Firm item) { StringBuilder sb = new StringBuilder(); sb.Append("insert into FIRMS"); sb.Append("( title )"); sb.Append(" values "); sb.AppendFormat("( {0} )", item.title); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { int count = db.GetEffectedCount(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} ADD ERR : {1}", this.GetType(), fex.Message)); return; } } INIT(); }
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 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 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 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 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 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 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 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(BILLException item) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete from EXCEPTIONS where innertel={0}", item.innertel); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { int count = db.GetEffectedCount(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} REMOVE ERR : {1}", this.GetType(), fex.Message)); return; } } INIT(); }
public void MODIFY(Firm item) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("update FIRMS set title={0} where idx={1}", item.title, item.idx); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { int count = db.GetEffectedCount(); } catch (FirebirdSql.Data.FirebirdClient.FbException fex) { db.Rollback(); util.WriteLog(string.Format("{0} MODIFY ERR : {1}", this.GetType(), fex.Message)); return; } } INIT(); }
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 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(INTERNATIONALRATE item) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("delete from INTERNATIONAL_RATE where areacode={0}", item.areacode); using (FirebirdDBHelper db = new FirebirdDBHelper(sb.ToString(), util.strDBConn)) { try { int count = db.GetEffectedCount(); } 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 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(); }