示例#1
0
        public IList <PandianInfo> GetList()
        {
            StringBuilder sb = new StringBuilder(250);

            sb.Append(@"select Id,Named,AllowUsers,CreateDate,UserId,TotalQty,Status,IsDown,Remark,LastUpdatedDate 
			            from Pandian
					    order by LastUpdatedDate desc "                    );

            IList <PandianInfo> list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetConnString, CommandType.Text, sb.ToString()))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PandianInfo model = new PandianInfo();
                        model.Id              = reader.GetGuid(0);
                        model.Named           = reader.GetString(1);
                        model.AllowUsers      = reader.GetString(2);
                        model.CreateDate      = reader.GetDateTime(3);
                        model.UserId          = reader.GetGuid(4);
                        model.TotalQty        = reader.GetInt32(5);
                        model.Status          = reader.GetString(6);
                        model.IsDown          = reader.GetBoolean(7);
                        model.Remark          = reader.GetString(8);
                        model.LastUpdatedDate = reader.GetDateTime(9);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#2
0
        public int Insert(PandianInfo model)
        {
            model.Id = Guid.NewGuid();
            _db.Pandians.Insert(model);

            return(1);
        }
示例#3
0
        public int InsertByOutput(PandianInfo model)
        {
            StringBuilder sb = new StringBuilder(250);

            sb.Append(@"insert into Pandian (Id,Named,AllowUsers,CreateDate,UserId,TotalQty,Status,IsDown,Remark,LastUpdatedDate)
			            values
						(@Id,@Named,@AllowUsers,@CreateDate,@UserId,@TotalQty,@Status,@IsDown,@Remark,@LastUpdatedDate)
			            "            );

            SqlParameter[] parms =
            {
                new SqlParameter("@Id",              SqlDbType.UniqueIdentifier),
                new SqlParameter("@Named",           SqlDbType.NVarChar,           256),
                new SqlParameter("@AllowUsers",      SqlDbType.VarChar,           1000),
                new SqlParameter("@CreateDate",      SqlDbType.DateTime),
                new SqlParameter("@UserId",          SqlDbType.UniqueIdentifier),
                new SqlParameter("@TotalQty",        SqlDbType.Int),
                new SqlParameter("@Status",          SqlDbType.NVarChar,            20),
                new SqlParameter("@IsDown",          SqlDbType.Bit),
                new SqlParameter("@Remark",          SqlDbType.NVarChar,           300),
                new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime),
            };
            parms[0].Value = model.Id;
            parms[1].Value = model.Named;
            parms[2].Value = model.AllowUsers;
            parms[3].Value = model.CreateDate;
            parms[4].Value = model.UserId;
            parms[5].Value = model.TotalQty;
            parms[6].Value = model.Status;
            parms[7].Value = model.IsDown;
            parms[8].Value = model.Remark;
            parms[9].Value = model.LastUpdatedDate;

            return(SqlHelper.ExecuteNonQuery(SqlHelper.AssetConnString, CommandType.Text, sb.ToString(), parms));
        }
示例#4
0
文件: Pandian.cs 项目: songfang/Wms
        public IList <PandianInfo> GetList(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select count(*) from Pandian ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms);

            if (totalRecords == 0)
            {
                return(new List <PandianInfo>());
            }

            sb.Clear();
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by LastUpdatedDate desc) as RowNumber,
			          Id,UserId,OrderCode,Named,AllowUsers,Remark,StockStartDate,StockEndDate,Customers,Zones,StockLocations,TotalQty,Status,LastUpdatedDate
					  from Pandian "                    );
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            IList <PandianInfo> list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PandianInfo model = new PandianInfo();
                        model.Id              = reader.GetGuid(1);
                        model.UserId          = reader.GetGuid(2);
                        model.OrderCode       = reader.GetString(3);
                        model.Named           = reader.GetString(4);
                        model.AllowUsers      = reader.GetString(5);
                        model.Remark          = reader.GetString(6);
                        model.StockStartDate  = reader.GetDateTime(7);
                        model.StockEndDate    = reader.GetDateTime(8);
                        model.Customers       = reader.GetString(9);
                        model.Zones           = reader.GetString(10);
                        model.StockLocations  = reader.GetString(11);
                        model.TotalQty        = reader.GetDouble(12);
                        model.Status          = reader.GetString(13);
                        model.LastUpdatedDate = reader.GetDateTime(14);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#5
