Example #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="service"></param>
 /// <param name="http"></param>
 /// <param name="mapper"></param>
 /// <param name="logger"></param>
 public StageController(IStageService service, IHttpContextAccessor http, IMapper mapper, ILogger <StageController> logger)
 {
     _service = service;
     _http    = http;
     _mapper  = mapper;
     _logger  = logger;
 }
Example #2
0
        public StageCommand(IStageService stage)
        {
            this.stage = stage ?? throw new ArgumentNullException(nameof(stage));

            RegisterQuery(StageQueries.STATUS, Status);
            RegisterQuery(StageQueries.FETCH, Fetch);
            RegisterQuery(StageQueries.ADD, Add);
            RegisterQuery(StageQueries.REMOVE, Remove);
            RegisterQuery(StageQueries.CLEAR, Clear);
        }
Example #3
0
        public FileManagerCommand(IStageService stageService, IStashService stashService, ILogService logger)
        {
            this.stageService = stageService ?? throw new ArgumentNullException(nameof(stageService));
            this.stashService = stashService ?? throw new ArgumentNullException(nameof(stashService));
            this.logger       = logger;

            RegisterQuery(StageQueries.STAGE, new StageCommand(stageService));
            RegisterQuery(StashQueries.STASH, new StashCommand(stashService, stageService));
            RegisterQuery(ApplyQueries.APPLY, new ApplyCommand(stageService, stashService, logger));
        }
Example #4
0
 public StagesController(
     ArtaplanContext context,
     IMapper mapper,
     IStageService stageService
     )
 {
     _mapper       = mapper;
     _context      = context;
     _stageService = stageService;
 }
Example #5
0
 public DownloadController(UserManager <ApplicationUser> userManager,
                           ICertificateRepository repository,
                           IStringLocalizer <SharedResource> localizer,
                           IStageService stage,
                           IWebHostEnvironment appEnvironment)
 {
     _userManager    = userManager;
     _repository     = repository;
     _localizer      = localizer;
     _stage          = stage;
     _appEnvironment = appEnvironment;
 }
 public PublicViewModelService(ICachedPublicViewModelService cacheService,
                               IStringLocalizer <SharedResource> localizer,
                               IStageService stageService,
                               IFilterService filterService,
                               IPageService pageService)
 {
     _cacheService  = cacheService;
     _localizer     = localizer;
     _stageService  = stageService;
     _filterService = filterService;
     _pageService   = pageService;
 }
Example #7
0
        public StageCommand(IStageService stage)
        {
            this.stage = stage ?? throw new ArgumentNullException(nameof(stage));

            RegisterQuery(StageQueries.STATUS, Status);
            RegisterQuery(StageQueries.LIST, List);
            RegisterQuery(StageQueries.ADD, Add);
            RegisterQuery(StageQueries.REMOVE, Remove);
            RegisterQuery(StageQueries.LOBBY, Lobby);
            RegisterQuery(StageQueries.REMOVE_LOBBY, RemoveLobby);
            RegisterQuery(StageQueries.CLEAR, Clear);
        }
Example #8
0
 public StageController(IUnitOfWork unitOfWork,
                        IStageService stageService,
                        IApplicationRoleManager roleManager,
                        IUserService userService,
                        ILogService logService,
                        IUnivercityStructureService univercityStructure)
 {
     _unitOfWork          = unitOfWork;
     _stageService        = stageService;
     _roleManager         = roleManager;
     _userService         = userService;
     _univercityStructure = univercityStructure;
     _logService          = logService;
 }
Example #9
0
        public ApplyCommand(IStageService stage, IStashService stashes, ILogService logger)
        {
            this.stage   = stage ?? throw new ArgumentNullException(nameof(stage));
            this.stashes = stashes ?? throw new ArgumentNullException(nameof(stashes));
            this.logger  = logger;

            RegisterQuery(ApplyQueries.COPY, new CopyCommand(stage, stashes, logger));
            RegisterQuery(ApplyQueries.MOVE, new MoveCommand(stage, stashes, logger));
            //RegisterQuery(ApplyQueries.RENAME, new RenameCommand());
            RegisterQuery(ApplyQueries.DELETE, new DeleteCommand(stage, stashes, logger));
            RegisterQuery(ApplyQueries.SEARCH, new ContentSearchCommand(stage, stashes, logger));
            //RegisterQuery(ApplyQueries.REPLACE, new ContentReplaceCommand());
            RegisterQuery(ApplyQueries.ARCHIVE, new ArchiveCommand(stage, stashes, logger));
        }
 public CertificateViewModelService(ICertificateRepository repository,
                                    IStringLocalizer <SharedResource> localizer,
                                    ICachedPublicViewModelService cacheService,
                                    IStageService stageService,
                                    IFilterService filterService,
                                    IPageService pageService)
 {
     _repository    = repository;
     _localizer     = localizer;
     _cacheService  = cacheService;
     _stageService  = stageService;
     _filterService = filterService;
     _pageService   = pageService;
 }
