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 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 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 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(); } } }