0
文件: Pandian.cs 项目: solarga/Asset
        public IList <PandianInfo> GetList(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select count(*) from Pandian ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), cmdParms);

            if (totalRecords == 0)
            {
                return(new List <PandianInfo>());
            }

            sb.Clear();
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by Status,Sort) as RowNumber,
			          Id,AppCode,UserId,DepmtId,Named,TotalQty,IsDown,MgrDepmtId,Sort,Remark,Status,RecordDate,LastUpdatedDate
					  from Pandian "                    );
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            IList <PandianInfo> list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PandianInfo model = new PandianInfo();
                        model.Id              = reader.IsDBNull(1) ? Guid.Empty : reader.GetGuid(1);
                        model.AppCode         = reader.IsDBNull(2) ? string.Empty : reader.GetString(2);
                        model.UserId          = reader.IsDBNull(3) ? Guid.Empty : reader.GetGuid(3);
                        model.DepmtId         = reader.IsDBNull(4) ? Guid.Empty : reader.GetGuid(4);
                        model.Named           = reader.IsDBNull(5) ? string.Empty : reader.GetString(5);
                        model.TotalQty        = reader.IsDBNull(6) ? 0 : reader.GetInt32(6);
                        model.IsDown          = reader.IsDBNull(7) ? false : reader.GetBoolean(7);
                        model.MgrDepmtId      = reader.IsDBNull(8) ? Guid.Empty : reader.GetGuid(8);
                        model.Sort            = reader.IsDBNull(9) ? 0 : reader.GetInt32(9);
                        model.Remark          = reader.IsDBNull(10) ? string.Empty : reader.GetString(10);
                        model.Status          = reader.IsDBNull(11) ? 0 : reader.GetInt32(11);
                        model.RecordDate      = reader.IsDBNull(12) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(12);
                        model.LastUpdatedDate = reader.IsDBNull(13) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(13);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#6
0
        public PandianInfo GetModelByJoin(string sqlWhere, params SqlParameter[] cmdParms)
        {
            PandianInfo pandianInfo = ConvertToModel.ToModel <PandianInfo>(cmdParms);

            if (!pandianInfo.Id.Equals(Guid.Empty))
            {
                return(_db.Pandians.FindById(pandianInfo.Id));
            }

            return(null);
        }
示例#7
0
        public IList <PandianInfo> GetListByJoin(int pageIndex, int pageSize, string sqlWhere, params SqlParameter[] cmdParms)
        {
            var sb         = new StringBuilder(500);
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by pd.LastUpdatedDate desc) as RowNumber,
			           pd.Id,pd.UserId,pd.OrderCode,pd.Named,pd.AllowUsers,pd.Remark,pd.StockStartDate,pd.StockEndDate,pd.Customers,pd.Zones,pd.StockLocations,pd.TotalQty,pd.Status,pd.LastUpdatedDate
					   ,u.UserName
                       from Pandian pd 
                       left join TygaSoftAspnetDb.dbo.aspnet_Users u on u.UserId = pd.UserId 
                       ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            var list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PandianInfo model = new PandianInfo();
                        model.Id              = reader.GetGuid(1);
                        model.UserId          = reader.GetGuid(2);
                        model.OrderCode       = reader.GetString(3);
                        model.Named           = reader.GetString(4);
                        model.AllowUsers      = reader.GetString(5);
                        model.Remark          = reader.GetString(6);
                        model.StockStartDate  = reader.GetDateTime(7);
                        model.StockEndDate    = reader.GetDateTime(8);
                        model.Customers       = reader.GetString(9);
                        model.Zones           = reader.GetString(10);
                        model.StockLocations  = reader.GetString(11);
                        model.TotalQty        = reader.GetDouble(12);
                        model.Status          = reader.GetString(13);
                        model.LastUpdatedDate = reader.GetDateTime(14);

                        model.UserName = reader.IsDBNull(15) ? "" : reader.GetString(15);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#8
