Ejemplo n.º 1
0
        public async Task updatePublicationDetails(int ReleaseID, int CPID, string FileName)
        {
            try
            {
                int count = 0;
                DAL.Models.Employee publishEmp;

                using (IEmployeeRepository dbEmp = new EmployeeRepository())
                {
                    publishEmp = dbEmp.Where(e => e.UserName == User.Identity.Name.Replace("NTNET\\", "")).FirstOrDefault();
                }

                using (IReleaseCPRepository db = new ReleaseCPRepository())
                {
                    var publishCP = db.Where(rcp => rcp.ReleaseID == ReleaseID & rcp.CPID == CPID).FirstOrDefault();
                    if (publishCP != null)
                    {
                        publishCP.PublicationMailDate = DateTime.Now;
                        publishCP.PublicationMail     = FileName;
                        publishCP.SendByID            = publishEmp.EmployeeID;
                        publishCP.SendByName          = publishEmp.FirstName + " " + publishEmp.LastName;
                        publishCP.PublicationCount++;
                        count += await db.SaveAsync((WindowsPrincipal)User);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public async Task <int> AddCPs(int ReleaseID)
        {
            IEnumerable <CP> CPs = null;
            int count            = 0;

            using (ICPRepository db = new CPRepository())
            {
                CPs = db.Get().Where(cp => cp.EffectiveDate <DateTime.Today.Date && cp.ExpirationDate> DateTime.Today.Date && cp.IsDeleted == false);
            }

            using (IReleaseCPRepository db = new ReleaseCPRepository())
            {
                IList <ReleaseCP> ReleaseCP = new List <ReleaseCP>();
                CPs.ToList().ForEach(cp => ReleaseCP.Add(new ReleaseCP()
                {
                    CPID = cp.CPID, ReleaseID = ReleaseID, ExceptionIndicator = false, IsDeleted = false
                }));
                db.AddRange(ReleaseCP);
                count += await db.SaveAsync((WindowsPrincipal)User);
            }
            return(count);
        }