public ActionResult Login()
        {
            ViewBag.connmain = SharepointHelper.PushConf()["primaindb"];
            ViewBag.connsec  = SharepointHelper.PushConf()["secdbempmst"];
            try
            {
                ViewBag.UrlApp     = WebConfigure.GetDomain();
                ViewBag.CheckLogin = WebConfigure.GetLoginPortal();

                if (Common.CheckAdmin())
                {
                    _userBService.EndDelegate();
                    return(View());
                }
                else
                {
                    return(RedirectToAction("Index", "Default"));
                }
            }
            catch (Exception er)
            {
                _logErrorBService.WriteLog("Account", MethodBase.GetCurrentMethod().Name, er.ToString());

                throw;
            }
        }
        public ActionResult GetPSLIdPIPPriority(string parentarea, string salesOffice, string dateRangeFrom, string dateRangeEnd, string inventory, string rental, string hid, string others, string pslType, string storeName, string area)
        {
            var splitPSLType   = new string[] { };
            var splitArea      = new string[] { };
            var splitStoreName = new string[] { };

            if (!string.IsNullOrWhiteSpace(pslType))
            {
                splitPSLType = pslType.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(storeName))
            {
                splitStoreName = storeName.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(area))
            {
                splitArea = area.Split(',');
            }
            var modelFormCollection = new GetFormCollectionPSLCompletionPip();

            modelFormCollection.DateRangeFrom           = dateRangeFrom;
            modelFormCollection.DateRangeEnd            = dateRangeEnd;
            modelFormCollection.Inventory               = inventory;
            modelFormCollection.Rental                  = rental;
            modelFormCollection.HID                     = hid;
            modelFormCollection.Others                  = others;
            modelFormCollection.Area                    = area;
            modelFormCollection.PSLId                   = "";
            modelFormCollection.PSLType                 = pslType;
            modelFormCollection.StoreName               = "";
            ViewBag.ModelFormCollectionPSLCompletionPip = modelFormCollection;
            ViewBag.ListPSLIdPipPriority                = pslBS.GetListPSLIdForCompletionPipPriority(parentarea, salesOffice, dateRangeFrom, dateRangeEnd, inventory, rental, hid, others, splitPSLType, splitArea, splitStoreName);
            ViewBag.Domain = WebConfigure.GetDomain();
            return(View());
        }