Example #11
0
        public StashCommand(IStashService stashes, IStageService stage)
        {
            this.stashes = stashes;
            this.stage   = stage;

            RegisterQuery(StashQueries.LIST, List);
            RegisterQuery(StashQueries.SHOW, Show);
            RegisterQuery(StashQueries.PUSH, Push);
            RegisterQuery(StashQueries.APPLY, Apply);
            RegisterQuery(StashQueries.PEEK, Peek);
            RegisterQuery(StashQueries.POP, Pop);
            RegisterQuery(StashQueries.DROP, Drop);
            RegisterQuery(StashQueries.CLEAR, Clear);
        }
Example #12
0
        public NugetManagerCommand(IStageService stage, IManagementService management)
        {
            this.stage      = stage ?? throw new ArgumentNullException(nameof(stage));
            this.management = management ?? throw new ArgumentNullException(nameof(management));

            // Stage (default)
            RegisterQuery(StageQueries.STAGE, new StageCommand(stage));

            // Management
            RegisterQuery(ManageQueries.PROJECT, new ProjectCommand(management.Projects));
            RegisterQuery(ManageQueries.PACKAGE, new PackageCommand(management.Packages, management.Projects));

            // Operations
            RegisterQuery(ApplyQueries.INSTALL, new InstallCommand());
            RegisterQuery(ApplyQueries.UNINSTALL, new UninstallCommand());
            RegisterQuery(ApplyQueries.UPDATE, new UpdateCommand());
        }
Example #13
0
 /// <inheritdoc />
 public GamesController(
     IGameService gameService,
     IStageService stageService,
     ICharacterService characterService,
     ICachingService cachingService,
     IEncryptionService encryptionService,
     IPostService postService,
     IProcessingService processingService,
     IMapper mapper) : base(mapper)
 {
     _gameService       = gameService;
     _characterService  = characterService;
     _stageService      = stageService;
     _characterService  = characterService;
     _cachingService    = cachingService;
     _encryptionService = encryptionService;
     _postService       = postService;
     _processingService = processingService;
 }
 public PgPaymentService(
     EFContext efContext,
     ICostStageRevisionService costStageRevisionService,
     IRuleService ruleService,
     IStageService stageService,
     IPgCurrencyService pgCurrencyService,
     IPgCostSectionTotalsBuilder pgTotalsBuilder,
     IPgCostStageRevisionTotalPaymentsBuilder pgTotalPaymentsBuilder,
     ICustomObjectDataService customObjectDataService
     )
 {
     _efContext = efContext;
     _costStageRevisionService = costStageRevisionService;
     _ruleService             = ruleService;
     _stageService            = stageService;
     _pgCurrencyService       = pgCurrencyService;
     _pgTotalsBuilder         = pgTotalsBuilder;
     _pgTotalPaymentsBuilder  = pgTotalPaymentsBuilder;
     _customObjectDataService = customObjectDataService;
 }
