コード例 #1
0
 //下拉式選單讀任務類別
 public JsonResult GetEventClassRead(string type)
 {
     var db = new NSMMSEntities();
     var temp = eventClassRespository.ReadEventClassList().ToList();
     if(type == "1")
         temp.Add(new EventClassViewModel { Class = "C01&M01", Name = "C01 : 叫修 + M01 : 保養" });
     
     //return Json(db.EventClass.Select(p => new { Name = p.Name, Class = p.Class }), JsonRequestBehavior.AllowGet);
     return Json(temp.AsQueryable().Select(p => new { Name = p.Name, Class = p.Class }).OrderBy(x => x.Name), JsonRequestBehavior.AllowGet);
 }
コード例 #2
0
        public JsonResult GetKnowledgeList()
        {
            var db = new NSMMSEntities();

            return Json(db.KnowledgeBase.Select(p => new { KnowledgeID = p.KnowledgeID, Name = p.FileName }), JsonRequestBehavior.AllowGet);
        }
コード例 #3
0
        //////
        //手機零件選擇(改外部篩選)
        public JsonResult GetMaterialList(string str)
        {
            var db = new NSMMSEntities();
            var temp = db.ProductData.Select(p => new { ProductNum = p.ProductNum, Name = p.Name + " - " + p.ProductID });
            if (str != null && str != "")
                temp = temp.Where(x => x.Name.Contains(str));

            var jsonResult = Json(temp, JsonRequestBehavior.AllowGet);
            jsonResult.MaxJsonLength = int.MaxValue;
            return jsonResult;
            //return Json(db.ProductData.Select(p => new { ProductNum = p.ProductNum, Name = p.Name }), JsonRequestBehavior.AllowGet);
        }
コード例 #4
0
        //下拉式選單讀大區分類
        public JsonResult GetAreaRead()
        {
            var db = new NSMMSEntities();

            return Json(db.Area.Select(p => new { Name = p.Name, AreaID = p.AreaID }), JsonRequestBehavior.AllowGet);
        }
コード例 #5
0
 public FilesRepository()
 {
     this.db = new NSMMSEntities();
 }
コード例 #6
0
 public ContractRespositiory()
 {
     this.db = new NSMMSEntities();
 }
コード例 #7
0
 public AlertSettingRepository()
 {
     this.db = new NSMMSEntities();
 }
コード例 #8
0
 public RoleRespositiory()
 {
     this.db = new NSMMSEntities();
 }
コード例 #9
0
        public JsonResult GetPhrase()
        {
            var db = new NSMMSEntities();

            return Json(db.QuestionPhrase.Select(p => new { Note = p.Note }), JsonRequestBehavior.AllowGet);
        }
コード例 #10
0
 public JsonResult GetCustomerDetail(int CRef)
 {
     var db = new NSMMSEntities();
     CustomerViewModel t = new CustomerViewModel();
     t = db.Customer.Where(x => x.CustomerRef == CRef).Select(c => new CustomerViewModel
     {
         CustomerStatus = c.CustomerStatus,
         CustomerRef = c.CustomerRef,
         FullName = c.FullName,
         ShortName = c.ShortName,
         PostalCode = c.PostalCode,
         Addr = c.Addr,
         Phone1 = c.Phone1,
         Phone2 = c.Phone2,
         Fax = c.Fax,
         ContactPersonName = c.ContactPersonName,
         ContactPersonPhone = c.ContactPersonPhone,
         UniformNumbers = c.UniformNumbers,
         Notes = c.Notes,
         GroupSW = c.GroupSW,
         GroupID = c.GroupID,
         BranchID = c.BranchID,
         ResponsibleID = c.ResponsibleID,
         RegionID = c.RegionID,
         DefaultUserName = c.SubArea.ResponsibleClass.UserData2.UserName
     }).First();            
     
     var jsonResult = Json(t, JsonRequestBehavior.AllowGet);
     jsonResult.MaxJsonLength = int.MaxValue;
     return jsonResult;
     //return Json(lookupList, JsonRequestBehavior.AllowGet);
 }
