コード例 #1
0
ファイル: LssController.cs プロジェクト: war-man/TCDMS
        public ActionResult Update(LssUpdateDTO dto)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;

            dto.UserInfo = lng.UserInfo();
            if (!dto.EffectDate.HasValue)
            {
                dto.EffectDate = DateTime.Now;
            }
            dto.AttachmentIDs = new List <LssAttachmentDTO>();
            HttpContext.Request.Files.AllKeys.Select(key => HttpContext.Request.Files[key]).Where(p => !string.IsNullOrEmpty(p.FileName)).ToList().ForEach(p =>
            {
                var att = new LssAttachmentDTO
                {
                    AttachmentID   = Guid.NewGuid(),
                    AttachmentName = p.FileName,
                    AttachmentSize = p.ContentLength,
                };
                p.SaveAs(Const.RealLssPath(att.AttachmentID.ToString()));
                dto.AttachmentIDs.Add(att);
            });

            var result = _LssService.Update(dto);

            return(new JsonResult(result));
        }
コード例 #2
0
        public ActionResult Distributors()
        {
            UserLoginDTO lng    = Session["UserLoginInfo"] as UserLoginDTO;
            var          result = FcpaProvider.Distributors(lng.UserInfo());

            return(new JsonResult(result));
        }
コード例 #3
0
        public ActionResult Update(RegisterUpdateDTO dto)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;

            dto.UserInfo      = lng.UserInfo();
            dto.AttachmentIDs = new List <RegisterAttachmentDTO>();
            HttpContext.Request.Files.AllKeys.Select(key => HttpContext.Request.Files[key]).Where(p => !string.IsNullOrEmpty(p.FileName)).ToList().ForEach(p =>
            {
                var att = new RegisterAttachmentDTO
                {
                    AttachmentID   = Guid.NewGuid(),
                    AttachmentName = p.FileName,
                    AttachmentSize = p.ContentLength,
                };
                p.SaveAs(Const.RealRegisterPath(att.AttachmentID.ToString()));
                dto.AttachmentIDs.Add(att);
            });

            var pt = ProductManagementProvider.GetProductType(dto.ProductTypeID.Value);
            var pr = ProductManagementProvider.GetOneProductLine(dto.ProductLineID.Value);

            dto.ProductLineName = pr.Object.ProductLineName;
            dto.ProductTypeName = pt.Object.ProductTypeName;
            var result = _RegisterService.Update(dto);

            return(new JsonResult(result));
        }
コード例 #4
0
ファイル: LssController.cs プロジェクト: war-man/TCDMS
        public ActionResult UnFavorite(Guid id)
        {
            UserLoginDTO lng    = Session["UserLoginInfo"] as UserLoginDTO;
            var          result = _LssService.UnFavorite(lng.UserInfo(), id);

            return(new JsonResult(result));
        }
コード例 #5
0
        public ActionResult Query(FcpaSearchDTO dto)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;

            dto.UserInfo = lng.UserInfo();
            var result = FcpaProvider.Query(dto);

            return(new JsonResult(result));
        }
コード例 #6
0
ファイル: LssController.cs プロジェクト: war-man/TCDMS
        public ActionResult Query(LssSearchDTO dto)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;

            dto.UserInfo = lng.UserInfo();
            var result = _LssService.Query(dto);

            return(new JsonResult(result));
        }
コード例 #7
0
ファイル: LssController.cs プロジェクト: war-man/TCDMS
        public ActionResult DeleteTag(int tagID)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;
            DocumentDTO  dto = new DocumentDTO {
                UserInfo = lng.UserInfo()
            };
            var result = _LssService.DeleteTag(tagID);

            return(new JsonResult(result));
        }
コード例 #8
0
ファイル: LssController.cs プロジェクト: war-man/TCDMS
        public ActionResult RenameTag(int tagID, string tagName)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;
            DocumentDTO  dto = new DocumentDTO {
                UserInfo = lng.UserInfo()
            };
            var result = _LssService.RenameTag(tagID, tagName);

            return(new JsonResult(result));
        }