Пример #3
0
        public IHttpActionResult Post(ApiJsonDraw apiDraw, String level, String category, String keyword)
        {
            ApiJsonStatus apiJsonStatusM = Factory.Create <ApiJsonStatus>("ApiJsonStatus", ClassType.clsTypeDataModel);

            apiJsonStatusM.code    = 200;
            apiJsonStatusM.message = "Post ok " + apiDraw.draw;

            var start = 6 * (apiDraw.draw - 1);

            List <ArticleListJson> aljModel = new List <ArticleListJson>();

            var alModel = _articleBs.GetListApproved(start, level, category, keyword);

            foreach (var item in alModel)
            {
                ArticleListJson    ajModel  = Factory.Create <ArticleListJson>("ArticleListJson", ClassType.clsTypeDataModel);
                ArticleListJsonImg ajiModel = Factory.Create <ArticleListJsonImg>("ArticleListJsonImg", ClassType.clsTypeDataModel);

                string attachmentsPath = WebConfigure.GetDomain() + "/Upload/Article/Header/";
                ajiModel.src      = attachmentsPath + item.HeaderImage;
                ajiModel.label    = item.Category1;
                ajiModel.alt      = item.Category1;
                ajModel.img       = ajiModel;
                ajModel.link      = WebConfigure.GetDomain() + "/Library/Detail/" + item.ArticleId;
                ajModel.group_url = WebConfigure.GetDomain() + "/Library?category=" + item.Category1Id;
                ajModel.title     = item.Title;
                ajModel.text      = Common.GetShortDescription(item.Description);
                ajModel.type      = "Article";
                ajModel.date      = item.CreatedAt?.ToString("dd MMM yyyy");

                aljModel.Add(ajModel);
            }
            return(Ok(new { status = apiJsonStatusM, data = aljModel }));
        }
        // GET: Library/Delete/5
        public ActionResult Delete(int id)
        {
            if (Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
            {
                return(RedirectToAction("Login", "Account"));
            }

            Article articleObject = _articleBs.Detail(id);

            ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null;
            SetDropdownArtikelCategory(articleObject);

            var tags = _articleTagsService.GetTagsByArticle(id);

            ViewBag.Tags = tags;
            var attachments = _articleFileBs.GetListByArtikelId(id);
            List <TicketAttachmentsAPI> listAttachment = new List <TicketAttachmentsAPI>();
            string attachmentsPath = System.Web.HttpContext.Current.Server.MapPath("~/Upload/Article/");

            if (attachments != null)
            {
                string[] imgExt = { ".jpg", ".png", ".jpeg", ".gif", ".bmp", ".tif", ".tiff" };
                foreach (var attachment in attachments)
                {
                    if (imgExt.Contains(Path.GetExtension(attachment.Name)))
                    {
                        listAttachment.Add(new TicketAttachmentsAPI
                        {
                            Id   = attachment.ArticleFileId,
                            Name = Common.ImageToBase64(attachmentsPath + attachment.Name),
                            Type = Path.GetExtension(attachment.Name),
                            NameWithOutBase64 = attachment.Name
                        });
                    }
                    else
                    {
                        listAttachment.Add(new TicketAttachmentsAPI
                        {
                            Id   = attachment.ArticleFileId,
                            Name = attachment.Name,
                            Type = Path.GetExtension(attachment.Name),
                            NameWithOutBase64 = attachment.Name
                        });
                    }
                }
            }
            ViewBag.Attachments = listAttachment;
            ViewBag.HeaderImg   = WebConfigure.GetDomain() + "/Upload/Article/Header/" + articleObject.HeaderImage;
            if (articleObject == null)
            {
                return(HttpNotFound());
            }
            return(View(articleObject));
        }
 public ActionResult SubCategory(int parent = 0)
 {
     #region Category
     ViewBag.Domain            = WebConfigure.GetDomain();
     ViewBag.ListCategoryChild = _ArticleCategoryBs.GetListCategoryMostUsedSort(parent);
     #endregion
     return(View());
 }
Пример #6
0
        // GET: Admin/Articles/Edit/5
        public ActionResult Edit(int id)
        {
            if (Common.CheckAdmin())
            {
                return(RedirectToAction("Login", "Default"));
            }
            ViewBag.Domain = WebConfigure.GetDomain() + "/Upload/Article/Attachments/";
            Article articleObject = _articleService.Detail(id);

            SetDropdownArtikelCategory(articleObject);

            var tags = _articleTagsService.GetTagsByArticle(id);

            ViewBag.Tags = tags;
            //Attachment
            var attachments = _articleFileBs.GetListByArtikelId(id);
            List <TicketAttachmentsAPI> listAttachment = new List <TicketAttachmentsAPI>();
            string attachmentsPath = System.Web.HttpContext.Current.Server.MapPath("~/Upload/Article/Attachments/");

            if (attachments != null)
            {
                string[] imgExt = { ".jpg", ".png", ".jpeg", ".gif", ".bmp", ".tif", ".tiff" };
                foreach (var attachment in attachments)
                {
                    if (imgExt.Contains(Path.GetExtension(attachment.Name)))
                    {
                        listAttachment.Add(new TicketAttachmentsAPI
                        {
                            Id                = attachment.ArticleFileId,
                            Name              = Common.ImageToBase64(attachmentsPath + attachment.Name),
                            Level             = attachment.LevelUser,
                            Type              = Path.GetExtension(attachment.Name),
                            NameWithOutBase64 = attachment.Name
                        });
                    }
                    else
                    {
                        listAttachment.Add(new TicketAttachmentsAPI
                        {
                            Id                = attachment.ArticleFileId,
                            Name              = attachment.Name,
                            Level             = attachment.LevelUser,
                            Type              = Path.GetExtension(attachment.Name),
                            NameWithOutBase64 = attachment.Name
                        });
                    }
                }
            }
            ViewBag.Attachments = listAttachment;
            ViewBag.HeaderImg   = WebConfigure.GetDomain() + "/Upload/Article/Header/" + articleObject.HeaderImage;
            ViewBag.DefaultImg  = WebConfigure.GetDomain() + "/Upload/attachment-default.png";
            ViewBag.EmptyImg    = WebConfigure.GetDomain() + "/assets/images/repository/empty-image.jpg";
            if (articleObject == null)
            {
                return(HttpNotFound());
            }
            return(View(articleObject));
        }
Пример #7
0
 public ActionResult Testing(int parent = 0)
 {
     #region Category
     ViewBag.Download          = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention();
     ViewBag.Domain            = WebConfigure.GetDomain();
     ViewBag.ListCategoryChild = _articleCategoryBs.GetListCategoryMostUsedLiterature(parent); /*_articleCategoryBs.GetListMainCategory(parent);*/
     #endregion
     return(View());
 }
Пример #8
0
 private String domain(Boolean isLocal = true)
 {
     if (isLocal == true)
     {
         return("http://localhost/TSICS");
     }
     else
     {
         return(WebConfigure.GetDomain());
     }
 }
Пример #9
0
        // GET: Admin/Articles/Create
        public ActionResult Create()
        {
            if (Common.CheckAdmin())
            {
                return(RedirectToAction("Login", "Default"));
            }
            ViewBag.EmptyImg      = WebConfigure.GetDomain() + "/assets/images/repository/empty-image.jpg";
            ViewBag.ListCategory1 = _articleCategoryBs.GetListParent(0);

            return(View());
        }
        public ActionResult Create()
        {
            ViewBag.Domain = WebConfigure.GetDomain();
            if (Common.CheckAdmin())
            {
                return(RedirectToAction("Login", "Default"));
            }
            var UserData = _userBService.GetListUserNonDelegate();

            ViewBag.Userlist = UserData;

            return(View());
        }
        public ActionResult Approve1Mail(string id)
        {
            ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null;
            var articleData = _articleBs.GetDetailbyToken(id);
            var userData    = _userBService.GetDetail(articleData.CreatedBy);

            ViewBag.User      = userData;
            ViewBag.RoleLevel = _userRoleBService.GetDetail(userData.RoleId).Name;

            ViewBag.App1          = _mstEmployeeBService.GetDetail(_mstEmployeeBService.GetDetail(userData.EmployeeId).Superior_ID);
            ViewBag.DomainLink    = WebConfigure.GetDomain();
            ViewBag.RecentArticle = _articleBs.GetRecent();
            ViewBag.UseFullLink   = _articleBs.getUseFullLink();
            return(View(articleData));
        }
        public ActionResult GetSalesOfficePIPPriority(string parent, string dateRangeFrom, string dateRangeEnd, string inventory, string rental, string hid, string others, string pslType, string storeName, string area)
        {
            var splitPSLType   = new string[] { };
            var splitArea      = new string[] { };
            var splitStoreName = new string[] { };

            if (!string.IsNullOrWhiteSpace(pslType))
            {
                splitPSLType = pslType.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(storeName))
            {
                splitStoreName = storeName.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(area))
            {
                splitArea = area.Split(',');
            }
            var           PSLData     = pslBS.GetListSalesOfficeForCompletionPipPriority(parent, dateRangeFrom, dateRangeEnd, inventory, rental, hid, others, splitPSLType, splitArea, splitStoreName);
            List <Ticket> PSLDataTemp = new List <Ticket>();

            foreach (var item in PSLData)
            {
                Ticket tempPSL = new Ticket()
                {
                    Title    = item.Replace(" ", ""),
                    TicketNo = item
                };
                PSLDataTemp.Add(tempPSL);
            }
            var modelFormCollection = new GetFormCollectionPSLCompletionPip();

            modelFormCollection.DateRangeFrom           = dateRangeFrom;
            modelFormCollection.DateRangeEnd            = dateRangeEnd;
            modelFormCollection.Inventory               = inventory;
            modelFormCollection.Rental                  = rental;
            modelFormCollection.HID                     = hid;
            modelFormCollection.Others                  = others;
            modelFormCollection.Area                    = parent;
            modelFormCollection.PSLId                   = pslType;
            modelFormCollection.PSLType                 = "";
            modelFormCollection.StoreName               = "";
            ViewBag.ModelFormCollectionPSLCompletionPip = modelFormCollection;
            ViewBag.ListSalesOfficePipPriority          = PSLDataTemp;
            ViewBag.AreaPriority = parent;
            ViewBag.Domain       = WebConfigure.GetDomain();
            return(View());
        }
        // GET: Library/Details/5
        public ActionResult Detail(int id)
        {
            if (Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
            {
                return(RedirectToAction("Login", "Account"));
            }

            try
            {
                if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj() != "" && Session["userid"] == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                if (Session["username"] != null)
                {
                    if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
                    {
                        return(RedirectToAction("Login", "Account"));
                    }
                }

                var articleModel = _articleBs.Approved(id);

                var listArticleFileModel = _articleFileBs.GetListByArtikelId(id);
                var listArticleTagsModel = _articleTagsService.GetTagsByArticle(id);

                ViewBag.ListFile   = listArticleFileModel.Count == 0 ? null : listArticleFileModel;
                ViewBag.ArticleTag = listArticleTagsModel.Count == 0 ? null : listArticleTagsModel;
                ViewBag.PathImg    = articleModel.HeaderImage == null?WebConfigure.GetDomain() + "/assets/images/repository/empty-image.jpg" : WebConfigure.GetDomain() + "/Upload/Article/Header/" + articleModel.HeaderImage;

                ViewBag.Domain = WebConfigure.GetDomain();

                ViewBag.RecentArticle = _articleBs.GetRecent();
                ViewBag.UseFullLink   = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null;
                return(View(articleModel));
            }
            catch (Exception ex)
            {
                _logErrorBService.WriteLog("Detail Library", MethodBase.GetCurrentMethod().Name, ex.ToString());
                throw;
            }
        }
        // GET: Account
        public ActionResult Index()
        {
            ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention();
            if (Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                //if (Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
                //{
                //    return RedirectToAction("Login", "Account");
                //}
                var userT = _userBService.GetDetail(Convert.ToInt32(Session["userid"]));

                ViewBag.MsgReject = _userMessageBService.GetListByEmployeeId(userT.EmployeeId);
                User app1 = userT.Approval1 == 0 ? null : _userBService.GetDetailByEmployeeId(userT.Approval1);
                User app2 = userT.Approval2 == 0 ? null : _userBService.GetDetailByEmployeeId(userT.Approval2);

                EmployeeMaster userEmpMst = _mstEmployeeBService.GetDetailbyUserName(userT.Username);
                EmployeeMaster empMstApp1 = userEmpMst == null ? null : _mstEmployeeBService.GetDetail(userEmpMst.Superior_ID);
                EmployeeMaster empMstApp2 = empMstApp1 == null ? null : _mstEmployeeBService.GetDetail(empMstApp1.Superior_ID);
                ViewBag.App1       = app1 == null ? null : app1;
                ViewBag.App2       = app2 == null ? null : app2;
                ViewBag.empMstApp1 = empMstApp1 == null ? null : empMstApp1;
                ViewBag.empMstApp2 = empMstApp2 == null ? null : empMstApp2;
                UserTsManager tsmanager = userT.UserTsManager1Id == 0 ? null : _userTsManagerBusinessService.GetDetail(userT.UserTsManager1Id);
                ViewBag.TSManager = tsmanager == null ? null : _userBService.GetDetailByEmployeeId(tsmanager.EmployeeId);
                ViewBag.Recent    = _ticketBs.GetRecent();
                var Employemst = _mstEmployeeBService.GetDetail(userT.EmployeeId);
                if (Employemst == null)
                {
                    ViewBag.EmployeeMaster_empId    = String.Empty;
                    ViewBag.EmployeeMaster_POH_Id   = String.Empty;
                    ViewBag.EmployeeMaster_POH_Name = "-";
                }
                else
                {
                    ViewBag.EmployeeMaster_empId    = Convert.ToString(Employemst.Employee_Id);
                    ViewBag.EmployeeMaster_POH_Id   = string.IsNullOrWhiteSpace(Employemst.Business_Area) ? "-" : "ID : " + Employemst.Business_Area;
                    ViewBag.EmployeeMaster_POH_Name = string.IsNullOrWhiteSpace(Employemst.Business_Area_Desc) ? "-" : Employemst.Business_Area_Desc;
                }
                return(View(userT));
            }
        }
        public ActionResult ApproveTsMail(string id)
        {
            ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null;
            var articleData = _articleBs.GetDetailbyToken(id);
            var userData    = _userBService.GetDetail(articleData.CreatedBy);
            var app1        = _mstEmployeeBService.GetDetail(articleData.Aproved1By);
            var app2        = _mstEmployeeBService.GetDetail(articleData.Aproved2By);

            ViewBag.App1             = app1;
            ViewBag.App2             = app2;
            ViewBag.TsManager        = _userTsManagerBusinessService.GetDetail(1);
            ViewBag.User             = userData;
            ViewBag.RoleLevel        = _userRoleBService.GetDetail(userData.RoleId).Name;
            ViewBag.MessageResponse1 = _userMessageBService.GetDetail(app1.Employee_Id, articleData.ArticleId, "Article");
            ViewBag.MessageResponse2 = _userMessageBService.GetDetail(app2.Employee_Id, articleData.ArticleId, "Article");
            ViewBag.DomainLink       = WebConfigure.GetDomain();
            ViewBag.RecentArticle    = _articleBs.GetRecent();
            ViewBag.UseFullLink      = _articleBs.getUseFullLink();
            return(View(articleData));
        }
        public ActionResult Edit(int id)
        {
            ViewBag.Domain = WebConfigure.GetDomain();
            if (Common.CheckAdmin())
            {
                return(RedirectToAction("Login", "Default"));
            }
            Delegation delegation   = _userBService.GetDetailDelegation(id);
            User       fromUserData = _userBService.GetDetail(delegation.FromUser);
            User       toUserData   = _userBService.GetDetail(delegation.ToUser);

            ViewBag.FromUser  = fromUserData;
            ViewBag.ToUser    = toUserData;
            ViewBag.RoleName1 = _userRoleBService.GetDetail(fromUserData.RoleId).Name;
            ViewBag.RoleName2 = _userRoleBService.GetDetail(toUserData.RoleId).Name;
            var UserData = _userBService.GetListActive();

            ViewBag.Userlist = UserData;

            return(View(delegation));
        }
        // GET: Admin/Category

        public ActionResult Index(String SearchString = "")
        {
            if (Common.CheckAdmin())
            {
                return(RedirectToAction("Login", "Default"));
            }

            //int pageSize = 100;
            //int pageNumber = (page ?? 1);

            ViewBag.Domain = WebConfigure.GetDomain();
            if (String.IsNullOrWhiteSpace(SearchString))
            {
                ViewBag.ListCategoryChild = _ArticleCategoryBs.GetListCategoryMostUsedSort(0);
            }
            else
            {
                ViewBag.ListCategoryChild = _ArticleCategoryBs.GetList(SearchString);
            }
            return(View(/*_ArticleCategoryBs.GetList().ToPagedList(pageNumber, pageSize)*/));
        }
Пример #18
0
        public IHttpActionResult UploadImageContent()
        {
            ArticleImageUpload uploadResponse = new ArticleImageUpload();

            try
            {
                var    postedFile = HttpContext.Current.Request.Files[0];
                string dateString = DateTime.Now.ToString("yyyyMMddHmmss");
                string fileName   = dateString + "-" + postedFile.FileName;
                var    path       = Path.Combine(HttpContext.Current.Server.MapPath("~/Upload/Article/Content/"), fileName);
                postedFile.SaveAs(path);

                uploadResponse.uploaded = 1;
                uploadResponse.fileName = fileName;
                uploadResponse.url      = WebConfigure.GetDomain() + "/Upload/Article/Content/" + fileName;
                return(Ok(uploadResponse));
            }
            catch (Exception e)
            {
                return(Ok(uploadResponse.error = e.InnerException?.ToString()));
            }
        }
        // GET: Library
        public ActionResult Index(String keyword = "", String category = "")
        {
            if (Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
            {
                return(RedirectToAction("Login", "Account"));
            }

            try
            {
                ViewBag.Download = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention();
                ViewBag.Domain   = WebConfigure.GetDomain();
                if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj() != "" && Session["userid"] == null)
                {
                    return(RedirectToAction("Login", "Account"));
                }
                if (Session["username"] != null)
                {
                    if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
                    {
                        return(RedirectToAction("Login", "Account"));
                    }
                }

                ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null;
                ViewBag.key         = keyword;
                ViewBag.Category    = category;
                return(View());
            }
            catch (Exception ex)
            {
                _logErrorBService.WriteLog("Library Index", MethodBase.GetCurrentMethod().Name, ex.ToString());
                throw;
            }
        }
 // GET: Admin/Default
 public ActionResult Index(String alert = "")
 {
     if (Common.CheckAdmin())
     {
         return(RedirectToAction("Login"));
     }
     ViewBag.Result                   = alert;
     ViewBag.DownloadTelematics       = WebConfigure.GetDomain() + "/Upload/telematics.xlsx";
     ViewBag.DownloadWarranty         = WebConfigure.GetDomain() + "/Upload/Document/WarrantyList_File.csv";
     ViewBag.DownloadJCode            = WebConfigure.GetDomain() + "/Upload/Document/Location_File.csv";
     ViewBag.DownloadMEP              = WebConfigure.GetDomain() + "/Upload/MEP.xlsx";
     ViewBag.DownloadPIS              = WebConfigure.GetDomain() + "/Upload/Document/PIS_File.csv";
     ViewBag.DownloadComment          = WebConfigure.GetDomain() + "/Upload/Document/Comment_File.csv";
     ViewBag.DownloadUserGuide        = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention();
     ViewBag.DownloadDPPM             = WebConfigure.GetDomain() + "/Upload/Document/DPPMSummary_FIle.csv";
     ViewBag.DownloadDPPMAffectedUnit = WebConfigure.GetDomain() + "/Upload/Document/DPPMAffectedUnit_File.csv";
     ViewBag.DownloadDPPMAffectedPart = WebConfigure.GetDomain() + "/Upload/Document/DPPMAffectedPart_File.csv";
     ViewBag.DownloadSIMSErrorSummary = WebConfigure.GetDomain() + "/Upload/Document/SIMSErrorSummary_File.csv";
     ViewBag.DownloadOrganization     = WebConfigure.GetDomain() + "/Upload/Document/Organization_File.csv";
     //return View();
     return(RedirectToAction("Index", "User"));
 }
 // GET: Library/Create
 public ActionResult Create()
 {
     ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null;
     if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj() != "" && Session["userid"] == null)
     {
         return(RedirectToAction("Login", "Account"));
     }
     if (Session["username"] != null)
     {
         if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
         {
             return(RedirectToAction("Login", "Account"));
         }
     }
     if (!Common.CheckUserYellow())
     {
         return(RedirectToAction("Login", "Account"));
     }
     ViewBag.EmptyImg      = WebConfigure.GetDomain() + "/assets/images/repository/empty-image.jpg";
     ViewBag.ListCategory1 = _articleCategoryBs.GetListParent(0);
     ViewBag.UseFullLink   = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null;
     return(View());
 }
        public IHttpActionResult Post(string id, ApiJsonDraw apiDraw)
        {
            ApiJsonStatus apiJsonStatusM = Factory.Create <ApiJsonStatus>("ApiJsonStatus", ClassType.clsTypeDataModel);

            //var draw = Request.Content.ReadAsStringAsync();
            apiJsonStatusM.code    = 200;
            apiJsonStatusM.message = "Post ok " + apiDraw.draw;

            var start = 3 * (apiDraw.draw - 1);
            //if (start == 0)
            //    start = 1;

            List <ArticleListJson> aljModel = new List <ArticleListJson>();

            var alModel = _articleBs.GetListApprovedByCategory(start, id);

            foreach (var item in alModel)
            {
                ArticleListJson    ajModel  = Factory.Create <ArticleListJson>("ArticleListJson", ClassType.clsTypeDataModel);
                ArticleListJsonImg ajiModel = Factory.Create <ArticleListJsonImg>("ArticleListJsonImg", ClassType.clsTypeDataModel);

                string attachmentsPath = WebConfigure.GetDomain() + "/Upload/Article/Header/";
                ajiModel.src   = attachmentsPath + item.HeaderImage;
                ajiModel.label = item.Category1;
                ajiModel.alt   = item.Category1;
                ajModel.img    = ajiModel;
                ajModel.link   = WebConfigure.GetDomain() + "/Library/Detail/" + item.ArticleId;
                ajModel.title  = item.Title;
                ajModel.text   = Common.GetShortDescription(item.Description);
                ajModel.type   = "Artikel";
                ajModel.date   = item.CreatedAt?.ToString("dd MMM yyyy");

                aljModel.Add(ajModel);
            }

            return(Ok(new { status = apiJsonStatusM, data = aljModel }));
        }
Пример #23
0
        public ActionResult Delete(string id)
        {
            if (Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
                {
                    return(RedirectToAction("Login", "Account"));
                }

                if (id != null)
                {
                    Ticket tickets = _ticketBs.GetDetail(int.Parse(id));
                    if (Convert.ToInt32(Session["DelegateStatus"]) != 1)
                    {
                        if (Convert.ToInt32(Session["userid"]).Equals(tickets.Submiter) && tickets.Status == 1)
                        {
                            _ticketBs.Delete(tickets);
                            return(RedirectToAction("Index", "MyTechnicalRequest"));
                        }
                        else
                        {
                            return(Content("<script language='javascript' type='text/javascript'>alert('You are Not Included with This Technical Request'); location.href = '" + WebConfigure.GetDomain() + "/MyTechnicalRequest';</script>"));
                        }
                    }
                    else
                    {
                        return(Content("<script language='javascript' type='text/javascript'>alert('Cant Delete Technical Request During Delegation Period'); location.href = '" + WebConfigure.GetDomain() + "/MyTechnicalRequest';</script>"));
                    }
                }

                return(RedirectToAction("Index", "MyTechnicalRequest"));
            }
        }
Пример #24
0
        public ActionResult Update(string id)
        {
            if (Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
                {
                    return(RedirectToAction("Login", "Account"));
                }
                ViewBag.Domain = WebConfigure.GetDomain() + "/Upload/TechnicalRequestAttachments/";
                if (id != null)
                {
                    string ticketCategory = _ticketBs.GetCategoryName(id);

                    var ticket             = _ticketBs.GetByTicketNumber(id);
                    var ticketParticipants = _ticketParticipantBusinessService.GetByTicket(ticket.TicketId);
                    if (!((ticket.Status.Equals(2) && Convert.ToInt32(Session["userid"]) == ticket.Responder) || (ticket.Status.Equals(1) && Convert.ToInt32(Session["userid"]) == ticket.Submiter)))
                    {
                        return(Content("<script language='javascript' type='text/javascript'>alert('You are Not Included with This Technical Request'); location.href = '" + WebConfigure.GetDomain() + "/MyTechnicalRequest';</script>"));
                    }
                    if (Convert.ToInt32(Session["DelegateStatus"]) == 1)
                    {
                        return(Content("<script language='javascript' type='text/javascript'>alert('Cant Update Technical Request During Delegation Period'); location.href = '" + WebConfigure.GetDomain() + "/MyTechnicalRequest';</script>"));
                    }
                    if (ticket.Status == 1 && ticket.Submiter != Convert.ToInt32(Session["userid"]))
                    {
                        return(Content("<script language='javascript' type='text/javascript'>alert('The Technical Request is Not Found'); location.href = '" + WebConfigure.GetDomain() + "/TechnicalRequest';</script>"));
                    }
                    var responder   = _userBusinessService.GetDetail(ticket.Responder);
                    var attachments = _ticketAttachmentBs.GetFullByTicketId(ticket.TicketId);
                    List <TicketAttachmentsAPI> listAttachment = new List <TicketAttachmentsAPI>();
                    string attachmentsPath = System.Web.HttpContext.Current.Server.MapPath("~/Upload/TechnicalRequestAttachments/");
                    if (attachments != null)
                    {
                        foreach (var attachment in attachments)
                        {
                            string[] imgExt = { ".jpg", ".png", ".jpeg", ".gif", ".bmp", ".tif", ".tiff" };

                            if (imgExt.Contains(Path.GetExtension(attachment.Name)))
                            {
                                listAttachment.Add(new TicketAttachmentsAPI
                                {
                                    Id                = attachment.TicketAttachmentId,
                                    Name              = Common.ImageToBase64(attachmentsPath + attachment.Name),
                                    Level             = attachment.LevelUser,
                                    Type              = Path.GetExtension(attachment.Name),
                                    NameWithOutBase64 = attachment.Name
                                });
                            }
                            else
                            {
                                listAttachment.Add(new TicketAttachmentsAPI
                                {
                                    Id                = attachment.TicketAttachmentId,
                                    Name              = attachment.Name,
                                    Level             = attachment.LevelUser,
                                    Type              = Path.GetExtension(attachment.Name),
                                    NameWithOutBase64 = attachment.Name
                                });
                            }
                        }
                    }

                    var tags = _articleTagBs.GetTagsByTicket(ticket.TicketId);
                    WarrantyTypeBusinessService warrantyTypeBusinessService = Factory.Create <WarrantyTypeBusinessService>("WarrantyType", ClassType.clsTypeBusinessService);
                    ViewBag.warrantyType = warrantyTypeBusinessService.Get();
                    ViewBag.Ticket       = ticket;
                    ViewBag.Attachments  = listAttachment;
                    ViewBag.Tags         = tags;
                    ViewBag.Responder    = responder;

                    if (ticketParticipants != null)
                    {
                        ViewBag.Participants = _ticketParticipantBusinessService.GetParticipantWithName(ticketParticipants);
                    }
                    ViewBag.Recent = TechnicalRequest.GetRecentTR(Convert.ToInt32(Session["userid"]));

                    SetListDropdown(int.Parse(Session["userid"].ToString()));

                    return(View("../TechnicalRequest/Update" + ticketCategory));
                }

                return(RedirectToAction("Index", "MyTechnicalRequest"));
            }
        }
Пример #25
0
        public ActionResult Index(int?page, int Category = 0, String keyword = "")
        {
            if (Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
            {
                return(RedirectToAction("Login", "Account"));
            }

            ViewBag.Download     = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention();
            ViewBag.Domain       = domain(isLocal);
            ViewBag.CategoryName = Category == 0 ? null : _articleCategoryBs.GetDetail(Category).Name;
            ViewBag.IconCategory = Category == 0 ? null : _articleCategoryBs.GetDetail(Category).Icon;
            if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj() != "" && Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }
            if (Session["username"] != null)
            {
                if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
                {
                    return(RedirectToAction("Login", "Account"));
                }
            }
            ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null;
            List <Article> listArtikel = null;

            //var start = 6 * (Convert.ToInt32(1) - 1);
            if (Category == 0)
            {
                listArtikel = _literatureService.GetListkeyword(keyword);
            }
            else
            {
                listArtikel = _literatureService.GetListbyCategory(Category, keyword);
            }

            #region Category

            ViewBag.Domain        = WebConfigure.GetDomain();
            ViewBag.ListCategory1 = _articleCategoryBs.GetListCategoryMostUsedLiterature(0);
            ViewBag.key           = keyword;
            #endregion

            List <ArticleFileData>   ArticleData     = new List <ArticleFileData>();
            List <CustomArticleTags> ArticleTagsData = new List <CustomArticleTags>();
            if (listArtikel != null)
            {
                foreach (var item in listArtikel)
                {
                    List <String> FileData = _articleFileBs.GetNamefileByRoleColor(item.ArticleId, item.LevelUser);
                    if (FileData.Count > 0)
                    {
                        ArticleFileData filedata = new ArticleFileData()
                        {
                            idFile = item.ArticleId,
                            Name   = FileData,
                            Level  = _articleFileBs.GetLevelFileByRoleColor(item.ArticleId, item.LevelUser)
                        };
                        ArticleData.Add(filedata);
                    }
                    var TagsData           = _articleTagsBs.GetTagsByArticle(item.ArticleId);
                    CustomArticleTags tags = new CustomArticleTags()
                    {
                        ArticleId = item.ArticleId,
                        Object    = TagsData.Count == 0 ? null : TagsData
                    };
                    ArticleTagsData.Add(tags);
                }
            }
            ViewBag.LiteratureTags = ArticleTagsData;
            ViewBag.keyword        = keyword;
            ViewBag.LiteratureItem = ArticleData;
            int pageSize   = 50;
            int pageNumber = (page ?? 1);
            return(View(listArtikel.ToPagedList(pageNumber, pageSize)));
        }
Пример #26
0
        public ActionResult LoadMore(int?page, int Category = 0, String keyword = "")
        {
            if (Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
            {
                return(RedirectToAction("Login", "Account"));
            }

            ViewBag.Download     = WebConfigure.GetDomain() + "/Upload/Document/" + WebConfigure.GetUserGuideNameFileWithExtention();
            ViewBag.CategoryName = Category == 0 ? null : _articleCategoryBs.GetDetail(Category).Name;
            ViewBag.IconCategory = Category == 0 ? null : _articleCategoryBs.GetDetail(Category).Icon;

            ViewBag.UseFullLink = _articleBs.getUseFullLink().Count > 0 ? _articleBs.getUseFullLink() : null;
            List <Article> listArtikel = null;

            if (Category == 0)
            {
                listArtikel = _literatureService.GetListkeyword(keyword);
            }
            else
            {
                listArtikel = _literatureService.GetListbyCategory(Category, keyword);
            }
            #region Category
            ViewBag.Domain        = domain(isLocal);
            ViewBag.ListCategory1 = _articleCategoryBs.GetListCategoryMostUsedLiterature(0);
            #endregion

            List <ArticleFile>       ArticleData     = new List <ArticleFile>();
            List <CustomArticleTags> ArticleTagsData = new List <CustomArticleTags>();
            if (listArtikel != null)
            {
                foreach (var artikel in listArtikel)
                {
                    var FileData = _articleFileBs.GetListByArtikelId(artikel.ArticleId);
                    if (FileData != null)
                    {
                        foreach (var FileItem in FileData)
                        {
                            var fileCek = _articleFileBs.GetDetail(FileItem.ArticleId);
                            if (fileCek != null)
                            {
                                ArticleFile file = new ArticleFile()
                                {
                                    ArticleId = artikel.ArticleId,
                                    Name      = fileCek.Name,
                                };
                                ArticleData.Add(file);
                            }
                            var TagsData           = _articleTagsBs.GetTagsByArticle(artikel.ArticleId);
                            CustomArticleTags tags = new CustomArticleTags()
                            {
                                ArticleId = artikel.ArticleId,
                                Object    = TagsData.Count == 0 ? null : TagsData
                            };
                            ArticleTagsData.Add(tags);
                        }
                    }
                }
            }
            ViewBag.LiteratureTags = ArticleTagsData;
            ViewBag.LiteratureData = listArtikel;
            ViewBag.LiteratureItem = ArticleData;
            int pageSize   = 50;
            int pageNumber = (page ?? 1);
            return(View(listArtikel.ToPagedList(pageNumber, pageSize)));
        }
Пример #27
0
        public ActionResult SaveFile(int id)
        {
            if (Session["userid"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            if (WebConfigure.GetLoginPortal() == "true" && Common.GetUserXupj().ToLower() != Session["username"].ToString().ToLower())
            {
                return(RedirectToAction("Login", "Account"));
            }

            List <ArticleFile> FileData = _articleFileBs.GetListByArtikelId(id);

            try
            {
                String FileName = "Trakindo TREND-Literature.zip";
                if (FileData.Count == 1)
                {
                    foreach (var data in FileData)
                    {
                        if (Session["roleColor"].ToString().ToLower().Contains("guest"))
                        {
                            if (data.LevelUser.ToLower().Contains("guest"))
                            {
                                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                                Response.ClearContent();
                                Response.Clear();
                                Response.ContentType = "application/msi";
                                Response.AppendHeader("Content-Disposition", "attachment; filename=" + data.Name);
                                Response.TransmitFile(Server.MapPath("~/Upload/Article/Attachments/") + data.Name);
                                Response.End();
                            }
                        }
                        else if (Session["roleColor"].ToString().ToLower().Contains("green"))
                        {
                            if (data.LevelUser.ToLower().Contains("guest") || data.LevelUser.ToLower().Contains("green"))
                            {
                                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                                Response.ClearContent();
                                Response.Clear();
                                Response.ContentType = "application/msi";
                                Response.AppendHeader("Content-Disposition", "attachment; filename=" + data.Name);
                                Response.TransmitFile(Server.MapPath("~/Upload/Article/Attachments/") + data.Name);
                                Response.End();
                            }
                        }
                        else if (Session["roleColor"].ToString().ToLower().Contains("yellow"))
                        {
                            Response.Cache.SetCacheability(HttpCacheability.NoCache);
                            Response.ClearContent();
                            Response.Clear();
                            Response.ContentType = "application/msi";
                            Response.AppendHeader("Content-Disposition", "attachment; filename=" + data.Name);
                            Response.TransmitFile(Server.MapPath("~/Upload/Article/Attachments/") + data.Name);
                            Response.End();
                        }
                    }
                    return(File(FileName, "application/msi"));
                }
                else
                {
                    using (ZipOutputStream zipOutputStream = new ZipOutputStream(System.IO.File.Create(Server.MapPath("~/Upload/Article/Attachments/") + FileName)))
                    {
                        zipOutputStream.SetLevel(9);
                        byte[] buffer   = new Byte[4096];
                        var    DataList = new List <string>();
                        foreach (var datafile in FileData)
                        {
                            if (Session["roleColor"].ToString().ToLower() == "guest")
                            {
                                if (datafile.LevelUser.ToLower() == "guest")
                                {
                                    DataList.Add(Server.MapPath("~/Upload/Article/Attachments/") + datafile.Name);
                                }
                            }
                            else if (Session["roleColor"].ToString().ToLower() == "green")
                            {
                                if (datafile.LevelUser.ToLower() == "guest" || datafile.LevelUser.ToLower() == "green")
                                {
                                    DataList.Add(Server.MapPath("~/Upload/Article/Attachments/") + datafile.Name);
                                }
                            }
                            else if (Session["roleColor"].ToString().ToLower() == "yellow")
                            {
                                DataList.Add(Server.MapPath("~/Upload/Article/Attachments/") + datafile.Name);
                            }
                        }
                        for (int i = 0; i < DataList.Count; i++)
                        {
                            ZipEntry entry = new ZipEntry(Path.GetFileName(DataList[i]));
                            entry.DateTime      = DateTime.Now;
                            entry.IsUnicodeText = true;
                            zipOutputStream.PutNextEntry(entry);

                            using (FileStream fileStream = System.IO.File.OpenRead(DataList[i]))
                            {
                                int sourcebytes;
                                do
                                {
                                    sourcebytes = fileStream.Read(buffer, 0, buffer.Length);
                                    zipOutputStream.Write(buffer, 0, sourcebytes);
                                } while (sourcebytes > 0);
                            }
                        }
                        zipOutputStream.Finish();
                        zipOutputStream.Flush();
                        zipOutputStream.Close();
                    }
                    var    path        = Server.MapPath("~/Upload/Article/Attachments/") + FileName;
                    byte[] finalresult = System.IO.File.ReadAllBytes(path);

                    return(File(finalresult, "application/zip", FileName));
                }
            }
            catch (FileNotFoundException er)
            {
                _LogErrorBs.WriteLog("Download ZIP Literature", MethodBase.GetCurrentMethod().Name, er.ToString());
                return(Content("<script language='javascript' type='text/javascript'>alert('File Literature is Not Found'); location.href = '" + WebConfigure.GetDomain() + "/Literation';</script>"));
                //return RedirectToAction("Index", "Literation");
            }
        }
        public ActionResult UploadUserGuide()
        {
            try
            {
                if (Request.Files.Count > 0)
                {
                    var    file     = Request.Files["file"];
                    string response = Common.ValidateFileUpload(file);

                    if (response.Equals("true"))
                    {
                        if (file != null)
                        {
                            var fileName = Path.GetFileNameWithoutExtension(WebConfigure.GetUserGuideNameFileWithExtention()) + Path.GetExtension(file.FileName);

                            var path = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Upload/Document"), fileName);

                            file.SaveAs(path);
                        }
                    }
                }
                return(Content("<script language='javascript' type='text/javascript'>alert('Upload User Guide was Successfull'); location.href = '" + WebConfigure.GetDomain() + "/Admin/Default/Index';</script>"));
            }
            catch
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Upload User Guide was Failed, Please Make to Sure About Format File and then upload it'); location.href = '" + WebConfigure.GetDomain() + "/Admin/Default/Index';</script>"));
            }
        }
        public ActionResult UploadPSLPartExcel()
        {
            try
            {
                if (Request.Files.Count > 0)
                {
                    var    file     = Request.Files["file"];
                    string response = Common.ValidateFileUpload(file);

                    if (response.Equals("true"))
                    {
                        if (file != null)
                        {
                            var fileName = "PSLPart_File" + Path.GetExtension(file.FileName);
                            var path     = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Upload/Document/"), fileName);
                            file.SaveAs(path);

                            string csvConnectionString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + path +
                                                         ";Extensions=asc,csv,tab,txt;Persist Security Info=False";
                            string oleDbConnectionString =
                                $@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={path};Extended Properties=""Excel 12.0 Xml;HDR=YES""";
                            DataTable dataTable = _mepBusinessService.CreateTablePSLPart(path);
                            _mepBusinessService.BulkUpdatePSLPart(dataTable, WebConfigure.GetMainConnectionString());
                        }
                    }
                }

                return(Content("<script language='javascript' type='text/javascript'>alert('Upload PSLPart Data Excel is Successfull'); location.href = '" + WebConfigure.GetDomain() + "/Admin/Default/Index';</script>"));
            }
            catch (Exception ex)
            {
                _logErrorBService.WriteLog("Admin Upload PSLPart", MethodBase.GetCurrentMethod().Name, ex.ToString());
                return(Content("<script language='javascript' type='text/javascript'>alert('Upload PSLPart Data was Failed, Please Make to Sure About Format File and then upload again'); location.href = '" + WebConfigure.GetDomain() + "/Admin/Default/Index';</script>"));
            }
        }
        public ActionResult UploadMepExcel()
        {
            try
            {
                if (Request.Files.Count > 0)
                {
                    var    file     = Request.Files["file"];
                    string response = Common.ValidateFileUpload(file);

                    if (response.Equals("true"))
                    {
                        if (file != null)
                        {
                            var fileName = "MEP" + Path.GetExtension(file.FileName);

                            var path = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/Upload/"), fileName);

                            file.SaveAs(path);

                            string oleDbConnectionString =
                                $@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={path};Extended Properties=""Excel 12.0 Xml;HDR=YES""";
                            DataTable dataTable = _mepBusinessService.CreateDataTable(oleDbConnectionString);
                            _mepBusinessService.BulkUpdateMep(dataTable, WebConfigure.GetMainConnectionString());
                        }
                    }
                }
                return(Content("<script language='javascript' type='text/javascript'>alert('Upload MEP Excel was Successfull'); location.href = '" + WebConfigure.GetDomain() + "/Admin/Default/Index';</script>"));
            }
            catch
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Upload MEP Excel was Failed, Please Make to Sure about format file to upload then'); location.href = '" + WebConfigure.GetDomain() + "/Admin/Default/Index';</script>"));
            }
        }