Beispiel #1
0
 public int GetOldterPostbacktimes(string TerNo, ref string msg)
 {
     if (TerNo.Trim() != "")
     {
         ISqlMapper NewMap = SqlMapper.Instance();
         NewMap.BeginTransaction();
         try
         {
             OldterPostbacktimes optSel = new OldterPostbacktimes();
             optSel.TerNo = TerNo;
             OldterPostbacktimes opt = (OldterPostbacktimes)ExecuteQueryForObjectTrans("OldterPostbacktimes.SelectOldterPostbacktimes", optSel, NewMap);
             if (opt != null)
             {
                 opt.Postbacktimes = opt.Postbacktimes + 1;
                 ExecuteUpdateTrans("OldterPostbacktimes.UpdateOldterPostbacktimes", opt, NewMap);
                 NewMap.CommitTransaction();
                 return(Convert.ToInt32(opt.Postbacktimes));
             }
             else
             {
                 NewMap.RollBackTransaction();
                 msg = "无此编号的数据!";
                 return(0);
             }
         }
         catch (Exception e)
         {
             NewMap.RollBackTransaction();
             msg = e.Message;
             return(-1);
         }
     }
     else
     {
         msg = "请输入终端编号!";
         return(-1);
     }
 }
Beispiel #2
0
        public object Insert(TerminalInfo entity)
        {
            ISqlMapper NewMap = SqlMapper.Instance();

            NewMap.BeginTransaction();
            try
            {
                object Tercnt = ExecuteQueryForObjectTrans("TerminalInfo.SelectTerminalCountByTerNo", entity.TerNo, NewMap);
                if ((int)Tercnt == 0)
                {
                    ExecuteInsertTrans("TerminalInfo.InsertTerminalInfo", entity, NewMap);
                    object count = ExecuteQueryForObjectTrans("OldterPostbacktimes.SelectOldterPostbacktimesCount", entity.TerNo, NewMap);
                    if ((int)count == 0)
                    {
                        OldterPostbacktimes opt = new OldterPostbacktimes();
                        opt.Id            = System.Guid.NewGuid().ToString();
                        opt.TerNo         = entity.TerNo;
                        opt.Updatetime    = DateTime.Now;
                        opt.Postbacktimes = 0;
                        ExecuteInsertTrans("OldterPostbacktimes.InsertOldterPostbacktimes", opt, NewMap);
                    }
                    NewMap.CommitTransaction();
                    return(0);
                }
                else
                {
                    NewMap.RollBackTransaction();
                    return(-2);
                }
            }
            catch (Exception e)
            {
                NewMap.RollBackTransaction();
                return(-1);
            }
        }
Beispiel #3
0
        public string upLoadData(UpLoadTerBind ut, string DeptId)
        {
            Hashtable            htTerType         = new Hashtable();
            ProductsInfo         pi                = new ProductsInfo();
            ProductsInfoDao      _iProductsInfoDao = new ProductsInfoDao();
            IList <ProductsInfo> lpt               = _iProductsInfoDao.GetProductsInfoPage(pi);

            for (int n = 0; n < lpt.Count; n++)
            {
                if (!htTerType.ContainsKey(lpt[n].ProName))
                {
                    htTerType.Add(lpt[n].ProName, lpt[n].ProId);
                }
            }

            ISqlMapper NewMap = SqlMapper.Instance();

            NewMap.BeginTransaction();
            try
            {
                TerminalInfo ti = (TerminalInfo)ExecuteQueryForObjectTrans("TerminalInfo.SelectTerminalInfoByTerNo", ut.TerNo, NewMap);
                if (ti == null)
                {
                    ti              = new TerminalInfo();
                    ti.TerGuid      = System.Guid.NewGuid().ToString();
                    ti.TerNo        = ut.TerNo;
                    ti.TerTypeid    = htTerType[ut.TerType].ToString();
                    ti.TerSimcard   = ut.SimCard;
                    ti.TerInnettime = ut.TerInnettime;
                    ti.DeptId       = DeptId;
                    if (DeptId != null && DeptId != "")
                    {
                        GDAL.Basic.DeptInfoDao deptInfoBll = new Basic.DeptInfoDao();
                        DeptInfo di = deptInfoBll.GetDeptInfoById(DeptId);
                        ti.TerDeptcode = di.Businessdivisioncode;
                    }
                    ExecuteInsertTrans("TerminalInfo.InsertTerminalInfo", ti, NewMap);
                    object count = ExecuteQueryForObjectTrans("OldterPostbacktimes.SelectOldterPostbacktimesCount", ut.TerNo, NewMap);
                    if ((int)count == 0)
                    {
                        OldterPostbacktimes opt = new OldterPostbacktimes();
                        opt.Id            = System.Guid.NewGuid().ToString();
                        opt.TerNo         = ut.TerNo;
                        opt.Updatetime    = DateTime.Now;
                        opt.Postbacktimes = 0;
                        ExecuteInsertTrans("OldterPostbacktimes.InsertOldterPostbacktimes", opt, NewMap);
                    }
                    NewMap.CommitTransaction();
                    return("true");
                }
                else
                {
                    NewMap.RollBackTransaction();
                    return("false");
                }
            }
            catch (Exception e)
            {
                NewMap.RollBackTransaction();
                return("false");
            }
        }
Beispiel #4
0
 public int Update(OldterPostbacktimes entity)
 {
     return(ExecuteUpdate("OldterPostbacktimes.UpdateOldterPostbacktimes", entity));
 }
Beispiel #5
0
 public object Insert(OldterPostbacktimes entity)
 {
     return(ExecuteInsert("OldterPostbacktimes.InsertOldterPostbacktimes", entity));
 }
 public int Insert(OldterPostbacktimes entity)
 {
     return(Convert.ToInt32(_iOldterPostbacktimesDao.Insert(entity)));
 }