Exemplo n.º 1
0
        public ActionResult EditMemo(int id)
        {
            oCurrentUser = (CCUSER)Session["User"];
            int          enumDBType    = 0;
            CCMEMOMASTER oCCMEMOMASTER = new CCMEMOMASTER();

            oCCMEMOMASTER.TICKETNO = DateTime.Now.ToString("yyMMddhhmmssfff");
            enumDBType             = Convert.ToInt32(Enumaretion.DBEnumType.StatusType);
            ViewBag.StatusList     = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.VALUE.ToString(),
                Text  = x.NAME.ToString()
            });

            enumDBType           = Convert.ToInt32(Enumaretion.DBEnumType.FormType);
            ViewBag.MemoTypeList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });
            enumDBType           = Convert.ToInt32(Enumaretion.DBEnumType.PriorityType);
            ViewBag.PriorityList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });

            ViewBag.CallCatagoryList = oDBContext.CCCALLCATAGORies.Where(t => t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });

            enumDBType         = Convert.ToInt32(Enumaretion.DBEnumType.SourceType);
            ViewBag.SourceList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });
            enumDBType          = Convert.ToInt32(Enumaretion.DBEnumType.ProductType);
            ViewBag.ProductList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });
            enumDBType         = Convert.ToInt32(Enumaretion.DBEnumType.ActionType);
            ViewBag.ActionList = oDBContext.CCACTIONMAPs.Where(p => p.ROLEID == oCurrentUser.EMPLOYEEROLEID && p.MEMOTYPEID == oCCMEMOMASTER.MEMOTYPE && p.ISACTIVE == true).Select(x => x.CCENUMERATION).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });
            oCCMEMOMASTER.ASSIGNGROUP = oCurrentUser.GROUPID;
            ViewBag.AssignGroupList   = oDBContext.CCGROUPs.Where(t => t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value    = x.ID.ToString(),
                Text     = x.GROUPNAME.ToString(),
                Selected = true,
            });
            return(PartialView("_createFrmPartial", oCCMEMOMASTER));
        }
        public ActionResult EditTaskMemo(int id)
        {
            RemoveOverTimeOccupiedToken();
            oCurrentUser = (CCUSER)Session["User"];
            int          enumDBType    = 0;
            CCMEMOMASTER oCCMEMOMASTER = null;

            using (var transactionScope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                IsolationLevel = System.Transactions.IsolationLevel.RepeatableRead
            }))
            {
                oCCMEMOMASTER = oDBContext.CCMEMOMASTERs.FirstOrDefault(t => t.ID == id);
                oCCMEMOMASTER.LASTACTIONDETAILS = string.Empty;
                oCCMEMOMASTER.LASTACTIONTYPE    = null;
            }
            enumDBType = Convert.ToInt32(Enumaretion.DBEnumType.StatusType);

            var StatusList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).ToList();

            if (!oCurrentUser.CCROLE.ROLENAME.ToLower().Contains("admin") && !oCurrentUser.CCROLE.ROLENAME.ToLower().Contains("maker") && !oCurrentUser.CCROLE.ROLENAME.ToLower().Contains("checker"))
            {
                StatusList.RemoveAt(StatusList.FindIndex(t => t.NAME.ToLower() == "close"));
            }

            ViewBag.StatusList = StatusList.Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.VALUE.ToString(),
                Text  = x.NAME.ToString()
            });;

            enumDBType         = Convert.ToInt32(Enumaretion.DBEnumType.ActionType);
            ViewBag.ActionList = oDBContext.CCACTIONMAPs.Where(p => p.ROLEID == oCurrentUser.EMPLOYEEROLEID && p.MEMOTYPEID == oCCMEMOMASTER.MEMOTYPE && p.ISACTIVE == true).Select(x => x.CCENUMERATION).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });
            oCCMEMOMASTER.ASSIGNGROUP = oCurrentUser.GROUPID;
            ViewBag.AssignGroupList   = oDBContext.CCGROUPs.Where(t => t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value    = x.ID.ToString(),
                Text     = x.GROUPNAME.ToString(),
                Selected = true,
            });
            TaskInfo oTaskInfo = new TaskInfo();

            oTaskInfo.CCMEMO = oCCMEMOMASTER;
            if (IsTokenBusy(oCCMEMOMASTER.ID.ToString()))
            {
                oTaskInfo.IsTaskBusy     = true;
                oTaskInfo.TaskOccupiedBy = oTaskTakenList.Find(t => t.TokenId == oCCMEMOMASTER.ID.ToString());
            }
            else
            {
                oTaskInfo.IsTaskBusy = false;
                AddOccupiedTask(oCurrentUser, oCCMEMOMASTER.ID.ToString());
            }

            return(PartialView("_taskFrmPartial", oTaskInfo));
        }
