示例#1
0
        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();
                }
            }
        }
示例#2
0
        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);
                }
            }
        }
示例#3
0
        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;
                }
            }
        }
示例#4
0
        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));
            }
        }
示例#5
0
        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;
                    }
                }
            }
        }
示例#6
0
文件: Sms.cs 项目: step4u/MiniCRM
        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();
                }
            }
        }
示例#7
0
        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;
                }
            }
        }
示例#8
0
        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();
                }
            }
        }
示例#9
0
        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();
                }
            }
        }
示例#10
0
        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();
                }
            }
        }
示例#11
0
        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();
                }
            }
        }
示例#12
0
        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();
                }
            }
        }
示例#13
0
        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();
                }
            }
        }
示例#14
0
        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;
                }
            }
        }