Ejemplo n.º 1
0
 public static void UpdateLatest(string progressVersionId)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         if (!string.IsNullOrEmpty(progressVersionId))
         {
             plus_progress progress = (from m in entities.plus_progress_version
                                       where m.ProgressVersionId == progressVersionId
                                       select m.plus_progress).FirstOrDefault <plus_progress>();
             List <plus_progress_version> list = (from m in entities.plus_progress_version
                                                  where ((m.plus_progress.ProgressId == progress.ProgressId) && (m.IsLatest == true)) || (m.ProgressVersionId == progressVersionId)
                                                  select m).ToList <plus_progress_version>();
             plus_progress_version _version = (from m in entities.plus_progress_version
                                               where m.ProgressVersionId == progressVersionId
                                               select m).FirstOrDefault <plus_progress_version>();
             if ((list != null) && (_version != null))
             {
                 foreach (plus_progress_version _version2 in list)
                 {
                     _version2.IsLatest = false;
                 }
                 _version.IsLatest = true;
             }
             AddWarn(progressVersionId, entities);
             entities.SaveChanges();
         }
     }
 }
Ejemplo n.º 2
0
 public void Add(cn.justwin.BLL.ProgressManagement.Version entity)
 {
     if (entity != null)
     {
         using (pm2Entities entities = new pm2Entities())
         {
             plus_progress_version _version = new plus_progress_version {
                 ProgressVersionId = entity.ProgressVersionId,
                 ParentVersionId   = entity.ParentVersionId,
                 VersionCode       = entity.VersionCode,
                 VersionName       = entity.VersionName,
                 FlowState         = new int?(entity.FlowState),
                 InputDate         = new DateTime?(entity.InputDate),
                 IsLatest          = new bool?(entity.IsLatest),
                 Note    = entity.Note,
                 PT_yhmc = (from m in entities.PT_yhmc
                            where m.v_yhdm == entity.InputUser
                            select m).FirstOrDefault <PT_yhmc>(),
                 plus_progress = (from m in entities.plus_progress
                                  where m.ProgressId == entity.ProgressId
                                  select m).FirstOrDefault <plus_progress>()
             };
             entities.AddToplus_progress_version(_version);
             entities.SaveChanges();
         }
     }
 }
Ejemplo n.º 3
0
 public static void UpdateLatest(string progressId)
 {
     using (pm2Entities entities = new pm2Entities())
     {
         plus_progress_version _version = (from m in entities.plus_progress
                                           join n in entities.plus_progress_version on m.ProgressId equals n.plus_progress.ProgressId into n
                                           where (m.ProgressId == progressId) && (n.FlowState == null)
                                           select n).FirstOrDefault <plus_progress_version>();
         plus_progress progress = (from m in entities.plus_progress
                                   where m.ProgressId == progressId
                                   select m).FirstOrDefault <plus_progress>();
         if ((progress != null) && progress.IsMain)
         {
             plus_progress _progress = (from m in entities.plus_progress
                                        where ((m.IsMain && (m.PrjId == progress.PrjId)) && (m.FlowState == 1)) && (m.ProgressId != progressId)
                                        select m).FirstOrDefault <plus_progress>();
             if (_progress != null)
             {
                 _progress.IsMain = false;
             }
         }
         if (_version != null)
         {
             _version.IsLatest = true;
             cn.justwin.BLL.ProgressManagement.Version.AddWarn(_version.ProgressVersionId, entities);
             entities.SaveChanges();
         }
     }
 }
