Ejemplo n.º 1
0
        /// <summary>
        /// 事务处理终端发放
        /// </summary>
        /// <param name="tbTBUKeyList"></param>
        /// <param name="userId"></param>
        /// <param name="userName"></param>
        public void Grant(List <TBUKey> tbTBUKeyList, string userId, string userName, string siteId)
        {
            ComTransaction trans = null;

            try
            {
                db.Open();
                trans = db.BeginTransaction();
                string agentId = new TBSiteDAO().Get(siteId).agentId;
                foreach (var uKey in tbTBUKeyList)
                {
                    uKey.status  = ((int)UKeyStatus.Draw).ToString();
                    uKey.agentId = agentId;
                    uKey.siteId  = siteId;
                    Edit(db, uKey);
                    TBUKeyLog tbUKeyLog = new TBUKeyLog();
                    tbUKeyLog.uKeyId       = uKey.uKeyId;             //终端号
                    tbUKeyLog.operateType  = "1";                     //操作类型
                    tbUKeyLog.summary      = "发放到[代理商编号:" + agentId + ",门店编号:" + siteId + "]";
                    tbUKeyLog.operateTime  = DateTime.Now.ToString(); //操作时间
                    tbUKeyLog.operatorId   = userId;                  //操作人编号
                    tbUKeyLog.operatorName = userName;                //操作人名称

                    new TBUKeyLogDAO().Add(db, tbUKeyLog);
                }
                trans.Commit();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            finally
            {
                db.Close();
            }
        }
Ejemplo n.º 2
0
        private DataAccess db = new DataAccess(DataAccess.DBConn);//数据库连接

        /// <summary>
        /// 事务增加快开厅员工
        /// <param name="tbStaff">快开厅员工</param>
        /// </summary>
        public void AddTrans(TBStaff tbStaff, TSAgentUser tsAgentUser)
        {
            ComTransaction trans = null;

            try
            {
                db.Open();
                trans = db.BeginTransaction();
                Add(db, tbStaff);
                tsAgentUser.userId  = tbStaff.staffId;
                tsAgentUser.userPwd = Encrypt.ConvertPwd(tsAgentUser.userId, tsAgentUser.userPwd);
                new TSAgentUserDAO().Add(db, tsAgentUser);
                trans.Commit();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            finally
            {
                db.Close();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 事务处理终端发放
        /// </summary>
        /// <param name="tbTBTerminalList"></param>
        /// <param name="userId"></param>
        /// <param name="userName"></param>
        public void Grant(List <TBTerminal> tbTBTerminalList, string userId, string userName, string siteId)
        {
            ComTransaction trans = null;

            try
            {
                db.Open();
                trans = db.BeginTransaction();
                string agentId = new TBSiteDAO().Get(siteId).agentId;
                foreach (var terminal in tbTBTerminalList)
                {
                    terminal.status  = ((int)TerminalStatus.Used).ToString();
                    terminal.agentId = agentId;
                    terminal.siteId  = siteId;
                    TBTerminalLog tbTerminalLog = new TBTerminalLog();
                    tbTerminalLog.terminalId   = terminal.terminalId;     //终端号
                    tbTerminalLog.operateType  = "1";                     //操作类型
                    tbTerminalLog.summary      = "发放到[代理商编号:" + agentId + ",门店编号:" + siteId + "]";
                    tbTerminalLog.operateTime  = DateTime.Now.ToString(); //操作时间
                    tbTerminalLog.operatorId   = userId;                  //操作人编号
                    tbTerminalLog.operatorName = userName;                //操作人名称
                    Edit(db, terminal);
                    new TBTerminalLogDAO().Add(db, tbTerminalLog);
                }
                trans.Commit();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            finally
            {
                db.Close();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 事务处理卡片发放
        /// </summary>
        /// <param name="tbCardList"></param>
        /// <param name="userId"></param>
        /// <param name="userName"></param>
        public void Grant(List <TBCard> tbCardList, string userId, string userName, string siteId)
        {
            ComTransaction trans = null;

            try
            {
                db.Open();
                trans = db.BeginTransaction();
                string agentId = new TBSiteDAO().Get(siteId).agentId;
                foreach (var card in tbCardList)
                {
                    card.status  = ((int)CardStatus.StayBinding).ToString();
                    card.agentId = agentId;
                    card.siteId  = siteId;
                    TBCardLog tbCardLog = new TBCardLog();
                    tbCardLog.cardId       = card.cardId;                                  //卡号
                    tbCardLog.operateType  = "2";                                          //操作类型
                    tbCardLog.summary      = "发放到[代理商编号:" + agentId + ",门店编号:" + siteId + "]";
                    tbCardLog.operateTime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //操作时间
                    tbCardLog.operatorId   = userId;                                       //操作人编号
                    tbCardLog.operatorName = userName;                                     //操作人名称
                    Edit(db, card);
                    new TBCardLogDAO().Add(db, tbCardLog);
                }
                trans.Commit();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            finally
            {
                db.Close();
            }
        }