예제 #1
0
        public HttpResponseMessage AddTeam(PM_EM_TEAM definitions)
        {
            definitions.TeamGuid   = Guid.NewGuid();
            definitions.RowDeleted = false;
            definitions.CreatedOn  = DateTime.Now;

            IList <PM_EM_TEAM>    list = new List <PM_EM_TEAM>();
            PM_EM_TEAM_QueryParam team = new PM_EM_TEAM_QueryParam();

            team.TeamName = definitions.TeamName;
            list          = teamBO.GetEntities(team);
            if (list == null || list.Count == 0)
            {
                PM_EM_TEAM mmExt = teamBO.Insert(definitions);
                if (mmExt != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, "新增成功"));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.InternalServerError, "新增失败"));
                }
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "该班组已经存在"));
            }
        }
예제 #2
0
        public HttpResponseMessage AddGrouptoTeam(PM_EM_TEAM definitions, string[] groupNameList)
        {
            definitions.TeamGuid   = Guid.NewGuid();
            definitions.RowDeleted = false;
            definitions.CreatedOn  = DateTime.Now;
            PM_EM_TEAM mmExt = teamBO.Insert(definitions);

            if (mmExt != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "新增成功"));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "新增失败"));
            }
        }
예제 #3
0
        public HttpResponseMessage UpdateTeam(PM_EM_TEAM definitions)
        {
            definitions.UpdatedOn = DateTime.Now;

            string    sql = " SELECT * FROM  PM_EM_TEAM WHERE TeamName=N'" + definitions.TeamName + "' and TeamGuid!='" + definitions.TeamGuid.ToString() + "' ";
            DataTable dt  = co_BSC_BO.GetDataTableBySql(sql);

            if (dt != null)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "已存在相同的班组名称,请更换!"));
            }
            else
            {
                definitions.RowDeleted = false;
                teamBO.Update(definitions);
                return(Request.CreateResponse(HttpStatusCode.OK, "编辑成功"));
            }
        }