0
        public int UpdateIsDown(object Id)
        {
            PandianInfo oldInfo = _db.Pandians.FindById((Guid)Id);

            if (oldInfo == null)
            {
                return(0);
            }

            oldInfo.IsDown = true;
            oldInfo.Status = (int)EnumPandianStatus.进行中;

            _db.Pandians.Update(oldInfo);

            return(1);
        }
示例#9
0
        public PandianInfo GetModelByJoin(string sqlWhere, params SqlParameter[] cmdParms)
        {
            var sb = new StringBuilder(300);

            sb.AppendFormat(@"select pd.Id,pd.AppCode,pd.UserId,pd.DepmtId,pd.Named,pd.TotalQty,pd.IsDown,pd.Sort,pd.Remark,pd.Status,pd.RecordDate,pd.LastUpdatedDate
                          ,u.UserName
					      from Pandian pd 
                          left join {0}aspnet_Users u on u.UserId = pd.UserId
                          ", GlobalConfig.Dbo);
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }

            PandianInfo model = null;

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    if (reader.Read())
                    {
                        model                 = new PandianInfo();
                        model.Id              = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0);
                        model.AppCode         = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
                        model.UserId          = reader.IsDBNull(2) ? Guid.Empty : reader.GetGuid(2);
                        model.DepmtId         = reader.IsDBNull(3) ? Guid.Empty : reader.GetGuid(3);
                        model.Named           = reader.IsDBNull(4) ? string.Empty : reader.GetString(4);
                        model.TotalQty        = reader.IsDBNull(5) ? 0 : reader.GetInt32(5);
                        model.IsDown          = reader.IsDBNull(6) ? false : reader.GetBoolean(6);
                        model.Sort            = reader.IsDBNull(7) ? 0 : reader.GetInt32(7);
                        model.Remark          = reader.IsDBNull(8) ? string.Empty : reader.GetString(8);
                        model.Status          = reader.IsDBNull(9) ? 0 : reader.GetInt32(9);
                        model.RecordDate      = reader.IsDBNull(10) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(10);
                        model.LastUpdatedDate = reader.IsDBNull(11) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(11);
                        model.UserName        = reader.IsDBNull(12) ? "" : reader.GetString(12);
                        model.SCreateDate     = model.RecordDate.ToString("yyyy-MM-dd");
                        model.StatusName      = EnumHelper.GetName(typeof(EnumPandianStatus), model.Status);
                    }
                }
            }

            return(model);
        }
示例#10
0
文件: Pandian.cs 项目: songfang/Wms
        public int InsertByOutput(PandianInfo model)
        {
            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"insert into Pandian (Id,UserId,OrderCode,Named,AllowUsers,Remark,StockStartDate,StockEndDate,Customers,Zones,StockLocations,TotalQty,Status,LastUpdatedDate)
			            values
						(@Id,@UserId,@OrderCode,@Named,@AllowUsers,@Remark,@StockStartDate,@StockEndDate,@Customers,@Zones,@StockLocations,@TotalQty,@Status,@LastUpdatedDate)
			            "            );

            SqlParameter[] parms =
            {
                new SqlParameter("@Id",              SqlDbType.UniqueIdentifier),
                new SqlParameter("@UserId",          SqlDbType.UniqueIdentifier),
                new SqlParameter("@OrderCode",       SqlDbType.VarChar,             36),
                new SqlParameter("@Named",           SqlDbType.NVarChar,           256),
                new SqlParameter("@AllowUsers",      SqlDbType.VarChar,           1000),
                new SqlParameter("@Remark",          SqlDbType.NVarChar,           300),
                new SqlParameter("@StockStartDate",  SqlDbType.DateTime),
                new SqlParameter("@StockEndDate",    SqlDbType.DateTime),
                new SqlParameter("@Customers",       SqlDbType.VarChar,           1000),
                new SqlParameter("@Zones",           SqlDbType.VarChar,           1000),
                new SqlParameter("@StockLocations",  SqlDbType.VarChar),
                new SqlParameter("@TotalQty",        SqlDbType.Float),
                new SqlParameter("@Status",          SqlDbType.NVarChar,            20),
                new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime)
            };
            parms[0].Value  = model.Id;
            parms[1].Value  = model.UserId;
            parms[2].Value  = model.OrderCode;
            parms[3].Value  = model.Named;
            parms[4].Value  = model.AllowUsers;
            parms[5].Value  = model.Remark;
            parms[6].Value  = model.StockStartDate;
            parms[7].Value  = model.StockEndDate;
            parms[8].Value  = model.Customers;
            parms[9].Value  = model.Zones;
            parms[10].Value = model.StockLocations;
            parms[11].Value = model.TotalQty;
            parms[12].Value = model.Status;
            parms[13].Value = model.LastUpdatedDate;

            return(SqlHelper.ExecuteNonQuery(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), parms));
        }