Example #15
0
 internal static bool IsEmpty(this IStageService stage)
 {
     return(stage.GetPaths().Count < 1);
 }
 protected new void Init()
 {
     base.Init();
     _stageService = _diResolver.Resolve <IStageService>();
 }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserId"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                Int32  UserId   = Convert.ToInt32(Session["UserId"].ToString());
                User   user     = IUserService.GetSingle(UserId);
                string userType = Session["UserType"].ToString();
                string userRole = Session["UserRole"].ToString();


                if (Request.QueryString["hdnNumberPerPage"] != "" && Request.QueryString["hdnNumberPerPage"] != null)
                {
                    hdnNumberPerPage.Value = Request.QueryString["hdnNumberPerPage"].ToString();
                }
                if (Request.QueryString["hdnCurrentPageNo"] != "" && Request.QueryString["hdnCurrentPageNo"] != null)
                {
                    hdnCurrentPageNo.Value = Request.QueryString["hdnCurrentPageNo"].ToString();
                }
                if (Request.QueryString["hdnTotalRecordsCount"] != "" && Request.QueryString["hdnTotalRecordsCount"] != null)
                {
                    hdnTotalRecordsCount.Value = Request.QueryString["hdnTotalRecordsCount"].ToString();
                }

                StringBuilder filter = new StringBuilder();
                filter.Append(" join batches b on b.id = s.batch_id ");
                // filter.Append(" and s.status = '1' ");
                filter.Append(" and s.status in (1,9) ");

                List <Branch> branchList = IBranchService.GetDataByFilter(" status='1'", 0, 0, false);

                if (userRole == "Regional Admin")
                {
                    List <Branch> Branches = new List <Branch>();
                    if (user.IsAll == 0)
                    {
                        List <BranchUser> userBranches = IBranchUserService.GetDataByFilter(" user_id = '" + user.Id + "' and status='1'", 0, 0, false);
                        branchList = IBranchService.GetDataByFilter(" ID not in (" + String.Join(",", userBranches.Select(x => x.BranchId).ToArray()) + ")", 0, 0, false);
                    }
                }
                if (userRole == "Branch Admin")
                {
                    if (user.BranchId != 0)
                    {
                        Branch        branch   = IBranchService.GetSingle(user.BranchId);
                        List <Branch> branches = new List <Branch>();
                        branches.Add(branch);
                        branchList = branches;
                    }
                }

                if (userRole == "Regional Admin")
                {
                    filter.Append(" and b.branch_id in (" + String.Join(",", branchList.Select(x => x.Id).ToArray()) + ") ");
                }
                else if (userRole == "Branch Admin")
                {
                    filter.Append(" and b.branch_id in (" + user.BranchId + ") ");
                }

                if (Request.QueryString["IsNewSearch"] != "" && Request.QueryString["IsNewSearch"] != null)
                {
                    IsNewSearch.Value = Request.QueryString["IsNewSearch"].ToString();
                }
                if (IsNewSearch.Value == "1")
                {
                    hdnCurrentPageNo.Value = "";
                }
                if (Request.QueryString["Search"] != "" && Request.QueryString["Search"] != null)
                {
                    Search.Value = Request.QueryString["Search"].ToString();
                    bool isNumber = long.TryParse(Search.Value, out long number);
                    if (isNumber)
                    {
                        Search.Value = number.ToString();
                    }
                    string columnNameAaNo = Converter.GetColumnNameByPropertyName <Set>(nameof(Set.AaNo));
                    filter.Append(" and (s." + columnNameAaNo + " like '%" + Search.Value + "%'");
                    string columnNameAcNo = Converter.GetColumnNameByPropertyName <Set>(nameof(Set.AccountNo));
                    filter.Append(" or s." + columnNameAcNo + " like '%" + Search.Value + "%'");
                    string columnNameBatchNo = Converter.GetColumnNameByPropertyName <Batch>(nameof(Batch.BatchNo));
                    filter.Append(" or b." + columnNameBatchNo + " like '%" + Search.Value + "%')");
                }
                string fromdate = ""; string toDate = "";
                if (!string.IsNullOrEmpty(Request.QueryString["FromDate"]))
                {
                    FromDate.Value = fromdate = Request.QueryString["FromDate"];
                }

                if (!string.IsNullOrEmpty(Request.QueryString["ToDate"]))
                {
                    ToDate.Value = toDate = Request.QueryString["ToDate"];
                }

                if (!string.IsNullOrEmpty(fromdate) && !string.IsNullOrEmpty(toDate))
                {
                    filter.Append("  and s.created_date between '" + fromdate + "' and  '" + toDate + "'");
                }

                int skip = 0, take = 10;
                if (hdnCurrentPageNo.Value == "")
                {
                    skip = 0;
                    take = 10;
                    hdnNumberPerPage.Value     = "10";
                    hdnCurrentPageNo.Value     = "1";
                    hdnTotalRecordsCount.Value = ISetService.GetCountByFilterNew(filter.ToString()).ToString();
                }
                else
                {
                    skip = (Convert.ToInt32(hdnCurrentPageNo.Value) - 1) * 10;
                    take = 10;
                }

                List <Set> objs = ISetService.GetDataByFilterNew(filter.ToString(), skip, take, true);

                StringBuilder asb   = new StringBuilder();
                int           index = 1;
                foreach (Set set in objs)
                {
                    Batch b = IBatchService.GetSingle(set.BatchId);

                    int setsCount      = ISetService.GetCountByFilter(" batch_id='" + b.Id + "'");
                    int scanPagesCount = 0;

                    filter = new StringBuilder();
                    filter.Append(" 1=1");
                    string BatchIdColumnName = Converter.GetColumnNameByPropertyName <BatchLog>(nameof(BatchLog.BatchId));
                    filter.Append(" and " + BatchIdColumnName + " = '" + b.Id + "'");

                    List <BatchLog> batchLogs    = IBatchLogService.GetDataByFilter(filter.ToString(), 0, 0, false);
                    StringBuilder   batchLogHTML = new StringBuilder();
                    foreach (BatchLog batchLog in batchLogs)
                    {
                        batchLogHTML.Append(@"
                                                    <div class='mini-stat clearfix text-left'>
                                                        " + (batchLog.StageId == 1 ?
                                                             @"<span class='mini-stat-icon orange'><i class='fa fa-print'></i></span>" :
                                                             (batchLog.StageId == 2 ?
                                                              "<span class='mini-stat-icon tar'><i class='fa fa-check-square-o'></i></span>" :
                                                              (batchLog.StageId == 3 ?
                                                               "<span class='mini-stat-icon pink'><i class='fa fa-external-link'></i></span>" :
                                                               (batchLog.StageId == 4 ?
                                                                "<span class='mini-stat-icon green'><i class='fa fa-puzzle-piece'></i></span>" :
                                                                (batchLog.StageId == 5 ?
                                                                 "<span class='mini-stat-icon yellow-b'><i class='fa fa-files-o'></i></span>" :
                                                                 (batchLog.StageId == 6 ?
                                                                  "<span class='mini-stat-icon yellow-b'><i class='fa fa-hdd-o'></i></span>" : "")))))) + @"
                                                        <div class='mini-stat-info'>
                                                            " + (batchLog.StageId == 1 ?
                                                                 "<span>Scan</span>" :
                                                                 (batchLog.StageId == 2 ?
                                                                  "<span>Index</span>" :
                                                                  (batchLog.StageId == 3 ?
                                                                   "<span><span>Export</span> <small>To Server</small></span>" :
                                                                   (batchLog.StageId == 4 ?
                                                                    "<span><span>Integrate</span> <small>Sync Control</small></span>" :
                                                                    (batchLog.StageId == 5 ?
                                                                     "<span><span>Release</span> <small>To Mimzy</small></span>" :
                                                                     (batchLog.StageId == 6 ?
                                                                      "<span><span>Document</span> <small>By Mimzy</small></span>" : "")))))) + @"
                                                            " + batchLog.UpdatedDate.ToString("dd/MM/yyyy HH:mm:ss") + @" - <strong>" + batchLog.BatchUser + @"</strong>
                                                        </div>
                                                    </div>
                                ");
                    }
                    BatchLog firstBatchLog = batchLogs.FirstOrDefault();
                    BatchLog lastBatchLog  = batchLogs.LastOrDefault();
                    TimeSpan timeSpan      = lastBatchLog.UpdatedDate.Subtract(firstBatchLog.UpdatedDate);

                    Branch     branch     = IBranchService.GetSingle(b.BranchId);
                    Department department = IDepartmentService.GetSingle(b.DepartmentId);
                    Stage      stage      = IStageService.GetSingle(b.StageId);
                    filter = new StringBuilder();
                    filter.Append(" 1=1");
                    filter.Append(" and " + Converter.GetColumnNameByPropertyName <SetDocument>(nameof(SetDocument.SetId)) + "='" + set.Id + "'");
                    filter.Append(" and " + Converter.GetColumnNameByPropertyName <SetDocument>(nameof(SetDocument.Status)) + "='1'");
                    List <SetDocument> setDocuments     = ISetDocumentService.GetDataByFilter(filter.ToString(), 0, 0, false);
                    StringBuilder      setDocumentsHTML = new StringBuilder();
                    foreach (SetDocument setDocument in setDocuments)
                    {
                        scanPagesCount += setDocument.PageCount;
                        //    string fileName = Path.GetFileName(setDocument.DocumentUrl);
                        //    string localUrl = Server.MapPath("/Content/Files/" + fileName);

                        //    if (!File.Exists(localUrl))
                        //        File.Copy(setDocument.DocumentUrl, localUrl);
                        //    setDocumentsHTML.Append(@"<div style='min-width: 150px;'><a href='/Content/Files/" + fileName + "' target='_blank' data-original-title='Click to view' data-trigger='hover' data-placement='bottom' class='popovers text-info'><strong>" + setDocument.DocType + @"</strong></a> ( <small> pages: <strong>" + setDocument.PageCount + @"</strong></small> )</div>");
                        setDocumentsHTML.Append(@"<div style='min-width: 150px;'><a href='#' data-original-title='Click to view' data-trigger='hover' data-placement='bottom' class='popovers text-info'><strong>" + setDocument.DocType + @"</strong></a> ( <small> pages: <strong>" + setDocument.PageCount + @"</strong></small> )</div>");
                    }
                    string xmlFileName = Path.GetFileName(set.SetXmlPath);
                    string localXMLUrl = Server.MapPath("/Content/Files/" + xmlFileName);
                    if (!string.IsNullOrEmpty(set.SetXmlPath))
                    {
                        //if (File.Exists(set.SetXmlPath) && !File.Exists(localXMLUrl))
                        //    File.Copy(set.SetXmlPath, localXMLUrl);
                        string departmentCode = department.Code;
                        string deptCode       = departmentCode.Split('-')[0];
                        string jobCode        = departmentCode.Split('-')[1];
                        string columnData     = "";
                        if (departmentCode == "E-LIBRARY")
                        {
                            //AA NUMBER
                            //ACCOUNT NUMBER
                            columnData  = "AA No: " + set.AaNo;
                            columnData += "<br/>Account No: " + set.AccountNo;
                        }
                        else if (deptCode == "ETP")
                        {
                            if (jobCode == "LN")
                            {
                                columnData  = "AA No: " + set.AaNo;
                                columnData += "<br/>Account No: " + set.AccountNo;
                            }
                            else if (jobCode == "LL")
                            {
                                columnData = "AA No: " + set.AaNo;
                            }
                            else if (jobCode == "PR")
                            {
                                columnData = "Project Code: " + set.AaNo;
                            }
                            else if (jobCode == "WF")
                            {
                                columnData = "Welfare Code: " + set.AaNo;
                            }
                        }
                        else if (deptCode == "LOS")
                        {
                            columnData = "AA No: " + set.AaNo;
                        }

                        asb.Append(@"<tr>
                                    <td class='" + (set.IsReleased == 0 ? "" : "text-success") + @"'>
                                        " + index + @"
                                    </td>
                                    <td>" + branch.Code + @"</td>
                                    <td>" + department.Code + @"</td>
                                    <td class='text-center mb-5'>
                                        " + b.BatchNo + @"
                                        <a href='javascript:;' class='text-info view_batch_log'><sup>View Log</sup></a>
                                        <div class='div_batch_log hide draggableDiv'>
                                            <span class='log_close'>X</span>
                                            <table>
                                                <tr><td><strong>Set Log</strong></td><td>Batch No: <strong>" + b.BatchNo + @"</strong></td></tr>
                                                <tr><td colspan='2'><small>Duration: <label class='label label-primary'>" + timeSpan.Days + @" days, " + timeSpan.Hours + @" hours, " + timeSpan.Minutes + @" minutes, " + timeSpan.Seconds + @" seconds</label></small></tr>
                                            </table>
                                            " + batchLogHTML.ToString() + @"
                                            <div>
                                                M-Files Status: <span clas='fs-14'>" + (set.IsReleased == 1 ? "<i class='fa fa-file text-muted'></i>" : (set.IsReleased == 2 && set.Status == 1 ? "<i class='fa fa-file text-success'></i>" : "<i class='fa fa-file text-danger'></i>")) + @"</span>
                                            </div>
                                        </div>
                                    </td>
                                    <td>
                                        <div><strong>" + columnData + @"</strong><div>
                                        <a data-original-title='Click to view' data-trigger='hover' data-placement='bottom' class='popovers text-info' href='SetView.aspx?setId=" + set.Id + @"' target='_blank'><i class='fa fa-eye'></i></a>
                                    </td>
                                    <td>" + setDocumentsHTML.ToString() + @"</td>
                                    <td>" + stage.Name + @"</td>
                                    <td>" + (b.StageId == 6 && set.IsReleased == 1 ? "<i class='fa fa-file text-muted'></i>" : (b.StageId == 6 && set.IsReleased == 2 && set.Status == 1 ? "<i class='fa fa-file text-success'></i> Success " : (b.StageId == 6 && set.IsReleased == 2 && set.Status == 9 ? " < i class='fa fa-file text-danger'></i>" + set.Remarks : ""))) + @"</td>
                                    <td>" + (set.UpdatedDate == null ? set.CreatedDate.ToString("dd/MM/yyyy HH:mm:ss") : set.UpdatedDate.Value.ToString("dd/MM/yyyy HH:mm:ss")) + @"</td>
                                </tr>");
                    }
                    index++;
                }
                setsTbody.InnerHtml = asb.ToString();
            }
        }