コード例 #11
0
        //public JsonResult GetCustomers()
        //{
        //    var db = new NSMMSEntities();

        //    return Json(db.Customer.Select(c => new { CustomerID = c.CustomerID, CustomerSName = c.ShortName }), JsonRequestBehavior.AllowGet);
        //}

        //public JsonResult GetCustomerList(string CGroupSW, string CGroupID, string Area)
        //{
        //    var db = new NSMMSEntities();
        //    var lookupList = new List<CustomerViewModel>();
        //    var qry = db.Customer.Where(x => x.CustomerRef != 0 && x.CustomerStatus != "0");
        //    if (CGroupSW != null && CGroupSW != "")
        //    {
        //        qry = qry.Where(x => x.GroupSW == CGroupSW && x.GroupID != null);
        //    }

        //    if (CGroupID != null && CGroupID != "")
        //    {
        //        qry = qry.Where(x => x.GroupID == CGroupID);
        //    }

        //    if (Area != null && Area != "")
        //    {
        //        qry = qry.Where(x => x.SubArea.AreaID == Area);
        //    }


        //    lookupList = qry.Select(c => new CustomerViewModel
        //    {
        //        CustomerStatus = c.CustomerStatus,
        //        CustomerRef = c.CustomerRef,
        //        FullName = c.FullName,
        //        ShortName = c.ShortName,
        //        PostalCode = c.PostalCode,
        //        Addr = c.Addr,
        //        Phone1 = c.Phone1,
        //        Phone2 = c.Phone2,
        //        Fax = c.Fax,
        //        ContactPersonName = c.ContactPersonName,
        //        ContactPersonPhone = c.ContactPersonPhone,
        //        UniformNumbers = c.UniformNumbers,
        //        Notes = c.Notes,
        //        GroupSW = c.GroupSW,
        //        GroupID = c.GroupID,
        //        BranchID = c.BranchID,
        //        ResponsibleID = c.ResponsibleID,
        //        RegionID = c.RegionID,
        //        DefaultUserName = c.SubArea.ResponsibleClass.UserData2.UserName
        //    }).ToList();
        //    lookupList.Where(w => w.CustomerStatus == "0").ToList().ForEach(s => s.ShortName += " - 停用");
        //    //foreach (var item in lookupList)
        //    //    if (item.CustomerStatus == "0") 
        //    //        item.ShortName += "-停用";
        //    var jsonResult = Json(lookupList.OrderBy(x => x.ShortName), JsonRequestBehavior.AllowGet);
        //    jsonResult.MaxJsonLength = int.MaxValue;
        //    return jsonResult;
        //    //return Json(lookupList, JsonRequestBehavior.AllowGet);
        //}

        public JsonResult GetCustomerList(string CGroupSW, string CGroupID, string Area)
        {
            var db = new NSMMSEntities();
            var lookupList = new List<CustomerViewModel2>();
            var qry = db.Customer.Where(x => x.CustomerRef != 0 && x.CustomerStatus != "0");
            if (CGroupSW != null && CGroupSW != "")
            {
                qry = qry.Where(x => x.GroupSW == CGroupSW && x.GroupID != null);
            }

            if (CGroupID != null && CGroupID != "")
            {
                qry = qry.Where(x => x.GroupID == CGroupID);
            }

            if (Area != null && Area != "")
            {
                qry = qry.Where(x => x.SubArea.AreaID == Area);
            }
            

            lookupList = qry.Select(c => new CustomerViewModel2
                    {
                        CustomerStatus = c.CustomerStatus,
                        CustomerRef = c.CustomerRef,
                        //FullName = c.FullName,
                        ShortName = c.ShortName,
                    }).ToList();
            lookupList.Where(w => w.CustomerStatus == "0").ToList().ForEach(s => s.ShortName += " - 停用");
            //foreach (var item in lookupList)
            //    if (item.CustomerStatus == "0") 
            //        item.ShortName += "-停用";
            var jsonResult = Json(lookupList.OrderBy(x=>x.ShortName), JsonRequestBehavior.AllowGet);
            jsonResult.MaxJsonLength = int.MaxValue;
            return jsonResult;
        //return Json(lookupList, JsonRequestBehavior.AllowGet);
        }
コード例 #12
0
        public JsonResult GetCascadeQuestions(int? item)
        {
            var db = new NSMMSEntities();
            var questionClass = db.QuestionClass.AsQueryable();

            if (item != null)
            {
                questionClass = questionClass.Where(q => q.ItemClassID == item);
            }

            return Json(questionClass.Select(q => new { QuestionID = q.QuestionClassID, QuestionName = q.Note }), JsonRequestBehavior.AllowGet);
        }