示例#11
0
文件: Pandian.cs 项目: songfang/Wms
        public IList <PandianInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select Id,UserId,OrderCode,Named,AllowUsers,Remark,StockStartDate,StockEndDate,Customers,Zones,StockLocations,TotalQty,Status,LastUpdatedDate
                        from Pandian ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.Append("order by LastUpdatedDate desc ");

            IList <PandianInfo> list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PandianInfo model = new PandianInfo();
                        model.Id              = reader.GetGuid(0);
                        model.UserId          = reader.GetGuid(1);
                        model.OrderCode       = reader.GetString(2);
                        model.Named           = reader.GetString(3);
                        model.AllowUsers      = reader.GetString(4);
                        model.Remark          = reader.GetString(5);
                        model.StockStartDate  = reader.GetDateTime(6);
                        model.StockEndDate    = reader.GetDateTime(7);
                        model.Customers       = reader.GetString(8);
                        model.Zones           = reader.GetString(9);
                        model.StockLocations  = reader.GetString(10);
                        model.TotalQty        = reader.GetDouble(11);
                        model.Status          = reader.GetString(12);
                        model.LastUpdatedDate = reader.GetDateTime(13);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#12
0
文件: Pandian.cs 项目: solarga/Asset
        public IList <PandianInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select Id,AppCode,UserId,DepmtId,Named,TotalQty,IsDown,MgrDepmtId,Sort,Remark,Status,RecordDate,LastUpdatedDate
                        from Pandian ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.Append("order by Status,Sort ");

            IList <PandianInfo> list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PandianInfo model = new PandianInfo();
                        model.Id              = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0);
                        model.AppCode         = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
                        model.UserId          = reader.IsDBNull(2) ? Guid.Empty : reader.GetGuid(2);
                        model.DepmtId         = reader.IsDBNull(3) ? Guid.Empty : reader.GetGuid(3);
                        model.Named           = reader.IsDBNull(4) ? string.Empty : reader.GetString(4);
                        model.TotalQty        = reader.IsDBNull(5) ? 0 : reader.GetInt32(5);
                        model.IsDown          = reader.IsDBNull(6) ? false : reader.GetBoolean(6);
                        model.MgrDepmtId      = reader.IsDBNull(7) ? Guid.Empty : reader.GetGuid(7);
                        model.Sort            = reader.IsDBNull(8) ? 0 : reader.GetInt32(8);
                        model.Remark          = reader.IsDBNull(9) ? string.Empty : reader.GetString(9);
                        model.Status          = reader.IsDBNull(10) ? 0 : reader.GetInt32(10);
                        model.RecordDate      = reader.IsDBNull(11) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(11);
                        model.LastUpdatedDate = reader.IsDBNull(12) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(12);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#13
0
        public IList <PandianInfo> GetList(int pageIndex, int pageSize, string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb         = new StringBuilder(250);
            int           startIndex = (pageIndex - 1) * pageSize + 1;
            int           endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by LastUpdatedDate desc) as RowNumber,
			           Id,Named,AllowUsers,CreateDate,UserId,TotalQty,Status,IsDown,Remark,LastUpdatedDate
					   from Pandian "                    );
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            IList <PandianInfo> list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PandianInfo model = new PandianInfo();
                        model.Id              = reader.GetGuid(1);
                        model.Named           = reader.GetString(2);
                        model.AllowUsers      = reader.GetString(3);
                        model.CreateDate      = reader.GetDateTime(4);
                        model.UserId          = reader.GetGuid(5);
                        model.TotalQty        = reader.GetInt32(6);
                        model.Status          = reader.GetString(7);
                        model.IsDown          = reader.GetBoolean(8);
                        model.Remark          = reader.GetString(9);
                        model.LastUpdatedDate = reader.GetDateTime(10);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#14