Example #18
0
 public StageController(IMapper mapper, IStageService stageService)
 {
     _mapper       = mapper;
     _stageService = stageService;
 }
Example #19
0
 internal static bool TryGetPaths(this IStageService stage, out IImmutableList <string> paths)
 {
     paths = stage.GetPaths();
     return(paths.Count > 0);
 }
 public RegionService(StageBuilderDbContext context, IStageService stageService, IMapper mapper)
 {
     _context      = context;
     _stageService = stageService;
     _mapper       = mapper;
 }
Example #21
0
 public StageController(IStageService stageService, AuthUser authUser)
 {
     _stageService = stageService;
     _authUser     = authUser;
 }
Example #22
0
 internal static bool HasLobby(this IStageService stage)
 {
     return(!string.IsNullOrEmpty(stage.GetLobby()));
 }
Example #23
0
 /// <inheritdoc />
 public StagesController(IMapper mapper, IStageService stageService) : base(mapper)
 {
     _stageService = stageService;
 }
Example #24
0
        internal static IOperationSource GetOperationSource(this CommandContext context, IStageService stage, IStashService stashes)
        {
            OptionContext optionStash = context.GetOption(ApplyOptions.STASH);

            if (optionStash == null)
            {
                return(stage);
            }

            string id = optionStash.GetParameterValue(StashParameters.IDENTIFIER);

            return(int.TryParse(id, out int index)
                ? stashes.GetStash(index)
                : stashes.GetStash(id));
        }