コード例 #9
0
ファイル: LssController.cs プロジェクト: war-man/TCDMS
        public ActionResult AddSiblingTag(int?tagID, int?productLineID, string tagName)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;
            DocumentDTO  dto = new DocumentDTO {
                UserInfo = lng.UserInfo()
            };
            var result = _LssService.AddSiblingTag(tagID, productLineID, tagName);

            return(new JsonResult(result));
        }
コード例 #10
0
ファイル: LssController.cs プロジェクト: war-man/TCDMS
        public ActionResult ProductLine()
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;
            DocumentDTO  dto = new DocumentDTO {
                UserInfo = lng.UserInfo()
            };
            var result = _LssService.ProductLine(dto);

            return(new JsonResult(new List <RootNode> {
                result
            }));
        }
コード例 #11
0
ファイル: LssController.cs プロジェクト: war-man/TCDMS
        public ActionResult Download(Guid lssID, Guid[] attIDs)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;

            var lss = _LssService.Get(lssID);

            if (lss == null)
            {
                return(HttpNotFound());
            }
            if (attIDs.Length > 1)
            {
                var     temp    = Path.GetTempFileName();
                ZipFile zipFile = ZipFile.Create(temp);
                zipFile.BeginUpdate();
                lss.Attachments.Where(p => attIDs.Contains(p.AttachmentID)).ToList().ForEach(att =>
                {
                    var file = Const.RealLssPath(att.AttachmentID.ToString());
                    if (System.IO.File.Exists(file))
                    {
                        zipFile.Add(file, att.AttachmentName);
                    }
                });
                zipFile.CommitUpdate();
                zipFile.Close();
                _LssService.Download(lng.UserInfo(), attIDs);
                return(File(temp, "application/octet-stream", lss.Title + ".zip"));
            }
            else
            {
                var att = lss.Attachments.Where(p => attIDs.Contains(p.AttachmentID)).FirstOrDefault();
                if (att == null)
                {
                    return(HttpNotFound());
                }
                var file = Const.RealLssPath(att.AttachmentID.ToString());
                _LssService.Download(lng.UserInfo(), attIDs);
                return(File(file, "application/octet-stream", att.AttachmentName));
            }
        }
コード例 #12
0
        public ActionResult ProductType()
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;
            DocumentDTO  dto = new DocumentDTO {
                UserInfo = lng.UserInfo()
            };
            var result = _RegisterService.ProductType();

            result.Add(new ProductTypeResultDTO {
                ProductTypeID = 0, ProductTypeName = "全部"
            });
            return(new JsonResult(result));
        }
コード例 #13
0
ファイル: DetailsController.cs プロジェクト: war-man/TCDMS
        public ActionResult Export(FcpaSearchDTO dto)
        {
            dto.rows = int.MaxValue;
            dto.page = 1;
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;

            dto.UserInfo = lng.UserInfo();
            var result = FcpaProvider.Query(dto);

            var headers = new List <ExcelHeaderModel>()
            {
                new ExcelHeaderModel {
                    Header = "经销商", PropertyName = "DistributorName", Width = 40
                },
                new ExcelHeaderModel {
                    Header = "姓名", PropertyName = "Name", Width = 15
                },
                new ExcelHeaderModel {
                    Header = "部门", PropertyName = "Department", Width = 15
                },
                new ExcelHeaderModel {
                    Header = "职位", PropertyName = "Title", Width = 15
                },
                new ExcelHeaderModel {
                    Header = "培训状态", PropertyName = "StatusDesc", Width = 10
                },
                new ExcelHeaderModel {
                    Header = "培训完成日期", PropertyName = "CompletedDate", Width = 22
                },
                new ExcelHeaderModel {
                    Header = "在职状态", PropertyName = "OffWorkDesc", Width = 22
                },
                new ExcelHeaderModel {
                    Header = "所属领域", PropertyName = "DomainDesc", Width = 22
                },
                new ExcelHeaderModel {
                    Header = "更新日期", PropertyName = "UpdateDate", Width = 22
                },
                new ExcelHeaderModel {
                    Header = "过期日期", PropertyName = "ExpireDate", Width = 10
                },
                new ExcelHeaderModel {
                    Header = "备注", PropertyName = "Remark", Width = 10
                }
            };
            var buffer = result.rows.ToExcel(headers);

            return(File(buffer, "application/vnd.ms-excel", string.Format("FCPA Training Record List({0}).xlsx", DateTime.Now.ToString("yyyyMMddHHmmss"))));
        }