0
文件: Pandian.cs 项目: songfang/Wms
        public PandianInfo GetModel(Guid id)
        {
            PandianInfo model = null;

            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"select top 1 Id,UserId,OrderCode,Named,AllowUsers,Remark,StockStartDate,StockEndDate,Customers,Zones,StockLocations,TotalQty,Status,LastUpdatedDate 
			            from Pandian
						where Id = @Id "                        );
            SqlParameter[] parms =
            {
                new SqlParameter("@Id", SqlDbType.UniqueIdentifier)
            };
            parms[0].Value = id;

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), parms))
            {
                if (reader != null)
                {
                    if (reader.Read())
                    {
                        model                 = new PandianInfo();
                        model.Id              = reader.GetGuid(0);
                        model.UserId          = reader.GetGuid(1);
                        model.OrderCode       = reader.GetString(2);
                        model.Named           = reader.GetString(3);
                        model.AllowUsers      = reader.GetString(4);
                        model.Remark          = reader.GetString(5);
                        model.StockStartDate  = reader.GetDateTime(6);
                        model.StockEndDate    = reader.GetDateTime(7);
                        model.Customers       = reader.GetString(8);
                        model.Zones           = reader.GetString(9);
                        model.StockLocations  = reader.GetString(10);
                        model.TotalQty        = reader.GetDouble(11);
                        model.Status          = reader.GetString(12);
                        model.LastUpdatedDate = reader.GetDateTime(13);
                    }
                }
            }

            return(model);
        }
示例#15
0
文件: Pandian.cs 项目: solarga/Asset
        public int InsertByOutput(PandianInfo model)
        {
            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"insert into Pandian (Id,AppCode,UserId,DepmtId,Named,TotalQty,IsDown,MgrDepmtId,Sort,Remark,Status,RecordDate,LastUpdatedDate)
			            values
						(@Id,@AppCode,@UserId,@DepmtId,@Named,@TotalQty,@IsDown,@MgrDepmtId,@Sort,@Remark,@Status,@RecordDate,@LastUpdatedDate)
			            "            );

            SqlParameter[] parms =
            {
                new SqlParameter("@Id",              SqlDbType.UniqueIdentifier),
                new SqlParameter("@AppCode",         SqlDbType.Char,                6),
                new SqlParameter("@UserId",          SqlDbType.UniqueIdentifier),
                new SqlParameter("@DepmtId",         SqlDbType.UniqueIdentifier),
                new SqlParameter("@Named",           SqlDbType.NVarChar,          256),
                new SqlParameter("@TotalQty",        SqlDbType.Int),
                new SqlParameter("@IsDown",          SqlDbType.Bit),
                new SqlParameter("@MgrDepmtId",      SqlDbType.UniqueIdentifier),
                new SqlParameter("@Sort",            SqlDbType.Int),
                new SqlParameter("@Remark",          SqlDbType.NVarChar,          300),
                new SqlParameter("@Status",          SqlDbType.Int),
                new SqlParameter("@RecordDate",      SqlDbType.DateTime),
                new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime)
            };
            parms[0].Value  = model.Id;
            parms[1].Value  = model.AppCode;
            parms[2].Value  = model.UserId;
            parms[3].Value  = model.DepmtId;
            parms[4].Value  = model.Named;
            parms[5].Value  = model.TotalQty;
            parms[6].Value  = model.IsDown;
            parms[7].Value  = model.MgrDepmtId;
            parms[8].Value  = model.Sort;
            parms[9].Value  = model.Remark;
            parms[10].Value = model.Status;
            parms[11].Value = model.RecordDate;
            parms[12].Value = model.LastUpdatedDate;

            return(SqlHelper.ExecuteNonQuery(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), parms));
        }