Ejemplo n.º 4
0
 public void Add(Progress entity)
 {
     if (entity != null)
     {
         using (pm2Entities entities = new pm2Entities())
         {
             PT_yhmc _yhmc = (from m in entities.PT_yhmc
                              where m.v_yhdm == entity.InputUser
                              select m).FirstOrDefault <PT_yhmc>();
             plus_progress _progress = new plus_progress {
                 ProgressId   = entity.ProgressId,
                 PrjId        = new Guid?(entity.PrjId),
                 ProgressName = entity.ProgressName,
                 IsMain       = entity.IsMain,
                 FlowState    = new int?(entity.FlowState),
                 Note         = entity.Note,
                 InputDate    = new DateTime?(entity.InputDate),
                 PT_yhmc      = _yhmc
             };
             entities.AddToplus_progress(_progress);
             if (entity.IsMain)
             {
                 List <plus_progress> list = (from m in entities.plus_progress
                                              where (m.PrjId == entity.PrjId) && m.IsMain
                                              select m).ToList <plus_progress>();
                 if (list.Count > 0)
                 {
                     foreach (plus_progress _progress2 in list)
                     {
                         _progress2.IsMain = false;
                     }
                 }
             }
             string str = Guid.NewGuid().ToString();
             plus_progress_version _version = new plus_progress_version {
                 ProgressVersionId = str,
                 ParentVersionId   = null,
                 VersionCode       = entity.VersionCode,
                 VersionName       = entity.ProgressName,
                 FlowState         = null,
                 InputDate         = new DateTime?(entity.InputDate),
                 IsLatest          = false,
                 Note          = entity.Note,
                 plus_progress = _progress
             };
             entities.AddToplus_progress_version(_version);
             List <string> userCodes = new List <string> {
                 entity.InputUser
             };
             if (entity.InputUser != "00000000")
             {
                 userCodes.Add("00000000");
             }
             Privilege.AddPrivilege(userCodes, _progress, entities);
             entities.SaveChanges();
         }
     }
 }
Ejemplo n.º 5
0
        private static void DelApply(string verId, pm2Entities context)
        {
            plus_progress_version entity = (from m in context.plus_progress_version
                                            where m.ProgressVersionId == verId
                                            select m).FirstOrDefault <plus_progress_version>();

            if (entity != null)
            {
                context.DeleteObject(entity);
            }
        }
Ejemplo n.º 6
0
        protected internal static void AddWarn(string progressVerId, pm2Entities context)
        {
            List <string> list = (from m in context.plus_progress_version
                                  join n in context.plus_progress on m.plus_progress.ProgressId equals n.ProgressId into n
                                  join l in context.plus_progress_privilege on n.ProgressId equals l.plus_progress.ProgressId into l
                                  where m.ProgressVersionId == progressVerId
                                  select l.PT_yhmc.v_yhdm).ToList <string>();

            if (list != null)
            {
                plus_progress_version _version = (from m in context.plus_progress_version
                                                  where m.ProgressVersionId == progressVerId
                                                  select m).FirstOrDefault <plus_progress_version>();
                string str = (from m in context.PT_PrjInfo
                              join n in context.plus_progress on m.PrjGuid equals n.PrjId into n
                              join l in context.plus_progress_version on n.ProgressId equals l.plus_progress.ProgressId into l
                              where l.ProgressVersionId == progressVerId
                              select m.PrjName).FirstOrDefault <string>();
                string str2 = string.Empty;
                string str3 = string.Empty;
                if (_version.FlowState.HasValue)
                {
                    str2 = "调整";
                }
                else
                {
                    str3 = "&modify=false";
                }
                string str4 = "项目[" + str + "]的进度计划[" + str2 + _version.VersionName + "  " + _version.VersionCode + "]已发布";
                string str5 = "项目[" + str + "]的进度计划[" + str2 + _version.VersionName + "  " + _version.VersionCode + "]已通过" + str2 + "审核,此版本为进度计划的执行版本";
                foreach (string str6 in list)
                {
                    PT_Warning warning = new PT_Warning {
                        WarningTitle    = str4,
                        WarningContent  = str5,
                        UserCode        = str6,
                        URI             = "/ProgressManagement/Modify/ApplyView.aspx?ic=" + progressVerId + str3,
                        IsValid         = true,
                        InputDate       = new DateTime?(DateTime.Now),
                        RelationsTable  = "plus_progress_version",
                        RelationsColumn = "ProgressVersionId",
                        RelationsKey    = progressVerId
                    };
                    context.AddToPT_Warning(warning);
                }
            }
        }