Exemplo n.º 3
0
        public ActionResult SubmitMemo(CCMEMOMASTER objMemoBind, List <HttpPostedFileBase> ctrlFile)
        {
            try
            {
                oCurrentUser = (CCUSER)Session["User"];
                if (ModelState.IsValid)
                {
                    objMemoBind.ISACTIVE  = true;
                    objMemoBind.CREATEDBY = oCurrentUser.ID;
                    objMemoBind.CREATEDON = DateTime.Now;
                    oDBContext.CCMEMOMASTERs.Add(objMemoBind);
                    oDBContext.SaveChanges();

                    CCMEMOLOG oCCMEMOLOG = new CCMEMOLOG();
                    oCCMEMOLOG.MEMOMASTERID  = objMemoBind.ID;
                    oCCMEMOLOG.ACTEDBY       = oCurrentUser.ID;
                    oCCMEMOLOG.ACTIONTYPE    = objMemoBind.LASTACTIONTYPE.Value;
                    oCCMEMOLOG.ACTIONDETAILS = objMemoBind.LASTACTIONDETAILS;
                    oCCMEMOLOG.ASSIGNGROUP   = objMemoBind.ASSIGNGROUP.Value;

                    oCCMEMOLOG.ISACTIVE  = true;
                    oCCMEMOLOG.CREATEDBY = oCurrentUser.ID;
                    oCCMEMOLOG.CREATEDON = DateTime.Now;

                    oDBContext.CCMEMOLOGs.Add(oCCMEMOLOG);
                    oDBContext.SaveChanges();

                    var uploadFiles = Request.Files;

                    if (ctrlFile != null && ctrlFile.Count > 0)
                    {
                        foreach (HttpPostedFileBase oFile in ctrlFile)
                        {
                            if (oFile != null && oFile.ContentLength > 0)
                            {
                                var fileName = Path.GetFileName(oFile.FileName);
                                var path     = Path.Combine(Server.MapPath("~/UploadDoc/"), objMemoBind.TICKETNO + "_" + fileName);
                                oFile.SaveAs(path);

                                CCMEMOATTACHMENT oCCMEMOATTACHMENT = new CCMEMOATTACHMENT();
                                oCCMEMOATTACHMENT.MEMOMASTERID = objMemoBind.ID;
                                oCCMEMOATTACHMENT.FILENAME     = objMemoBind.TICKETNO + "_" + fileName;
                                oCCMEMOATTACHMENT.FILEPATH     = path;

                                oCCMEMOATTACHMENT.CREATEDBY = oCurrentUser.ID;
                                oCCMEMOATTACHMENT.CREATEDON = DateTime.Now;

                                oDBContext.CCMEMOATTACHMENTs.Add(oCCMEMOATTACHMENT);
                                oDBContext.SaveChanges();
                            }
                        }
                    }
                    //oDBContext.SaveChanges();
                    TempData["SuccessMsg"] = "Data Saved Successfully.";
                }
            }
            catch (DbEntityValidationException ex)
            {
                var errorMessages = ex.EntityValidationErrors
                                    .SelectMany(x => x.ValidationErrors)
                                    .Select(x => x.ErrorMessage);
                TempData["ErrorMsg"] = "Data is not saved due to " + ExceptionMsg(ex);
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public ActionResult EditMemo(int id)
        {
            oCurrentUser = (CCUSER)Session["User"];
            int          enumDBType    = 0;
            CCMEMOMASTER oCCMEMOMASTER = new CCMEMOMASTER();

            enumDBType = Convert.ToInt32(Enumaretion.DBEnumType.FormType);
            long InboundType = oDBContext.CCENUMERATIONs.FirstOrDefault(x => x.TYPE == enumDBType && x.NAME.ToLower().Contains("inbound") && x.ISACTIVE == true).ID;

            oCCMEMOMASTER.TICKETNO = DateTime.Now.ToString("yyMMddhhmmssfff");
            oCCMEMOMASTER.MEMOTYPE = InboundType;
            enumDBType             = Convert.ToInt32(Enumaretion.DBEnumType.StatusType);
            ViewBag.StatusList     = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value    = x.VALUE.ToString(),
                Text     = x.NAME.ToString(),
                Selected = true
            });

            enumDBType           = Convert.ToInt32(Enumaretion.DBEnumType.FormType);
            ViewBag.MemoTypeList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });
            enumDBType           = Convert.ToInt32(Enumaretion.DBEnumType.PriorityType);
            ViewBag.PriorityList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });

            ViewBag.CallCatagoryList = oDBContext.CCCALLCATAGORies.Where(t => t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });

            enumDBType         = Convert.ToInt32(Enumaretion.DBEnumType.SourceType);
            ViewBag.SourceList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });
            enumDBType          = Convert.ToInt32(Enumaretion.DBEnumType.ProductType);
            ViewBag.ProductList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });
            if (oCurrentUser.CCROLE.ROLENAME.ToLower().Contains("maker"))
            {
                enumDBType = Convert.ToInt32(Enumaretion.DBEnumType.InboundActionTypeMaker);
            }
            else if (oCurrentUser.CCROLE.ROLENAME.ToLower().Contains("check"))
            {
                enumDBType = Convert.ToInt32(Enumaretion.DBEnumType.InboundActionTypeChecker);
            }
            else
            {
                enumDBType = Convert.ToInt32(Enumaretion.DBEnumType.InboundActionTypeOther);
            }
            ViewBag.ActionList = oDBContext.CCENUMERATIONs.Where(t => t.TYPE == enumDBType && t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });
            oCCMEMOMASTER.ASSIGNGROUP = oCurrentUser.GROUPID;
            ViewBag.AssignGroupList   = oDBContext.CCGROUPs.Where(t => t.ISACTIVE).Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value    = x.ID.ToString(),
                Text     = x.GROUPNAME.ToString(),
                Selected = true,
            });
            return(PartialView("_createFrmPartial", oCCMEMOMASTER));
        }