示例#16
0
文件: Pandian.cs 项目: solarga/Asset
        public PandianInfo GetModel(Guid id)
        {
            PandianInfo model = null;

            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"select top 1 Id,AppCode,UserId,DepmtId,Named,TotalQty,IsDown,MgrDepmtId,Sort,Remark,Status,RecordDate,LastUpdatedDate 
			            from Pandian
						where Id = @Id "                        );
            SqlParameter[] parms =
            {
                new SqlParameter("@Id", SqlDbType.UniqueIdentifier)
            };
            parms[0].Value = id;

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), parms))
            {
                if (reader != null)
                {
                    if (reader.Read())
                    {
                        model                 = new PandianInfo();
                        model.Id              = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0);
                        model.AppCode         = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
                        model.UserId          = reader.IsDBNull(2) ? Guid.Empty : reader.GetGuid(2);
                        model.DepmtId         = reader.IsDBNull(3) ? Guid.Empty : reader.GetGuid(3);
                        model.Named           = reader.IsDBNull(4) ? string.Empty : reader.GetString(4);
                        model.TotalQty        = reader.IsDBNull(5) ? 0 : reader.GetInt32(5);
                        model.IsDown          = reader.IsDBNull(6) ? false : reader.GetBoolean(6);
                        model.MgrDepmtId      = reader.IsDBNull(7) ? Guid.Empty : reader.GetGuid(7);
                        model.Sort            = reader.IsDBNull(8) ? 0 : reader.GetInt32(8);
                        model.Remark          = reader.IsDBNull(9) ? string.Empty : reader.GetString(9);
                        model.Status          = reader.IsDBNull(10) ? 0 : reader.GetInt32(10);
                        model.RecordDate      = reader.IsDBNull(11) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(11);
                        model.LastUpdatedDate = reader.IsDBNull(12) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(12);
                    }
                }
            }

            return(model);
        }
示例#17
0
        public IList <PandianInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(250);

            sb.Append(@"select Id,Named,AllowUsers,CreateDate,UserId,TotalQty,Status,IsDown,Remark,LastUpdatedDate
                        from Pandian ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }

            IList <PandianInfo> list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PandianInfo model = new PandianInfo();
                        model.Id              = reader.GetGuid(0);
                        model.Named           = reader.GetString(1);
                        model.AllowUsers      = reader.GetString(2);
                        model.CreateDate      = reader.GetDateTime(3);
                        model.UserId          = reader.GetGuid(4);
                        model.TotalQty        = reader.GetInt32(5);
                        model.Status          = reader.GetString(6);
                        model.IsDown          = reader.GetBoolean(7);
                        model.Remark          = reader.GetString(8);
                        model.LastUpdatedDate = reader.GetDateTime(9);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#18
0
        public PandianInfo GetModel(object Id)
        {
            PandianInfo model = null;

            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"select top 1 Id,Named,AllowUsers,CreateDate,UserId,TotalQty,Status,IsDown,Remark,LastUpdatedDate 
			            from Pandian
						where Id = @Id "                        );
            SqlParameter parm = new SqlParameter("@Id", SqlDbType.UniqueIdentifier);

            parm.Value = Guid.Parse(Id.ToString());

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetConnString, CommandType.Text, sb.ToString(), parm))
            {
                if (reader != null)
                {
                    if (reader.Read())
                    {
                        model                 = new PandianInfo();
                        model.Id              = reader.GetGuid(0);
                        model.Named           = reader.GetString(1);
                        model.AllowUsers      = reader.GetString(2);
                        model.CreateDate      = reader.GetDateTime(3);
                        model.UserId          = reader.GetGuid(4);
                        model.TotalQty        = reader.GetInt32(5);
                        model.Status          = reader.GetString(6);
                        model.IsDown          = reader.GetBoolean(7);
                        model.Remark          = reader.GetString(8);
                        model.LastUpdatedDate = reader.GetDateTime(9);
                    }
                }
            }

            return(model);
        }
示例#19
0
        public int InsertByOutput(PandianInfo model)
        {
            _db.Pandians.Insert(model);

            return(1);
        }
