示例#1
0
        public bool InsertDispatch(InputDispatch model)
        {
            using (IDbConnection conn = SqlConn.OpenConnectionPS())
            {
                var sModel = conn.Query <OrdDispatch>("select * from OrdDispatch where state=0 and ConstId=@ConstId and RoleId=@RoleId", new { ConstId = model.ConstId, RoleId = model.RoleId }, commandType: CommandType.Text).ToList();
                int result = 0;

                //抢单成功
                if (sModel.Any())
                {
                    StringBuilder strSql = new StringBuilder();
                    strSql.Append(@"InsertOrdByUser");

                    result = conn.Query <int>(strSql.ToString(), new { ConstId = model.ConstId, UserId = model.UserId, RoleId = model.RoleId }, commandType: CommandType.StoredProcedure).FirstOrDefault();
                }
                //else
                //{
                //    StringBuilder strSql = new StringBuilder();
                //    strSql.Append(@"update OrdMembers set state=3,createTime=Getdate() where ConstId=@ConstId and UId=@UserId");

                //    result = conn.Execute(strSql.ToString()
                //        , new { ConstId = model.ConstId, UserId = model.UserId });
                //}

                return(result > 0 ? true : false);
            }
        }
示例#2
0
        public bool InsertTest(Test model)
        {
            using (IDbConnection conn = SqlConn.OpenTestConnection())
            {
                var sModel = conn.Query <TestDto>("select * from Test where state=0").ToList();
                int result = 0;
                if (sModel.Any())
                {
                    StringBuilder strSql = new StringBuilder();
                    strSql.Append(@"update Test set state=1,createTime=Getdate() where state=0");

                    result = conn.Execute(strSql.ToString(), null);
                }
                else
                {
                    StringBuilder strSql = new StringBuilder();
                    strSql.Append(@"INSERT INTO Test(Name,State,CreateTime)
                                    VALUES(@Name, @State, @CreateTime)");

                    result = conn.Execute(strSql.ToString(), new { Name = model.ProcessId + "+" + model.Sort, State = 2, CreateTime = DateTime.Now });
                }



                return(result > 0 ? true : false);
            }
        }
示例#3
0
 public void DelDispatch(SendSmsDto model)
 {
     using (IDbConnection conn = SqlConn.OpenConnectionPS())
     {
         string sql    = @"update OrdDispatch set state=2 where ConstId=@ConstId and RoleId=@RoleId";
         var    result = conn.Execute(sql, new { ConstId = model.ConstId, RoleId = model.RoleId }, commandType: CommandType.Text);
     }
 }
示例#4
0
        public List <OrdDispatchDto> GetDispatch()
        {
            using (IDbConnection conn = SqlConn.OpenConnectionPS())
            {
                string sql    = @"select od.*,ui.Phone,c.Name from OrdDispatch od left join Construct c
	                            on od.ConstId=c.Id left join
	                            ConstMemberRelation cmr on od.ConstId=cmr.ConstId
	                            left join UserInfo ui on cmr.UserId=ui.Id  where od.State=0 and ui.role=4 order by ConstId"    ;
                var    result = conn.Query <OrdDispatchDto>(sql, null, commandType: CommandType.Text).ToList();
                return(result);
            }
        }
示例#5
0
        public int AddSMSLog(SMSEvalLog model)
        {
            using (IDbConnection conn = SqlConn.OpenConnectionPS())
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append(@"INSERT INTO SMSEvalLog(ConstId,Phone,ConstName,Phase,Role,CreateTime)
                                    VALUES(@ConstId, @Phone, @ConstName, @Phase,@Role, @CreateTime)");

                return(conn.Execute(strSql.ToString(), new { ConstId = model.ConstId, Phone = model.Phone, ConstName = model.ConstName, Phase = model.Phase, Role = model.Role, CreateTime = model.CreateTime }
                                    ));
            }
        }
示例#6
0
        /// <summary>
        /// 获取项目
        /// </summary>
        /// <returns></returns>
        public List <SMSEvalLogDTO> GetConstruct()
        {
            List <SMSEvalLogDTO> list = new List <SMSEvalLogDTO>();

            //var p = new DynamicParameters();
            //p.Add("@nav_type", nav_type);

            using (IDbConnection conn = SqlConn.OpenConnectionPS())
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("exec Eval_Remind");

                list = conn.Query <SMSEvalLogDTO>(strSql.ToString(), null).ToList();
            }

            return(list);
        }