Example #25
0
        public override void Initialize()
        {
            this.KeyService = (IKeyService)Game.Services.GetService(typeof(IKeyService));
            this.MapService = (IMapService)Game.Services.GetService(typeof(IMapService));
            this.StageService = (IStageService)Game.Services.GetService(typeof(IStageService));
            this.CameraService = (ICameraService)Game.Services.GetService(typeof(ICameraService));
            this.HUDService = (IHUDService)Game.Services.GetService(typeof(IHUDService));

            //Initialize Player
            this._statSheets = new Dictionary<IActor, StatSheet>();
            int id = this.StageService.AddNewActor(ActorType.Player);
            StatSheet s = new StatSheet();
            s.ID = id;
            s.Health = 100;
            this._statSheets.Add(this.StageService.GetActorByID(id), s);

            base.Initialize();
        }
Example #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserId"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                Int32  UserId   = Convert.ToInt32(Session["UserId"].ToString());
                User   user     = IUserService.GetSingle(UserId);
                string userType = Session["UserType"].ToString();
                string userRole = Session["UserRole"].ToString();
                string setId    = "";

                if (!string.IsNullOrEmpty(Request.QueryString["hdnNumberPerPage"]))
                {
                    hdnNumberPerPage.Value = Request.QueryString["hdnNumberPerPage"].ToString();
                }
                if (Request.QueryString["hdnCurrentPageNo"] != "" && Request.QueryString["hdnCurrentPageNo"] != null)
                {
                    hdnCurrentPageNo.Value = Request.QueryString["hdnCurrentPageNo"].ToString();
                }
                if (Request.QueryString["hdnTotalRecordsCount"] != "" && Request.QueryString["hdnTotalRecordsCount"] != null)
                {
                    hdnTotalRecordsCount.Value = Request.QueryString["hdnTotalRecordsCount"].ToString();
                }

                StringBuilder filter = new StringBuilder();
                filter.Append(" join batches b on b.id = s.batch_id ");
                // filter.Append(" and s.status in (1,9) ");
                if (!string.IsNullOrEmpty(Request.QueryString["setId"]))
                {
                    filter.Append(" and s.ID=" + Request.QueryString["setId"] + " ");
                }

                List <Branch> branchList = IBranchService.GetDataByFilter(" status='1'", 0, 0, false);

                if (userRole == "Regional Admin")
                {
                    List <Branch> Branches = new List <Branch>();
                    if (user.IsAll == 0)
                    {
                        List <BranchUser> userBranches = IBranchUserService.GetDataByFilter(" user_id = '" + user.Id + "' and status='1'", 0, 0, false);
                        branchList = IBranchService.GetDataByFilter(" ID not in (" + String.Join(",", userBranches.Select(x => x.BranchId).ToArray()) + ")", 0, 0, false);
                    }
                }
                if (userRole == "Branch Admin")
                {
                    if (user.BranchId != 0)
                    {
                        Branch        branch   = IBranchService.GetSingle(user.BranchId);
                        List <Branch> branches = new List <Branch>();
                        branches.Add(branch);
                        branchList = branches;
                    }
                }

                if (userRole == "Regional Admin")
                {
                    filter.Append(" and b.branch_id in (" + String.Join(",", branchList.Select(x => x.Id).ToArray()) + ") ");
                }
                else if (userRole == "Branch Admin")
                {
                    filter.Append(" and b.branch_id in (" + user.BranchId + ") ");
                }

                if (Request.QueryString["IsNewSearch"] != "" && Request.QueryString["IsNewSearch"] != null)
                {
                    IsNewSearch.Value = Request.QueryString["IsNewSearch"].ToString();
                }
                if (IsNewSearch.Value == "1")
                {
                    hdnCurrentPageNo.Value = "";
                }
                if (Request.QueryString["Search"] != "" && Request.QueryString["Search"] != null)
                {
                    //Search.Value = Request.QueryString["Search"].ToString();
                    //bool isNumber = long.TryParse(Search.Value, out long number);
                    //if (isNumber)
                    //    Search.Value = number.ToString();
                    //string columnNameAaNo = Converter.GetColumnNameByPropertyName<Set>(nameof(Set.AaNo));
                    //filter.Append(" and (s." + columnNameAaNo + " like '%" + Search.Value + "%'");
                    //string columnNameAcNo = Converter.GetColumnNameByPropertyName<Set>(nameof(Set.AccountNo));
                    //filter.Append(" or s." + columnNameAcNo + " like '%" + Search.Value + "%'");
                    //string columnNameBatchNo = Converter.GetColumnNameByPropertyName<Batch>(nameof(Batch.BatchNo));
                    //filter.Append(" or b." + columnNameBatchNo + " like '%" + Search.Value + "%')");
                }


                int skip = 0, take = 10;
                if (hdnCurrentPageNo.Value == "")
                {
                    skip = 0;
                    take = 10;
                    hdnNumberPerPage.Value     = "10";
                    hdnCurrentPageNo.Value     = "1";
                    hdnTotalRecordsCount.Value = ISetService.GetCountByFilterNew(filter.ToString()).ToString();
                }
                else
                {
                    skip = (Convert.ToInt32(hdnCurrentPageNo.Value) - 1) * 10;
                    take = 10;
                }

                List <Set> objs = ISetService.GetDataByFilterNew(filter.ToString(), skip, take, true);

                StringBuilder asb   = new StringBuilder();
                int           index = 1;
                foreach (Set set in objs)
                {
                    Batch b = IBatchService.GetSingle(set.BatchId);

                    int setsCount      = ISetService.GetCountByFilter(" batch_id='" + b.Id + "'");
                    int scanPagesCount = 0;

                    filter = new StringBuilder();
                    filter.Append(" 1=1");
                    string BatchIdColumnName = Converter.GetColumnNameByPropertyName <BatchLog>(nameof(BatchLog.BatchId));
                    filter.Append(" and " + BatchIdColumnName + " = '" + b.Id + "'");

                    List <BatchLog> batchLogs    = IBatchLogService.GetDataByFilter(filter.ToString(), 0, 0, false);
                    StringBuilder   batchLogHTML = new StringBuilder();
                    foreach (BatchLog batchLog in batchLogs)
                    {
                        batchLogHTML.Append(@"
                                                    <div class='mini-stat clearfix text-left'>
                                                        " + (batchLog.StageId == 1 ?
                                                             @"<span class='mini-stat-icon orange'><i class='fa fa-print'></i></span>" :
                                                             (batchLog.StageId == 2 ?
                                                              "<span class='mini-stat-icon tar'><i class='fa fa-check-square-o'></i></span>" :
                                                              (batchLog.StageId == 3 ?
                                                               "<span class='mini-stat-icon pink'><i class='fa fa-external-link'></i></span>" :
                                                               (batchLog.StageId == 4 ?
                                                                "<span class='mini-stat-icon green'><i class='fa fa-puzzle-piece'></i></span>" :
                                                                (batchLog.StageId == 5 ?
                                                                 "<span class='mini-stat-icon yellow-b'><i class='fa fa-files-o'></i></span>" :
                                                                 (batchLog.StageId == 6 ?
                                                                  "<span class='mini-stat-icon yellow-b'><i class='fa fa-hdd-o'></i></span>" : "")))))) + @"
                                                        <div class='mini-stat-info'>
                                                            " + (batchLog.StageId == 1 ?
                                                                 "<span>Scan</span>" :
                                                                 (batchLog.StageId == 2 ?
                                                                  "<span>Index</span>" :
                                                                  (batchLog.StageId == 3 ?
                                                                   "<span><span>Export</span> <small>To Server</small></span>" :
                                                                   (batchLog.StageId == 4 ?
                                                                    "<span><span>Integrate</span> <small>Sync Control</small></span>" :
                                                                    (batchLog.StageId == 5 ?
                                                                     "<span><span>Release</span> <small>To Mimzy</small></span>" :
                                                                     (batchLog.StageId == 6 ?
                                                                      "<span><span>Document</span> <small>By Mimzy</small></span>" : "")))))) + @"
                                                            " + batchLog.UpdatedDate.ToString("dd/MM/yyyy HH:mm:ss") + @" - <strong>" + batchLog.BatchUser + @"</strong>
                                                        </div>
                                                    </div>
                                ");
                    }
                    BatchLog firstBatchLog = batchLogs.FirstOrDefault();
                    BatchLog lastBatchLog  = batchLogs.LastOrDefault();
                    TimeSpan timeSpan      = lastBatchLog.UpdatedDate.Subtract(firstBatchLog.UpdatedDate);

                    Branch     branch     = IBranchService.GetSingle(b.BranchId);
                    Department department = IDepartmentService.GetSingle(b.DepartmentId);
                    Stage      stage      = IStageService.GetSingle(b.StageId);
                    filter = new StringBuilder();
                    filter.Append(" 1=1");
                    filter.Append(" and " + Converter.GetColumnNameByPropertyName <SetDocument>(nameof(SetDocument.SetId)) + "='" + set.Id + "'");
                    filter.Append(" and " + Converter.GetColumnNameByPropertyName <SetDocument>(nameof(SetDocument.Status)) + "='1'");
                    List <SetDocument> setDocuments     = ISetDocumentService.GetDataByFilter(filter.ToString(), 0, 0, false);
                    StringBuilder      setDocumentsHTML = new StringBuilder();
                    StringBuilder      setDocumentsPdf  = new StringBuilder();



                    string departmentCode = department.Code;
                    string deptCode       = departmentCode.Split('-')[0];
                    string jobCode        = departmentCode.Split('-')[1];
                    string columnData     = "";
                    string accountNumber  = "";
                    if (departmentCode == "E-LIBRARY")
                    {
                        //AA NUMBER
                        //ACCOUNT NUMBER
                        columnData     = "AA No: " + set.AaNo;
                        columnData    += "<br/>Account No: " + set.AccountNo;
                        accountNumber += " <tr><td> AA Number </td><td> " + set.AaNo + " </td></tr>";
                        accountNumber += " <tr><td> Acount Number </td><td> " + set.AccountNo + " </td></tr>";
                    }
                    else if (deptCode == "ETP")
                    {
                        if (jobCode == "LN")
                        {
                            columnData     = "AA No: " + set.AaNo;
                            columnData    += "<br/>Account No: " + set.AccountNo;
                            accountNumber += " <tr><td> AA Number </td><td> " + set.AaNo + " </td></tr>";
                            accountNumber += " <tr><td> Acount Number </td><td> " + set.AccountNo + " </td></tr>";
                        }
                        else if (jobCode == "LL")
                        {
                            columnData     = "AA No: " + set.AaNo;
                            accountNumber += " <tr><td> AA Number </td><td> " + set.AaNo + " </td></tr>";
                        }
                        else if (jobCode == "PR")
                        {
                            columnData     = "Project Code: " + set.AaNo;
                            accountNumber += " <tr><td> Project Code </td><td> " + set.AaNo + " </td></tr>";
                        }
                        else if (jobCode == "WF")
                        {
                            columnData     = "Welfare Code: " + set.AaNo;
                            accountNumber += " <tr><td> Welfare Code </td><td> " + set.AaNo + " </td></tr>";
                        }
                    }
                    else if (deptCode == "LOS")
                    {
                        columnData     = "AA No: " + set.AaNo;
                        accountNumber += " <tr><td> AA Number </td><td> " + set.AaNo + " </td></tr>";
                    }


                    setDocumentsPdf.Append(@"<button class='rotate90' id='metaTag'>Meta Tag</button>
            <button class='rotate90' id='preView'>Preview</button>
            <h5><i class='fa fa-file-pdf-o'></i> <strong>" + department.Code + @" - " + set.AaNo + @"</strong></h5>
            <table id='tblView' class='table table-condensed table-striped'>" + accountNumber + @"
                           <tr><td> Branch </td><td>" + branch.Code + @"</td></tr>
                           <tr><td> Department </td><td>" + department.Code + @"</ td ></ tr >    
                                <tr><td> Date </td><td> " + set.CreatedDate + @" </td></tr>
                                <tr><td> M - File Status </td><td> " + (set.IsReleased == 1 ? "<i class='fa fa-file text-muted'></i>Pending " : (set.IsReleased == 2 && set.Status == 1 ? "<i class='fa fa-file text-success'></i>Mfile update has been Success" : "<i class='fa fa-file text-danger'></i>Mfile update has been Failed")) + @" </td></tr>
                                       <tr><td> Remarks </td><td>" + set.Remarks + @"</td></tr>
                                   </table> ");
                    foreach (SetDocument setDocument in setDocuments)
                    {
                        scanPagesCount += setDocument.PageCount;
                        string fileName = Path.GetFileName(setDocument.DocumentUrl);
                        string localUrl = Server.MapPath("/Content/Files/" + fileName);

                        if (File.Exists(setDocument.DocumentUrl) && !File.Exists(localUrl))
                        {
                            File.Copy(setDocument.DocumentUrl, localUrl);
                        }
                        setDocumentsHTML.Append(@" <div class='pdf-document'>
                            <a href='javascript:;' id='" + setDocument.DocType + @"' onclick='pdfview(this)'><i class='fa fa-file-pdf-o'></i> " + setDocument.DocType + @" Shown Documents from " + setDocument.UpdatedDate + @"</p>
                        </a> </div>");
                        // setDocumentsHTML.Append(@"<div style='min-width: 150px;'><a href='/Content/Files/" + fileName + "' target='_blank' data-original-title='Click to view' data-trigger='hover' data-placement='bottom' class='popovers text-info'><strong>" + setDocument.DocType + @"</strong></a> ( <small> pages: <strong>" + setDocument.PageCount + @"</strong></small> )</div>");
                        setDocumentsPdf.Append(@"<div class='pdfView' id='pdf-" + setDocument.DocType + @"' style='display: none'> <iframe width='100%' height='100%' src='/Content/Files/" + fileName + @"'> </iframe></div>");
                    }
                    ResultHolder.InnerHtml = setDocumentsHTML.ToString();
                    FileHolder.InnerHtml   = setDocumentsPdf.ToString();
                    string xmlFileName = Path.GetFileName(set.SetXmlPath);
                    string localXMLUrl = Server.MapPath("/Content/Files/" + xmlFileName);
                    if (set.SetXmlPath != null && set.SetXmlPath != "")
                    {
                        if (File.Exists(set.SetXmlPath) && !File.Exists(localXMLUrl))
                        {
                            File.Copy(set.SetXmlPath, localXMLUrl);
                        }

                        asb.Append(@" <div>
                        " + columnData + @"
                       <br /> Branch : " + branch.Code + @" 
                       <br /> Department : " + department.Code + @"
                       <br /> Batch No : " + b.BatchNo + @"
                    </div>");
                        //  PropsHolder.InnerHtml = asb.ToString();
                        //                        asb.Append(@"<tr>
                        //                                    <td class='" + (set.IsReleased == 0 ? "" : "text-success") + @"'>
                        //                                        " + index + @"
                        //                                    </td>
                        //                                    <td>branch Code " + branch.Code + @"<br />Department - " + department.Code + @"<br />User Batch No " + b.BatchNo + @"<br />
                        //AA No " + b.BatchNo + @"<br />
                        //Acount Number " + b.BatchNo + @"<br /></td>
                        //                                    <td><a href='/Content/Files/" + xmlFileName + @"' target='_blank' data-original-title='Click to view XML' data-trigger='hover' data-placement='bottom' class='popovers text-info'><strong>" + columnData + @"</strong></a></td>
                        //                                    <td style='text-align:left'>
                        //Created On " + (set.UpdatedDate == null ? set.CreatedDate.ToString("dd/MM/yyyy HH:mm:ss") : set.UpdatedDate.Value.ToString("dd/MM/yyyy HH:mm:ss")) + @"<br />
                        //                        "+ setDocumentsPdf.ToString() + @" </td>
                        //                                </tr>");
                    }
                    index++;
                }
                PropsHolder.InnerHtml = asb.ToString();
            }
        }
Example #27
0
 public ArchiveCommand(IStageService stage, IStashService stashes, ILogService logger)
 {
     this.stage   = stage ?? throw new ArgumentNullException(nameof(stage));
     this.stashes = stashes ?? throw new ArgumentNullException(nameof(stashes));
     this.logger  = logger;
 }
 public StagesController(IStageService stageService)
 {
     _stageService = stageService;
 }
Example #29
0
 /// <summary>
 /// This contructor is to inject object using dependency injection
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="stage"></param>
 public StageController(ILogger <StageController> logger, IStageService stage)
 {
     _logger = logger;
     _stage  = stage;
 }