Example #1
0
        public static void Delete(Team model)
        {
            string sql = "select * from PSS_Team where Team_Id='" + model.Team_Id + "'";
            DataSet ds = SqlHelper.GetDataSetBySql(sql, "PSS_Team");
            DataRow dr = ds.Tables["PSS_Team"].Rows[0];
            dr.Delete();

            SqlHelper.UpdateDataSet(ds, sql, "PSS_Team");
            if (ds != null)
                ds.Dispose();
        }
Example #2
0
        public static List<Team> GetList(string idList)
        {
            List<Team> list = new List<Team>();
            Team model = null;
            string sql = "select * from PSS_Team where Team_Id in (" + idList + ")";
            DataSet ds = SqlHelper.GetDataSetBySql(sql, "PSS_Team");
            foreach (DataRow dr in ds.Tables["PSS_Team"].Rows)
            {
                model = new Team();

                if (!string.IsNullOrEmpty(dr["Team_Id"].ToString()))
                {
                    model.Team_Id = int.Parse(dr["Team_Id"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["Team_User_Id"].ToString()))
                {
                    model.Team_User_Id = int.Parse(dr["Team_User_Id"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["Team_Proj_Id"].ToString()))
                {
                    model.Team_Proj_Id = int.Parse(dr["Team_Proj_Id"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["Team_Status"].ToString()))
                {
                    model.Team_Status = int.Parse(dr["Team_Status"].ToString());
                    if (model.Team_Status == 0)
                    {
                        model.Status = "UnAuthorized";
                    }
                    else if (model.Team_Status == 1)
                    {
                        model.Status = "Authorized";
                    }
                    else if (model.Team_Status == 2)
                    {
                        model.Status = "Bid";
                    }
                }
                model.Team_Title = dr["Team_Title"].ToString();

                if (!string.IsNullOrEmpty(dr["Team_Update_Time"].ToString()))
                {
                    model.Team_Update_Time = DateTime.Parse(dr["Team_Update_Time"].ToString());
                    model.Update_Time = model.Team_Update_Time.ToString("dd/MM/yyyy HH:mm");
                }
                list.Add(model);
            };
            return list;
        }
Example #3
0
        public ContentResult TeamSave(Team model, int? id)
        {
            JsonDataGridResult jsonResult = new JsonDataGridResult();
            try
            {
                Team team = null;
                if (id.HasValue)
                {
                    team = TeamService.GetModel(id.Value);
                }
                else
                {
                    team = new Team();
                }

                team.Team_User_Id = model.Team_User_Id;
                team.Team_Proj_Id = model.Team_Proj_Id;
                team.Team_Title = model.Team_Title;
                team.Team_Status = 0;
                team.Team_Update_Time = DateTime.Now;

                if (id.HasValue)
                {
                    TeamService.Update(team);
                }
                else
                {
                    TeamService.Save(team);
                }
                jsonResult.result = true;
                jsonResult.message = "";
            }
            catch (Exception ex)
            {
                jsonResult.result = false;
                jsonResult.message = ex.Message;
            }
            string result = JsonConvert.SerializeObject(jsonResult);
            return Content(result);
        }
Example #4
0
        public static void Update(Team model)
        {
            string sql = "select * from PSS_Team where Team_Id='" + model.Team_Id + "'";
            DataSet ds = SqlHelper.GetDataSetBySql(sql, "PSS_Team");
            DataRow dr = ds.Tables["PSS_Team"].Rows[0];

            dr["Team_User_Id"] = model.Team_User_Id;
            dr["Team_Proj_Id"] = model.Team_Proj_Id;
            dr["Team_Update_Time"] = model.Team_Update_Time;
            dr["Team_Title"] = model.Team_Title;
            dr["Team_Status"] = model.Team_Status;

            SqlHelper.UpdateDataSet(ds, sql, "PSS_Team");
            if (ds != null)
                ds.Dispose();
        }
Example #5
0
        public static void Save(Team model)
        {
            string sql = "select * from PSS_Team where 1<>1";
            DataSet ds = SqlHelper.GetDataSetBySql(sql, "PSS_Team");
            DataRow dr = ds.Tables["PSS_Team"].NewRow();

            int maxId = SqlHelper.GetMaxId("select max(Team_Id) from PSS_Team");
            dr["Team_Id"] = ++maxId;
            dr["Team_User_Id"] = model.Team_User_Id;
            dr["Team_Proj_Id"] = model.Team_Proj_Id;
            dr["Team_Update_Time"] = model.Team_Update_Time;
            dr["Team_Title"] = model.Team_Title;
            dr["Team_Status"] = model.Team_Status;

            ds.Tables["PSS_Team"].Rows.Add(dr);

            SqlHelper.UpdateDataSet(ds, sql, "PSS_Team");
            if (ds != null)
                ds.Dispose();
        }
Example #6
0
        public static Team GetModel(int id)
        {
            string sql = "select * from PSS_Team where Team_Id='" + id + "'";
            DataSet ds = SqlHelper.GetDataSetBySql(sql, "PSS_Team");
            Team model = null;

            if (ds.Tables[0].Rows.Count > 0)
            {
                model = new Team();
                if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Team_Id"].ToString()))
                {
                    model.Team_Id = int.Parse(ds.Tables[0].Rows[0]["Team_Id"].ToString());
                }
                if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Team_User_Id"].ToString()))
                {
                    model.Team_User_Id = int.Parse(ds.Tables[0].Rows[0]["Team_User_Id"].ToString());
                }
                if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Team_Proj_Id"].ToString()))
                {
                    model.Team_Proj_Id = int.Parse(ds.Tables[0].Rows[0]["Team_Proj_Id"].ToString());
                }
                if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Team_Status"].ToString()))
                {
                    model.Team_Status = int.Parse(ds.Tables[0].Rows[0]["Team_Status"].ToString());
                }
                model.Team_Title = ds.Tables[0].Rows[0]["Team_Title"].ToString();

                if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Idea_Update_Time"].ToString()))
                {
                    model.Team_Update_Time = DateTime.Parse(ds.Tables[0].Rows[0]["Team_Update_Time"].ToString());
                    model.Update_Time = model.Team_Update_Time.ToString("dd/MM/yyyy HH:mm");
                }
            }
            if (ds != null)
                ds.Dispose();
            return model;
        }
Example #7
0
        public static List<Team> GetList(Paging paging, string order, string sort, string status, string queryWord)
        {
            List<Team> list = new List<Team>();
            Team model = null;
            DataSet ds = SqlHelper.GetListByPage("PSS_Team", "Team_Status", status, paging, order, sort);
            foreach (DataRow dr in ds.Tables["PSS_Team"].Rows)
            {
                model = new Team();

                if (!string.IsNullOrEmpty(dr["Team_Id"].ToString()))
                {
                    model.Team_Id = int.Parse(dr["Team_Id"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["Team_User_Id"].ToString()))
                {
                    model.Team_User_Id = int.Parse(dr["Team_User_Id"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["Team_Proj_Id"].ToString()))
                {
                    model.Team_Proj_Id = int.Parse(dr["Team_Proj_Id"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["Team_Status"].ToString()))
                {
                    model.Team_Status = int.Parse(dr["Team_Status"].ToString());
                    if (model.Team_Status == 0)
                    {
                        model.Status = "UnAuthorized";
                    }
                    else if (model.Team_Status == 1)
                    {
                        model.Status = "Authorized";
                    }
                    else if (model.Team_Status == 2)
                    {
                        model.Status = "Bid";
                    }
                }
                model.Team_Title = dr["Team_Title"].ToString();

                if (!string.IsNullOrEmpty(dr["Team_Update_Time"].ToString()))
                {
                    model.Team_Update_Time = DateTime.Parse(dr["Team_Update_Time"].ToString());
                    model.Update_Time = model.Team_Update_Time.ToString("dd/MM/yyyy HH:mm");
                }
                list.Add(model);
            };
            return list;
        }