當前位置: 首頁>>代碼示例>>C#>>正文


C# DbConn.GetServerDate方法代碼示例

本文整理匯總了C#中XXF.Db.DbConn.GetServerDate方法的典型用法代碼示例。如果您正苦於以下問題:C# DbConn.GetServerDate方法的具體用法?C# DbConn.GetServerDate怎麽用?C# DbConn.GetServerDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XXF.Db.DbConn的用法示例。


在下文中一共展示了DbConn.GetServerDate方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Add

        /// <summary>
        /// createtime expiresetime不用傳。
        /// </summary>
        /// <param name="PubConn"></param>
        /// <param name="model"></param>
        /// <param name="tokentype"></param>
        /// <returns></returns>
        public virtual bool Add(DbConn PubConn, DbModels.tb_token model, Models.DbModels.TokenType tokentype)
        {
            DateTime nowtime = PubConn.GetServerDate();
            model.createtime = nowtime;
            model.expires = nowtime.AddMinutes(GetExpiresminutes(tokentype));
            List<ProcedureParameter> Par = new List<ProcedureParameter>()
                {

                    //
                    new ProcedureParameter("@token",    model.token),
                    //
                    new ProcedureParameter("@userid",    model.userid),
                    new ProcedureParameter("@id",    model.id),
                    //
                    new ProcedureParameter("@username",    model.username),
                    //
                    new ProcedureParameter("@appid",    model.appid),
                    //
                    new ProcedureParameter("@createtime",   model.createtime),
                    //
                    new ProcedureParameter("@expires", model.expires  )
                };
            int rev = PubConn.ExecuteSql("insert into " + tokentype.ToString() + " (token,userid,id,username,appid,createtime,expires)" +
                                         "  values(@token,@userid,@id,@username,@appid,@createtime,@expires)", Par);
            return rev == 1;
        }
開發者ID:buweixiaomi,項目名稱:DydCert,代碼行數:33,代碼來源:TokenDal.cs

示例2: GetAllStopNodesWithNeedCheckState

 public List<tb_node_model> GetAllStopNodesWithNeedCheckState(DbConn PubConn)
 {
     return SqlHelper.Visit(ps =>
     {
         ps.Add("@nodelastupdatetime", PubConn.GetServerDate().AddMinutes(-5));
         string sql = "select id,nodename,nodecreatetime,nodeip,nodelastupdatetime,ifcheckstate from tb_node where nodelastupdatetime<@nodelastupdatetime and ifcheckstate='true'";
         DataSet ds = new DataSet();
         List<tb_node_model> rs = new List<tb_node_model>();
         PubConn.SqlToDataSet(ds, sql, ps.ToParameters());
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             tb_node_model n = CreateModel(dr);
             rs.Add(n);
         }
         return rs;
     });
 }
開發者ID:zeus911,項目名稱:Dyd.BaseService.TaskManager,代碼行數:17,代碼來源:tb_node_dal.cs

