Пример #1
0
 public ActionResult PMTaskDelete(Guid id)
 {
     try
     {
         var del = (from a in db.PMTaskMasters
                    join b in db.PMTaskMonitor_ on a.PMTaskId equals b.PMTaskID
                    where a.PMTaskId == id && a.isActive == true && b.isActive == true
                    select b
                    ).ToList();
         if (del.Count != 0)
         {
             return(Json("fail"));
         }
         else
         {
             PMTaskMaster PMTask = db.PMTaskMasters.Find(id);
             if (PMTask.PMTaskId == id)
             {
                 PMTask.isActive        = false;
                 PMTask.IsDeleted       = true;
                 db.Entry(PMTask).State = EntityState.Modified;
                 db.SaveChanges();
             }
             return(Json("success"));
         }
     }
     catch (Exception ex)
     {
         string Url = Request.Url.AbsoluteUri;
         _Log.createLog(ex, "--> PMTaskCreate " + Url);
         throw;
     }
 }
Пример #2
0
        public ActionResult GetPMtaskById(Guid?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                PMTaskMaster PMTask = db.PMTaskMasters.Find(id);
                if (PMTask == null)
                {
                    return(HttpNotFound());
                }

                //var PMTasks = db.PMTaskMasters.Where(x => x.isActive == true && x.PMTaskId == id).Select(
                //    p => new {
                //        p.PMTaskId,
                //        p.PMTaskName,
                //        p.EST_hours,
                //        p.PMTaskCategoryID,
                //        p.Cre_on,
                //        p.Cre_By
                //    }).FirstOrDefault();
                var PMTasks = _Base.Sp_GetPMtaskById(id);
                return(Json(PMTasks, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                string Url = Request.Url.AbsoluteUri;
                _Log.createLog(ex, "-->GetPMtaskById" + Url);
                throw;
            }
        }
Пример #3
0
 public ActionResult PMTaskCreate(PMTaskMaster PMTask)
 {
     try
     {
         var name = db.PMTaskMasters.Where(p => p.PMTaskName == PMTask.PMTaskName).Where(x => x.isActive == true).ToList();
         if (name.Count == 0)
         {
             PMTask.PMTaskId = Guid.NewGuid();
             PMTask.isActive = true;
             PMTask.Cre_on   = DateTime.UtcNow;
             PMTask.Cre_By   = Guid.Parse(Session["loginid"].ToString());
             db.PMTaskMasters.Add(PMTask);
             db.SaveChanges();
             return(Json("success"));
         }
         else
         {
             return(Json("error"));
         }
     }
     catch (Exception ex)
     {
         string Url = Request.Url.AbsoluteUri;
         _Log.createLog(ex, "-->PMTaskCreate" + Url);
         throw;
     }
 }
        public ActionResult GetTaskName()
        {
            var PMTasklist         = db.PMTaskMasters.Where(x => x.isActive == true).ToList();
            List <PMTaskMaster> PM = new List <PMTaskMaster>();

            foreach (var item in PMTasklist)
            {
                PMTaskMaster p = new PMTaskMaster();
                p.PMTaskId   = item.PMTaskId;
                p.PMTaskName = item.PMTaskName;
                PM.Add(p);
            }
            return(Json(PM, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public ActionResult PMTaskAddEdit(PMTaskMaster PMTask)
        {
            try
            {
                PMTask.Cre_By = Guid.Parse(Session["loginid"].ToString());
                //PMTask.Cre_on = DateTime.UtcNow;
                var Status = _Base.PMTask_Master_Add_Update(PMTask);
                if (Status == true)
                {
                    return(Json("success"));
                }
                else
                {
                    return(Json("error"));
                }



                //var name = db.PMTaskMasters.Where(p => p.PMTaskName == PMTask.PMTaskName).Where(x => x.PMTaskId != PMTask.PMTaskId).Where(x => x.isActive == true).ToList();
                //if (name.Count == 0)
                //{
                //    PMTask.Modified_On = DateTime.UtcNow;
                //    //PMTask.Cre_on = DateTime.UtcNow;
                //    PMTask.Modified_by = Guid.Parse(Session["loginid"].ToString());
                //    PMTask.isActive = true;
                //    db.Entry(PMTask).State = EntityState.Modified;
                //    db.SaveChanges();
                //    return Json("success");
                //}
                //else
                //{
                //    return Json("error");
                //}
            }
            catch (Exception ex)
            {
                string Url = Request.Url.AbsoluteUri;
                _Log.createLog(ex, "-->PMTaskEdit" + Url);
                throw;
            }
        }