コード例 #14
0
ファイル: AlermController.cs プロジェクト: war-man/TCDMS
        public ActionResult Export(AlermSearchDTO dto)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;

            dto.UserInfo = lng.UserInfo();
            dto.rows     = int.MaxValue;
            dto.page     = 1;
            var result = AlermdProvider.Query(dto);

            var headers = new List <ExcelHeaderModel>()
            {
                new ExcelHeaderModel {
                    Header = "用户代号", PropertyName = "UserCode", Width = 15
                },
                new ExcelHeaderModel {
                    Header = "用户名称", PropertyName = "FullName", Width = 15
                },
                new ExcelHeaderModel {
                    Header = "手机号", PropertyName = "PhoneNumber", Width = 15
                },
                new ExcelHeaderModel {
                    Header = "邮箱", PropertyName = "Email", Width = 15
                },
                new ExcelHeaderModel {
                    Header = "所属领域", PropertyName = "DomainDesc", Width = 10
                },
                new ExcelHeaderModel {
                    Header = "角色", PropertyName = "RoleDesc", Width = 22
                },
                new ExcelHeaderModel {
                    Header = "关联经销商", PropertyName = "RelDistributorDesc", Width = 40
                },
                new ExcelHeaderModel {
                    Header = "提醒日期", PropertyName = "DomainDesc", Width = 22
                },
                new ExcelHeaderModel {
                    Header = "更新日期", PropertyName = "AlarmTime", Width = 22
                }
            };
            var buffer = result.rows.ToExcel(headers);

            return(File(buffer, "application/vnd.ms-excel", string.Format("FCPA Warning List({ 0}).xlsx", DateTime.Now.ToString("yyyyMMddHHmmss"))));
        }
コード例 #15
0
        public ActionResult Export(OrgSearchDTO dto)
        {
            UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO;

            dto.UserInfo = lng.UserInfo();
            dto.rows     = int.MaxValue;
            dto.page     = 1;
            var result = OrgMapProvider.Query(dto);

            var headers = new List <ExcelHeaderModel>()
            {
                new ExcelHeaderModel {
                    Header = "公司", PropertyName = "DistributorName", Width = 40
                },
                new ExcelHeaderModel {
                    Header = "状态", PropertyName = "Status", Width = 10
                },
                new ExcelHeaderModel {
                    Header = "组织架构图更新日期", PropertyName = "OrgMapUpdateTime", Width = 22
                },
                new ExcelHeaderModel {
                    Header = "培训人员名单更新日期", PropertyName = "TrainsUpdateTime", Width = 22
                },
                new ExcelHeaderModel {
                    Header = "应参与培训的人员人数", PropertyName = "ValidNum", Width = 25
                },
                new ExcelHeaderModel {
                    Header = "实际证书效期内的人员人数", PropertyName = "ShouldNum", Width = 25
                },
                new ExcelHeaderModel {
                    Header = "完成率", PropertyName = "Rate", Width = 10
                }
            };
            var buffer = result.rows.ToExcel(headers);

            return(File(buffer, "application/vnd.ms-excel", string.Format("FCPA Training Record List({0}).xlsx", DateTime.Now.ToString("yyyyMMddHHmmss"))));
        }