示例3: RegisterConsumerPartition

 public tb_consumer_partition_model RegisterConsumerPartition(DbConn PubConn, int clientid, int partitionindex,string mqpath, long tempid)
 {
     var mqpathmodel = GetMQPath(PubConn, mqpath);
     tb_mqpath_partition_dal mqpathpartitiondal = new tb_mqpath_partition_dal();
     var mqpathpartitionmodel = mqpathpartitiondal.GetOfConsumer(PubConn, partitionindex,mqpathmodel.id);
     if (mqpathpartitionmodel == null)
         return null;
     tb_consumer_partition_dal dal = new tb_consumer_partition_dal();
     if (dal.Edit2(PubConn, new tb_consumer_partition_model() { consumerclientid = clientid, lastconsumertempid = tempid, partitionid = mqpathpartitionmodel.partitionid, partitionindex = partitionindex }) <= 0)
     {
         var partitionidinfo = PartitionRuleHelper.GetPartitionIDInfo(mqpathpartitionmodel.partitionid); var datanodename = PartitionRuleHelper.GetDataNodeName(partitionidinfo.DataNodePartition);
         long maxid = -1; DateTime serverdate = PubConn.GetServerDate(); string tablename = PartitionRuleHelper.GetTableName(partitionidinfo.TablePartition,serverdate);
         SqlHelper.ExcuteSql(this.GetDataNodeConnectString(PubConn, partitionidinfo.DataNodePartition), (c) => {
             var exist = c.TableIsExist(tablename); if (!exist) { throw new BusinessMQException(string.Format("當前數據節點{0},表{1}不存在", partitionidinfo.DataNodePartition,tablename)); }
             tb_messagequeue_dal mqdal = new tb_messagequeue_dal(); mqdal.TableName = tablename;
             maxid = mqdal.GetMaxId(c);
             if (maxid <= 0)
                 maxid = PartitionRuleHelper.GetMQID(new MQIDInfo() { AutoID=0, DataNodePartition=partitionidinfo.DataNodePartition, Day=serverdate, TablePartition=partitionidinfo.TablePartition });
         });
         dal.Add2(PubConn, new tb_consumer_partition_model() { consumerclientid = clientid, lastconsumertempid = tempid, lastmqid = maxid, partitionid = mqpathpartitionmodel.partitionid, partitionindex = partitionindex });
     }
     return dal.Get(PubConn, clientid, mqpathpartitionmodel.partitionid);
 }
開發者ID:xwx2015,項目名稱:MQ,代碼行數:23,代碼來源:ConsumerBLL.cs

示例4: GetNonMsgCount

        /// <summary>
        /// 取得未消費的數量
        /// </summary>
        /// <param name="lastMqId"></param>
        /// <returns></returns>
        public long GetNonMsgCount(DbConn conn, long lastMqId)
        {
            return SqlHelper.Visit((ps) =>
              {
              MQIDInfo info = PartitionRuleHelper.GetMQIDInfo(lastMqId);
              var currentday = conn.GetServerDate().Date;

              string sql = "SELECT SUM(mqcount) FROM [tb_partition_messagequeue_report] WITH(NOLOCK) WHERE [day]>@day AND [email protected] AND [day]<>@currentday";
              ps.Add("@day", info.Day); ps.Add("@currentday", currentday);
              ps.Add("@partitionid", PartitionRuleHelper.GetPartitionID(new PartitionIDInfo() { DataNodePartition = info.DataNodePartition, TablePartition = info.TablePartition }));

              object obj = conn.ExecuteScalar(sql, ps.ToParameters());
              long msgCount = 0;
              if (obj != DBNull.Value && obj != null)
              {
                  msgCount = LibConvert.ObjToInt64(obj);
              }

              long firstCount = 0; long lastCount = 0;
              using (DbConn nodeConn = DbConfig.CreateConn(DataConfig.DataNodeParConn(PartitionRuleHelper.PartitionNameRule(info.DataNodePartition))))
              {
                  nodeConn.Open();
                  string firsttableName = PartitionRuleHelper.GetTableName(info.TablePartition, info.Day);
                  var msgDal = new tb_messagequeue_dal(); msgDal.TableName = firsttableName;
                  firstCount = msgDal.GetLastDayNonMsgCount(nodeConn, lastMqId);
                  if (info.Day != currentday)//不是今天
                  {
                      string lasttableName = PartitionRuleHelper.GetTableName(info.TablePartition, currentday);
                      var dal = new tb_messagequeue_dal(); dal.TableName = lasttableName;
                      long maxmqid = dal.GetMaxID(nodeConn);
                      if (lastMqId == 0)
                          lastCount = 0;
                      else
                          lastCount = dal.GetLastDayMsgCount(nodeConn, maxmqid);
                  }
              }
              //最後一天剩餘
              return msgCount + firstCount + lastCount;
              });
        }
開發者ID:xwx2015,項目名稱:MQ,代碼行數:45,代碼來源:tb_partition_messagequeue_report_dal.cs


注:本文中的XXF.Db.DbConn.GetServerDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。