示例#20
0
        public IList <PandianInfo> GetListByJoin(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            var sb = new StringBuilder(250);

            sb.AppendFormat(@"select count(*) from Pandian pd
                        left join {0}aspnet_Users u on u.UserId = pd.UserId
                      ", GlobalConfig.Dbo);
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), cmdParms);

            if (totalRecords == 0)
            {
                return(new List <PandianInfo>());
            }

            sb.Clear();
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex   = pageIndex * pageSize;

            sb.AppendFormat(@"select * from(select row_number() over(order by pd.LastUpdatedDate desc) as RowNumber,
			          pd.Id,pd.AppCode,pd.UserId,pd.DepmtId,pd.Named,pd.TotalQty,pd.IsDown,pd.Sort,pd.Remark,pd.Status,pd.RecordDate,pd.LastUpdatedDate
                      ,u.UserName
					  from Pandian pd 
                      left join {0}aspnet_Users u on u.UserId = pd.UserId
                      ", GlobalConfig.Dbo);
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            var list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var model = new PandianInfo();
                        model.Id              = reader.IsDBNull(1) ? Guid.Empty : reader.GetGuid(1);
                        model.AppCode         = reader.IsDBNull(2) ? string.Empty : reader.GetString(2);
                        model.UserId          = reader.IsDBNull(3) ? Guid.Empty : reader.GetGuid(3);
                        model.DepmtId         = reader.IsDBNull(4) ? Guid.Empty : reader.GetGuid(4);
                        model.Named           = reader.IsDBNull(5) ? string.Empty : reader.GetString(5);
                        model.TotalQty        = reader.IsDBNull(6) ? 0 : reader.GetInt32(6);
                        model.IsDown          = reader.IsDBNull(7) ? false : reader.GetBoolean(7);
                        model.Sort            = reader.IsDBNull(8) ? 0 : reader.GetInt32(8);
                        model.Remark          = reader.IsDBNull(9) ? string.Empty : reader.GetString(9);
                        model.Status          = reader.IsDBNull(10) ? 0 : reader.GetInt32(10);
                        model.RecordDate      = reader.IsDBNull(11) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(11);
                        model.LastUpdatedDate = reader.IsDBNull(12) ? DateTime.Parse("1754-01-01") : reader.GetDateTime(12);
                        model.UserName        = reader.IsDBNull(13) ? "" : reader.GetString(13);
                        model.SCreateDate     = model.RecordDate.ToString("yyyy-MM-dd");
                        model.StatusName      = EnumHelper.GetName(typeof(EnumPandianStatus), model.Status);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#21
0
        public IList <PandianInfo> GetListByJoin(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(250);

            sb.Append(@"select count(*) from Pandian pd
                        left join TygaSoftAspnetDb.dbo.aspnet_Users u on u.UserId = pd.UserId
                      ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.AssetConnString, CommandType.Text, sb.ToString(), cmdParms);

            if (totalRecords == 0)
            {
                return(new List <PandianInfo>());
            }

            sb.Clear();
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by pd.LastUpdatedDate desc) as RowNumber,
			          pd.Id,pd.Named,pd.AllowUsers,pd.CreateDate,pd.UserId,pd.TotalQty,pd.Status,pd.IsDown,pd.Remark,pd.LastUpdatedDate
                      ,u.UserName
					  from Pandian pd 
                      left join TygaSoftAspnetDb.dbo.aspnet_Users u on u.UserId = pd.UserId
                      ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            IList <PandianInfo> list = new List <PandianInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.AssetConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        PandianInfo model = new PandianInfo();
                        model.Id              = reader.GetGuid(1);
                        model.Named           = reader.GetString(2);
                        model.AllowUsers      = reader.GetString(3);
                        model.CreateDate      = reader.GetDateTime(4);
                        model.UserId          = reader.GetGuid(5);
                        model.TotalQty        = reader.GetInt32(6);
                        model.Status          = reader.GetString(7);
                        model.IsDown          = reader.GetBoolean(8);
                        model.Remark          = reader.GetString(9);
                        model.LastUpdatedDate = reader.GetDateTime(10);
                        model.UserName        = reader.IsDBNull(11) ? "" : reader.GetString(11);
                        model.SCreateDate     = model.CreateDate.ToString("yyyy-MM-dd");

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
示例#22
0
文件: Pandian.cs 项目: solarga/Asset
 public int InsertByOutput(PandianInfo model)
 {
     return(dal.InsertByOutput(model));
 }
示例#23
0
        public int Update(PandianInfo model)
        {
            _db.Pandians.Update(model);

            return(1);
        }
示例#24
0
文件: Pandian.cs 项目: solarga/Asset
 public int Update(PandianInfo model)
 {
     return(dal.Update(model));
 }