コード例 #13
0
        public JsonResult GetCascadeItems(int? product)
        {
            var db = new NSMMSEntities();
            var itemClass = db.ItemClass.AsQueryable();

            if (product != null)
            {
                itemClass = itemClass.Where(i => i.ProductClassID == product);
            }

            return Json(itemClass.Select(i => new { ItemID = i.ItemClassID, ItemName = i.Note }), JsonRequestBehavior.AllowGet);
        }
コード例 #14
0
        public JsonResult GetCascadeProducts()
        {
            var db = new NSMMSEntities();

            return Json(db.ProductClass.Select(p => new { ProductID = p.ProductClassID, ProductName = p.Note }), JsonRequestBehavior.AllowGet);
        }
コード例 #15
0
        //取得合約產品
        public JsonResult GetProductID()
        {
            var db = new NSMMSEntities();

            return Json(db.ProductData.Where(x=>x.ProductClassID != null).Select(p => new { ProductID = p.ProductID, ProductName = p.Name }), JsonRequestBehavior.AllowGet);
        }
コード例 #16
0
 public AssignSettingRepository()
 {
     this.db = new NSMMSEntities();
 }
コード例 #17
0
 public QuestionRespositiory()
 {
     this.db = new NSMMSEntities();
 }
コード例 #18
0
        public JsonResult GetCCProduct(string CustomerRef)
        {
            var db = new NSMMSEntities();

            var jsonResult = Json(contractRespositiory.ReadProduct(CustomerRef), JsonRequestBehavior.AllowGet);
            jsonResult.MaxJsonLength = int.MaxValue;
            return jsonResult;
            //return Json(db.ProductClass.Select(p => new { ProductID = p.ProductClassID, ProductName = p.Note }), JsonRequestBehavior.AllowGet);
        }
コード例 #19
0
 public EventClassRespository()
 {
     this.db = new NSMMSEntities();
 }
コード例 #20
0
        //以下為工作任務指派管理頁面
        public ActionResult WBSAssignMain(string area, string cid, string data)
        {
            if (!User.Identity.IsAuthenticated)
                return RedirectToAction("Logon", "Account");

            // 先取得該使用者的 FormsIdentity
            FormsIdentity id = (FormsIdentity)User.Identity;
            // 再取出使用者的 FormsAuthenticationTicket
            FormsAuthenticationTicket ticket = id.Ticket;

            String roleID = userDataRepository.GetUserRole(ticket.Name);

            if (!roleToMFucRespositiory.CheckedRoleFunction(roleID, 400))
                return RedirectToAction("MainPage", "Home");

            ViewBag.RoleID = roleID;
            if (Session["removeMenuButton"] == null)
                Session.Add("removeMenuButton", roleToMFucRespositiory.GetRemoveButtonName(roleID));
            ViewBag.RemoveMenu = Session["removeMenuButton"];

            ViewBag.area = area;
            ViewBag.cid = cid;
            ViewBag.data = data;
            NSMMSEntities db = new NSMMSEntities();

            List<PageRemarkViewModel> list = new List<PageRemarkViewModel>();
            list.Add(pageRemarkRespositiory.Read(17));
            ViewData["PageRemark"] = list;

            return View(db.Area);  
            //return View();
        }
コード例 #21
0
 public PageRemarkRespositiory()
 {
     this.db = new NSMMSEntities();
 }
コード例 #22
0
 public MessageRepository()
 {
     this.db = new NSMMSEntities();
 }
コード例 #23
0
 public AreaRespositiory()
 {
     this.db = new NSMMSEntities();
 }
コード例 #24
0
 public ResponsibleClassRespositiory()
 {
     this.db = new NSMMSEntities();
 }
コード例 #25
0
 //下拉式選單讀任務類別
 public JsonResult GetEventClassRead()
 {
     var db = new NSMMSEntities();
     
     //return Json(db.EventClass.Select(p => new { Name = p.Name, Class = p.Class }), JsonRequestBehavior.AllowGet);
     return Json(eventClassRespository.ReadEventClassList().Select(p => new { Name = p.Name, Class = p.Class }), JsonRequestBehavior.AllowGet);
 }
コード例 #26
0
 public SystemUseRepository()
 {
     this.db = new NSMMSEntities();
 }
コード例 #27
0
 public UserLocationRepositiory()
 {
     this.db = new NSMMSEntities();
 }
コード例 #28
0
 public SystemSettingRepository()
 {
     this.db = new NSMMSEntities();
 }
コード例 #29
0
 public WBSEventRepository()
 {
     this.db = new NSMMSEntities();
 }
コード例 #30
0
 public UserDataRepository()
 {
     this.db = new NSMMSEntities();
 }