Esempio n. 1
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="html"></param>
 public PiranhaHelper(WebPage parent, HtmlHelper html)
 {
     Parent = parent ;
     Html = html ;
     Gravatar = new GravatarHelper() ;
     Culture = new CultureHelper() ;
 }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        MediaLibraryInfo mli = MediaLibraryInfoProvider.GetMediaLibraryInfo(MediaLibraryName, CMSContext.CurrentSiteName);

        if (mli != null)
        {
            // If dont have 'Manage' permission
            if (!MediaLibraryInfoProvider.IsUserAuthorizedPerLibrary(mli, "read"))
            {
                // Check 'File create' permission
                if (!MediaLibraryInfoProvider.IsUserAuthorizedPerLibrary(mli, "libraryaccess"))
                {
                    folderTree.StopProcessing  = true;
                    folderTree.Visible         = false;
                    messageElem.ErrorMessage   = MediaLibraryHelper.GetAccessDeniedMessage("libraryaccess");
                    messageElem.DisplayMessage = true;
                    return;
                }
            }

            // Tree
            if (string.IsNullOrEmpty(MediaLibraryPath))
            {
                folderTree.RootFolderPath     = MediaLibraryHelper.GetMediaRootFolderPath(CMSContext.CurrentSiteName);
                folderTree.MediaLibraryFolder = mli.LibraryFolder;
            }
            else
            {
                folderTree.RootFolderPath = MediaLibraryHelper.GetMediaRootFolderPath(CMSContext.CurrentSiteName) + mli.LibraryFolder;
                int index = MediaLibraryPath.LastIndexOfCSafe('/');
                if ((index > -1) && (MediaLibraryPath.Length > (index + 1)))
                {
                    folderTree.MediaLibraryFolder = MediaLibraryPath.Substring(index + 1);
                }
                else
                {
                    folderTree.MediaLibraryFolder = MediaLibraryPath;
                }
                folderTree.MediaLibraryPath = MediaLibraryPath.Replace("/", "\\");
            }

            // Set images path
            if (CultureHelper.IsPreferredCultureRTL())
            {
                folderTree.ImageFolderPath = GetImageUrl("RTL/Design/Controls/Tree", true, true);
            }
            else
            {
                folderTree.ImageFolderPath = GetImageUrl("Design/Controls/Tree", true, true);
            }

            folderTree.SourceFilterName     = FilterName;
            folderTree.FileIDQueryStringKey = FileIDQueryStringKey;
            folderTree.PathQueryStringKey   = PathQueryStringKey;
            folderTree.DisplayFileCount     = DisplayFileCount;

            // Add tree to the filter collection
            CMSControlsHelper.SetFilter(ValidationHelper.GetString(GetValue("WebPartControlID"), ID), folderTree);
        }
        else
        {
            folderTree.StopProcessing = true;
            folderTree.Visible        = false;
        }
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Switch the view mode
        CMSContext.ViewMode = ViewModeEnum.LiveSite;

        // Get the document
        int nodeId = 0;

        if (Request.QueryString["nodeid"] != null)
        {
            nodeId = ValidationHelper.GetInteger(Request.QueryString["nodeid"], 0);
        }

        string       siteName = CMSContext.CurrentSiteName;
        TreeProvider tree     = new TreeProvider(CMSContext.CurrentUser);
        TreeNode     node     = null;

        // Check split mode
        bool isSplitMode = CMSContext.DisplaySplitMode;
        bool combineWithDefaultCulture = isSplitMode ? false : SiteInfoProvider.CombineWithDefaultCulture(siteName);

        // Get the document
        node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode, combineWithDefaultCulture);

        // Redirect to the live URL
        string url = null;

        if (node != null)
        {
            // Check if the node is published or available
            if (!node.DocumentCulture.Equals(CMSContext.PreferredCultureCode, StringComparison.InvariantCultureIgnoreCase) && (!SiteInfoProvider.CombineWithDefaultCulture(siteName) || !node.DocumentCulture.Equals(CultureHelper.GetDefaultCulture(siteName), StringComparison.InvariantCultureIgnoreCase)))
            {
                url = "~/CMSMessages/PageNotAvailable.aspx?reason=missingculture";
            }

            if ((url == null) && !node.IsPublished && URLRewriter.PageNotFoundForNonPublished(siteName))
            {
                // Try to find published document in default culture
                if (SiteInfoProvider.CombineWithDefaultCulture(siteName))
                {
                    string defaultCulture = CultureHelper.GetDefaultCulture(siteName);
                    node = tree.SelectSingleNode(nodeId, defaultCulture, false);
                    if ((node != null) && node.IsPublished)
                    {
                        // Do not use document URL path - preferred culture could be changed
                        url = CMSContext.GetUrl(node.NodeAliasPath, null);
                    }
                }

                if (url == null)
                {
                    // Document is not published
                    url = "~/CMSMessages/PageNotAvailable.aspx?reason=notpublished";
                }
            }
        }
        else
        {
            url = isSplitMode ? "~/CMSModules/Content/CMSDesk/New/NewCultureVersion.aspx" + URLHelper.Url.Query : "~/CMSMessages/PageNotAvailable.aspx?reason=missingculture&showlink=false";
        }

        if (url == null)
        {
            // Do not use document URL path - preferred culture could be changed
            url = CMSContext.GetUrl(node.NodeAliasPath, null);
        }

        // Split mode
        if (CMSContext.DisplaySplitMode)
        {
            url = URLHelper.AddParameterToUrl(url, "cmssplitmode", "1");
        }

        URLHelper.Redirect(url);
    }
 public static void ApplyInstalledCulture()
 {
     CultureHelper.ApplyUICulture(GlobalEditorOptions.GetSetting <string>(ContentEditorSetting.Language));
 }
Esempio n. 5
0
 public string TitleTranslated()
 {
     return(CultureHelper.IsNorwegian()
         ? Title
         : (!string.IsNullOrWhiteSpace(EnglishTitle) ? EnglishTitle : Title));
 }
Esempio n. 6
0
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44612);

            ViewBag.Permission = permission;
            var varMS_Uso_del_Ejercicio = new MS_Uso_del_EjercicioModel();

            ViewBag.ObjectId  = "44612";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IMS_Uso_del_EjercicioApiConsumer.SetAuthHeader(_tokenManager.Token);
                var MS_Uso_del_EjercicioData = _IMS_Uso_del_EjercicioApiConsumer.GetByKeyComplete(Id).Resource.MS_Uso_del_Ejercicios[0];
                if (MS_Uso_del_EjercicioData == null)
                {
                    return(HttpNotFound());
                }

                varMS_Uso_del_Ejercicio = new MS_Uso_del_EjercicioModel
                {
                    Folio = (int)MS_Uso_del_EjercicioData.Folio
                    , Uso_del_Ejercicio            = MS_Uso_del_EjercicioData.Uso_del_Ejercicio
                    , Uso_del_EjercicioDescripcion = CultureHelper.GetTraduction(Convert.ToString(MS_Uso_del_EjercicioData.Uso_del_Ejercicio), "Tipo_de_Ejercicio_Rutina") ?? (string)MS_Uso_del_EjercicioData.Uso_del_Ejercicio_Tipo_de_Ejercicio_Rutina.Descripcion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ITipo_de_Ejercicio_RutinaApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Tipo_de_Ejercicio_Rutinas_Uso_del_Ejercicio = _ITipo_de_Ejercicio_RutinaApiConsumer.SelAll(true);

            if (Tipo_de_Ejercicio_Rutinas_Uso_del_Ejercicio != null && Tipo_de_Ejercicio_Rutinas_Uso_del_Ejercicio.Resource != null)
            {
                ViewBag.Tipo_de_Ejercicio_Rutinas_Uso_del_Ejercicio = Tipo_de_Ejercicio_Rutinas_Uso_del_Ejercicio.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Tipo_de_Ejercicio_Rutina", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varMS_Uso_del_Ejercicio));
        }
    protected void WriteTablesContent()
    {
        foreach (object[] table in tables)
        {
            // Prepare the components
            DataTable         dt            = (DataTable)table[0];
            LiteralControl    ltlContent    = (LiteralControl)table[1];
            UIPager           pagerElem     = (UIPager)table[2];
            UniPagerConnector connectorElem = (UniPagerConnector)table[3];

            // Handle the different types of direct page selector
            int currentPageSize = pagerElem.CurrentPageSize;
            if (currentPageSize > 0)
            {
                if (connectorElem.PagerForceNumberOfResults / (float)currentPageSize > 20.0f)
                {
                    pagerElem.DirectPageControlID = "txtPage";
                }
                else
                {
                    pagerElem.DirectPageControlID = "drpPage";
                }
            }

            // Bind the pager first
            connectorElem.RaiseOnPageBinding(null, null);

            // Prepare the string builder
            StringBuilder sb = new StringBuilder();

            // Prepare the indexes for paging
            int pageSize = pagerElem.CurrentPageSize;

            int startIndex = (pagerElem.CurrentPage - 1) * pageSize + 1;
            int endIndex   = startIndex + pageSize;

            // Process all items
            int  index = 0;
            bool all   = (endIndex <= startIndex);

            if (dt.Columns.Count > 6)
            {
                // Write all rows
                foreach (DataRow dr in dt.Rows)
                {
                    index++;
                    if (all || (index >= startIndex) && (index < endIndex))
                    {
                        sb.Append("<table class=\"table table-hover\">");

                        // Add header
                        sb.AppendFormat("<thead><tr class=\"unigrid-head\"><th>{0}</th><th class=\"main-column-100\">{1}</th></tr></thead><tbody>", GetString("General.FieldName"), GetString("General.Value"));

                        // Add values
                        foreach (DataColumn dc in dt.Columns)
                        {
                            object value = dr[dc.ColumnName];

                            // Binary columns
                            string content;
                            if ((dc.DataType == typeof(byte[])) && (value != DBNull.Value))
                            {
                                byte[] data = (byte[])value;
                                content = "<" + GetString("General.BinaryData") + ", " + DataHelper.GetSizeString(data.Length) + ">";
                            }
                            else
                            {
                                content = ValidationHelper.GetString(value, String.Empty);
                            }

                            if (!String.IsNullOrEmpty(content))
                            {
                                sb.AppendFormat("<tr><td><strong>{0}</strong></td><td class=\"wrap-normal\">", dc.ColumnName);

                                // Possible DataTime columns
                                if ((dc.DataType == typeof(DateTime)) && (value != DBNull.Value))
                                {
                                    DateTime    dateTime    = Convert.ToDateTime(content);
                                    CultureInfo cultureInfo = CultureHelper.GetCultureInfo(MembershipContext.AuthenticatedUser.PreferredUICultureCode);
                                    content = dateTime.ToString(cultureInfo);
                                }

                                // Process content
                                ProcessContent(sb, dr, dc.ColumnName, ref content);

                                sb.Append("</td></tr>");
                            }
                        }

                        sb.Append("</tbody></table>\n");
                    }
                }
            }
            else
            {
                sb.Append("<table class=\"table table-hover\">");

                // Add header
                sb.Append("<thead><tr class=\"unigrid-head\">");
                int h = 1;
                foreach (DataColumn column in dt.Columns)
                {
                    sb.AppendFormat("<th{0}>{1}</th>", (h == dt.Columns.Count) ? " class=\"main-column-100\"" : String.Empty, column.ColumnName);
                    h++;
                }
                sb.Append("</tr></thead><tbody>");

                // Write all rows
                foreach (DataRow dr in dt.Rows)
                {
                    index++;
                    if (all || (index >= startIndex) && (index < endIndex))
                    {
                        sb.Append("<tr>");

                        // Add values
                        foreach (DataColumn dc in dt.Columns)
                        {
                            object value = dr[dc.ColumnName];
                            // Possible DataTime columns
                            if ((dc.DataType == typeof(DateTime)) && (value != DBNull.Value))
                            {
                                DateTime    dateTime    = Convert.ToDateTime(value);
                                CultureInfo cultureInfo = CultureHelper.GetCultureInfo(MembershipContext.AuthenticatedUser.PreferredUICultureCode);
                                value = dateTime.ToString(cultureInfo);
                            }

                            string content = ValidationHelper.GetString(value, String.Empty);
                            content = HTMLHelper.HTMLEncode(content);

                            sb.AppendFormat("<td{0}>{1}</td>", (content.Length >= 100) ? " class=\"wrap-normal\"" : String.Empty, content);
                        }
                        sb.Append("</tr>");
                    }
                }
                sb.Append("</tbody></table>\n");
            }

            ltlContent.Text = sb.ToString();
        }
    }
Esempio n. 8
0
        public ActionResult FileEditor(long?id, int?topicid, string previousRequest)
        {
            FileCreate fileCreate = null;

            if (id == null)
            {
                fileCreate = new FileCreate();
                var eikonUserId = UserSettingHelper.GetEikonUserID(Request);
                var submitter   = IPPRepository.GeSubmitterById(eikonUserId);

                fileCreate.SubmitterID  = submitter.ID;
                fileCreate.SubmiterName = submitter.Name;
                fileCreate.Submiter     = submitter.Email;
            }
            else
            {
                fileCreate = IPPRepository.GetFileByFileID((long)id);
            }

            IPPFile ippFile;

            fileCreate = fileCreate ?? new FileCreate();
            var moduleItems     = new List <SelectListItem>();
            var topicItems      = new List <SelectListItem>();
            var ricTypeItems    = new List <SelectListItem>();
            var uploadTypeItems = HtmlUtil.CookSelectOptions("Ipp_UploadType");

            if (id != null)
            {
                topicid = IPPRepository.GetTopicIdByFileId(id);
            }

            IEnumerable <MODULEINFO> modules = IPPRepository.GetModuleList();
            var moduleId = (topicid == null || topicid == 0)? modules.FirstOrDefault().ID : (int)IPPRepository.GetModuleIdByTopicId((int)topicid);
            var topics   = IPPRepository.GetTopicListByModuleId(moduleId);

            foreach (var m in modules)
            {
                moduleItems.Add(new SelectListItem {
                    Selected = m.ID == moduleId ? true : false, Value = m.ID.ToString(), Text = CultureHelper.IsEnglishCulture() ? m.NAMEEN : m.NAMECN
                });
            }

            var selectedTopicId = topicid == null?topics.FirstOrDefault().ID : topicid;

            foreach (var m in topics)
            {
                topicItems.Add(new SelectListItem {
                    Selected = m.ID == selectedTopicId ? true : false, Value = m.ID.ToString(), Text = CultureHelper.IsEnglishCulture() ? m.NAMEEN : m.NAMECN
                });
            }

            ricTypeItems.Add(new SelectListItem {
                Value = "Graph", Text = "Chart"
            });
            ricTypeItems.Add(new SelectListItem {
                Value = "Quote Object", Text = "Quote"
            });
            ricTypeItems.Add(new SelectListItem {
                Value = "News", Text = "News"
            });

            var userAttibuteMap = UserSettingHelper.GetUserAttributeMap(Request);
            var author          = userAttibuteMap == null ? "" : userAttibuteMap.First(x => x.name.ToLower() == "FullName".ToLower()).value;
            var source          = userAttibuteMap == null ? "" : userAttibuteMap.First(x => x.name.ToLower() == "AccountName".ToLower()).value;

            if (UserSettingHelper.IsInternalUser(Request))
            {
                source = "Thomson Reuters";
            }

            ippFile = new IPPFile
            {
                Id                                              = fileCreate.ID,
                Author                                          = string.IsNullOrEmpty(fileCreate.Author) ? author : fileCreate.Author,
                AuthorRM                                        = fileCreate.AuthorRM,
                AuthorEmail                                     = fileCreate.AuthorEmail,
                DescriptionCn                                   = fileCreate.DescrCn,
                DescriptionEn                                   = fileCreate.DescrEn,
                UploadType                                      = fileCreate.UploadType,
                FileType                                        = fileCreate.FileType,
                WebsiteRic                                      = fileCreate.UploadType == "Upload_Website" ? fileCreate.RIC : "",
                EikonRic                                        = fileCreate.UploadType == "Upload_Ric" ? fileCreate.RIC : "",
                ReportDate                                      = fileCreate.ReportDate.ToString("yyyy-MM-dd"),
                SubmitterID                                     = fileCreate.SubmitterID,
                SubmiterName                                    = fileCreate.SubmiterName,
                Submiter                                        = fileCreate.Submiter,
                Tag                                             = fileCreate.Tag != null?fileCreate.Tag.Replace('|', ';') : fileCreate.Tag,
                                                TitleCn         = fileCreate.TitleCn,
                                                TitleEn         = fileCreate.TitleEn,
                                                ModuleItems     = moduleItems,
                                                Topic           = selectedTopicId.ToString(),
                                                TopicItems      = topicItems,
                                                UploadTypeItems = uploadTypeItems,
                                                RicTypeItems    = ricTypeItems,
                                                Source          = string.IsNullOrEmpty(fileCreate.Source) ? source : fileCreate.Source,
                                                PreviousRequest = previousRequest,
                                                Status          = fileCreate.Status,
                                                FileName        = fileCreate.FileName,
                                                DisplayOrder    = fileCreate.DisplayOrder
            };

            return(View(ippFile));
        }
Esempio n. 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get query parameters
        selectedNodeType         = QueryHelper.GetString("selectednodetype", "webpart");
        selectedNodeName         = QueryHelper.GetString("selectednodename", string.Empty);
        hdnCurrentNodeType.Value = selectedNodeType;
        hdnCurrentNodeName.Value = selectedNodeName;

        bool enabled = DocumentManager.AllowSave;

        btnDelete.Enabled = enabled && !string.IsNullOrEmpty(selectedNodeName);
        if (btnDelete.Enabled)
        {
            btnDelete.OnClientClick = "return DeleteItem();";
            btnDelete.ToolTip       = GetString("Development-WebPart_Tree.DeleteItem");
        }

        btnNew.Enabled = enabled;
        if (btnNew.Enabled)
        {
            btnNew.OnClientClick = "return CreateNew();";
            btnNew.ToolTip       = GetString("Development-WebPart_Tree.NewWebPart");
        }

        string imageUrl = "Design/Controls/Tree";

        // Initialize page
        if (CultureHelper.IsUICultureRTL())
        {
            imageUrl = GetImageUrl("RTL/" + imageUrl, false, false);
        }
        else
        {
            imageUrl = GetImageUrl(imageUrl, false, false);
        }
        webpartsTree.LineImagesFolder = imageUrl;
        regionsTree.LineImagesFolder  = imageUrl;

        if (Node != null)
        {
            string webPartRootAttributes;
            string regionRootAttributes;

            if (string.IsNullOrEmpty(selectedNodeName))
            {
                switch (selectedNodeType)
                {
                case "webpart":
                    webPartRootAttributes = "class=\"ContentTreeSelectedItem\" id=\"treeSelectedNode\"";
                    regionRootAttributes  = "class=\"ContentTreeItem\" ";
                    break;

                case "region":
                    webPartRootAttributes = "class=\"ContentTreeItem\" ";
                    regionRootAttributes  = "class=\"ContentTreeSelectedItem\" id=\"treeSelectedNode\"";
                    break;

                default:
                    webPartRootAttributes = "class=\"ContentTreeSelectedItem\" id=\"treeSelectedNode\"";
                    regionRootAttributes  = "class=\"ContentTreeItem\" ";
                    break;
                }
            }
            else
            {
                webPartRootAttributes = "class=\"ContentTreeSelectedItem\" id=\"treeSelectedNode\"";
                regionRootAttributes  = "class=\"ContentTreeItem\" ";
            }

            // Create tree menus
            TreeElemNode rootWebpartNode = new TreeElemNode();
            rootWebpartNode.Text        = "<span " + webPartRootAttributes + " onclick=\"SelectNode('','webpart', this);\"><span class=\"Name\">" + ScriptHelper.GetLocalizedString("EditableWebparts.Root", false) + "</span></span>";
            rootWebpartNode.Expanded    = true;
            rootWebpartNode.NavigateUrl = "#";

            TreeElemNode rootRegionNode = new TreeElemNode();
            rootRegionNode.Text        = "<span " + regionRootAttributes + " onclick=\"SelectNode('','region', this);\"><span class=\"Name\">" + ScriptHelper.GetLocalizedString("EditableRegions.Root", false) + "</span></span>";
            rootRegionNode.Expanded    = true;
            rootRegionNode.NavigateUrl = "#";

            // Editable web parts
            webpartsTree.Nodes.Add(rootWebpartNode);
            if (Node.DocumentContent.EditableWebParts.Count > 0)
            {
                foreach (DictionaryEntry webPart in Node.DocumentContent.EditableWebParts)
                {
                    string key  = webPart.Key.ToString();
                    string name = DictionaryHelper.GetFirstKey(key);
                    AddNode(rootWebpartNode, name, "webpart");
                }
            }

            // Editable regions
            regionsTree.Nodes.Add(rootRegionNode);
            if (Node.DocumentContent.EditableRegions.Count > 0)
            {
                foreach (DictionaryEntry region in Node.DocumentContent.EditableRegions)
                {
                    string key  = region.Key.ToString();
                    string name = DictionaryHelper.GetFirstKey(key);
                    AddNode(rootRegionNode, name, "region");
                }
            }
        }

        // Delete item if requested from query string
        string nodeType = QueryHelper.GetString("nodetype", null);
        string nodeName = QueryHelper.GetString("nodename", null);

        if (!RequestHelper.IsPostBack() && !String.IsNullOrEmpty(nodeType) && QueryHelper.GetBoolean("deleteItem", false))
        {
            DeleteItem(nodeType, nodeName);
        }
    }
Esempio n. 10
0
    protected DataSet gridDocuments_OnDataReload(string completeWhere, string currentOrder, int currentTopN, string columns, int currentOffset, int currentPageSize, ref int totalRecords)
    {
        columns = SqlHelper.MergeColumns(DocumentHelper.GETDOCUMENTS_REQUIRED_COLUMNS, "NodeAlias, NodeGUID, DocumentName, DocumentCulture, DocumentModifiedWhen, Published, DocumentType, DocumentWorkflowStepID, DocumentCheckedOutByUserID, SiteName, NodeSiteID, NodeOwner, FileAttachment, FileDescription, DocumentName AS PublishedDocumentName, DocumentType AS PublishedDocumentType");
        if (CheckPermissions)
        {
            columns = SqlHelper.MergeColumns(TreeProvider.SECURITYCHECK_REQUIRED_COLUMNS, columns);
        }

        string whereCondition = null;

        // Filter group documents
        whereCondition = (GroupID != 0) ? SqlHelper.AddWhereCondition(whereCondition, "(NodeGroupID=" + GroupID + ") OR (NodeGroupID IS NULL)") : SqlHelper.AddWhereCondition(whereCondition, "NodeGroupID IS NULL");

        // Retrieve documents
        DataSet documentsDataSet = DocumentHelper.GetDocuments(CurrentSite.SiteName, MacroResolver.ResolveCurrentPath(LibraryPath) + "/%", null, CombineWithDefaultCulture, CMS_FILE, whereCondition, currentOrder, 1, false, currentTopN, columns, TreeProvider);

        NodePermissionsEnum[] permissionsToCheck = null;

        // Filter documents by permissions
        if (CheckPermissions)
        {
            documentsDataSet   = TreeSecurityProvider.FilterDataSetByPermissions(documentsDataSet, NodePermissionsEnum.Read, CurrentUser);
            permissionsToCheck = new NodePermissionsEnum[] { NodePermissionsEnum.Modify, NodePermissionsEnum.ModifyPermissions, NodePermissionsEnum.Delete };
        }

        string cultures = PreferredCultureCode;

        if (CombineWithDefaultCulture)
        {
            string siteDefaultCulture = CultureHelper.GetDefaultCultureCode(SiteContext.CurrentSiteName);
            if (CMSString.Compare(siteDefaultCulture, PreferredCultureCode, true) != 0)
            {
                cultures += ";" + siteDefaultCulture;
            }
        }

        if (CheckPermissions)
        {
            // Ensure permissions flags
            documentsDataSet = TreeSecurityProvider.FilterDataSetByPermissions(documentsDataSet, permissionsToCheck, CurrentUser, false, cultures);
        }

        // Filter archived documents for users without modify permission
        if (!DataHelper.DataSourceIsEmpty(documentsDataSet))
        {
            DataTable dt         = documentsDataSet.Tables[0];
            ArrayList deleteRows = new ArrayList();
            foreach (DataRow dr in dt.Rows)
            {
                // If the document is not published and user hasn't modify permission, remove it from data set
                bool   isPublished     = ValidationHelper.GetBoolean(dr["Published"], true);
                string documentCulture = ValidationHelper.GetString(dr["DocumentCulture"], null);
                bool   hasModify       = TreeSecurityProvider.CheckPermission(dr, NodePermissionsEnum.Modify, documentCulture);
                if (!isPublished && !hasModify)
                {
                    deleteRows.Add(dr);
                }
            }

            // Remove archived documents
            foreach (DataRow dr in deleteRows)
            {
                dt.Rows.Remove(dr);
            }
        }

        totalRecords = DataHelper.GetItemsCount(documentsDataSet);
        return(documentsDataSet);
    }
Esempio n. 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check license
        LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.DocumentLibrary);

        // Propagate Check permissions to underlying components
        arrowContextMenu.CheckPermissions = rowContextMenu.CheckPermissions = CheckPermissions;

        if (StopProcessing || (LibraryNode == null))
        {
            gridDocuments.StopProcessing    = true;
            arrowContextMenu.StopProcessing = true;
            rowContextMenu.StopProcessing   = true;
            copyElem.StopProcessing         = true;
            deleteElem.StopProcessing       = true;
            localizeElem.StopProcessing     = true;
            propertiesElem.StopProcessing   = true;
            permissionsElem.StopProcessing  = true;
            versionsElem.StopProcessing     = true;
            DocumentManager.StopProcessing  = true;
            pnlHeader.Visible = false;

            if (LibraryNode == null)
            {
                lblError.Text = ResHelper.GetStringFormat("documentlibrary.libraryrootnotexist", LibraryPath);
            }
        }
        else
        {
            gridDocuments.OnDataReload        += gridDocuments_OnDataReload;
            gridDocuments.OnExternalDataBound += gridDocuments_OnExternalDataBound;
            gridDocuments.OrderBy              = OrderBy;
            gridDocuments.IsLiveSite           = IsLiveSite;
            copyTitle.IsLiveSite              = IsLiveSite;
            propertiesTitle.IsLiveSite        = IsLiveSite;
            permissionsElem.IsLiveSite        = IsLiveSite;
            arrowContextMenu.IsLiveSite       = IsLiveSite;
            arrowContextMenu.JavaScriptPrefix = JS_PREFIX;
            arrowContextMenu.DocumentForm     = DocumentForm;
            rowContextMenu.IsLiveSite         = IsLiveSite;
            rowContextMenu.JavaScriptPrefix   = JS_PREFIX;
            rowContextMenu.DocumentForm       = DocumentForm;
            DocumentManager.IsLiveSite        = IsLiveSite;

            // Optimize context menu position for all supported browsers
            bool isRTL = (IsLiveSite && CultureHelper.IsPreferredCultureRTL()) || (!IsLiveSite && CultureHelper.IsUICultureRTL());
            if (BrowserHelper.IsGecko() || BrowserHelper.IsIE8())
            {
                arrowContextMenu.OffsetX = isRTL ? 0 : -1;
                if (BrowserHelper.IsIE8())
                {
                    arrowContextMenu.OffsetY = 21;
                }
            }
            else if (BrowserHelper.IsIE7())
            {
                arrowContextMenu.OffsetX = isRTL ? 0 : -2;
            }
            else if (BrowserHelper.IsWebKit())
            {
                arrowContextMenu.OffsetX = isRTL ? -1 : 1;
                arrowContextMenu.OffsetY = 21;
            }

            // Register full postback
            ControlsHelper.RegisterPostbackControl(btnLocalizeSaveClose);

            // Ensure adequate z-index for UI dialogs
            ScriptHelper.RegisterStartupScript(this, typeof(string), "dialogZIndex", ScriptHelper.GetScript("window.dialogZIndex = 30000;"));

            // Action handling scripts
            StringBuilder actionScript = new StringBuilder();

            actionScript.AppendLine("function SetParameter_" + ClientID + "(parameter)");
            actionScript.AppendLine("{");
            actionScript.AppendLine("   document.getElementById('" + hdnParameter.ClientID + "').value =  parameter;");
            actionScript.AppendLine("}");

            actionScript.AppendLine("function " + Action.RefreshGridSimple + "_" + ClientID + "()");
            actionScript.AppendLine("{");
            actionScript.AppendLine("   " + ControlsHelper.GetPostBackEventReference(this, Action.RefreshGridSimple.ToString()) + ";");
            actionScript.AppendLine("}");

            actionScript.AppendLine("function " + Action.HidePopup + "_" + ClientID + "()");
            actionScript.AppendLine("{");
            actionScript.AppendLine("   " + ControlsHelper.GetPostBackEventReference(this, Action.HidePopup.ToString()) + ";");
            actionScript.AppendLine("}");

            actionScript.AppendLine("function " + Action.InitRefresh + "_" + ClientID + "(message, fullRefresh, mode)");
            actionScript.AppendLine("{");
            actionScript.AppendLine("   if(message != '')");
            actionScript.AppendLine("   {");
            actionScript.AppendLine("       alert(message);");
            actionScript.AppendLine("   }");
            actionScript.AppendLine("   else");
            actionScript.AppendLine("   {");
            actionScript.AppendLine("       " + Action.RefreshGridSimple + "_" + ClientID + "();");
            actionScript.AppendLine("   }");
            actionScript.AppendLine("}");

            actionScript.AppendLine("function InitRefresh_" + arrowContextMenu.ClientID + "(message, fullRefresh, mode)");
            actionScript.AppendLine("{");
            actionScript.AppendLine(Action.InitRefresh + "_" + ClientID + "(message, fullRefresh, mode);");
            actionScript.AppendLine("}");

            actionScript.AppendLine("function InitRefresh_" + rowContextMenu.ClientID + "(message, fullRefresh, mode)");
            actionScript.AppendLine("{");
            actionScript.AppendLine(Action.InitRefresh + "_" + ClientID + "(message, fullRefresh, mode);");
            actionScript.AppendLine("}");

            actionScript.AppendLine("function " + JS_PREFIX + "PerformAction(parameter, action)");
            actionScript.AppendLine("{");
            actionScript.AppendLine("   SetParameter_" + ClientID + "(parameter);");
            actionScript.AppendLine("   " + ControlsHelper.GetPostBackEventReference(this, "##PARAM##").Replace("'##PARAM##'", "action"));
            actionScript.AppendLine("}");

            ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "actionScript" + ClientID, ScriptHelper.GetScript(actionScript.ToString()));

            // Setup title elements
            localizeTitle.TitleText = GetString("documentlibrary.localizedocument");

            copyTitle.TitleText = GetString("documentlibrary.copydocument");

            deleteTitle.TitleText = GetString("documentlibrary.deletedocument");

            propertiesTitle.TitleText = GetString("documentlibrary.documentproperties");

            permissionsTitle.TitleText = GetString("documentlibrary.documentpermissions");

            versionsTitle.TitleText = GetString("LibraryContextMenu.VersionHistory");

            // Initialize new file uploader
            bool uploadVisible = (CurrentUser.IsAuthorizedPerDocument(LibraryNode, new NodePermissionsEnum[] { NodePermissionsEnum.Read, NodePermissionsEnum.Modify }) == AuthorizationResultEnum.Allowed) && IsAuthorizedToCreate;
            uploadAttachment.Visible = uploadVisible;
            if (uploadVisible)
            {
                uploadAttachment.Text = GetString("documentlibrary.newdocument");
                uploadAttachment.InnerElementClass = "LibraryUploader";
                uploadAttachment.NodeParentNodeID  = LibraryNode.NodeID;
                uploadAttachment.ParentElemID      = ClientID;
                uploadAttachment.SourceType        = MediaSourceEnum.Content;
                uploadAttachment.DisplayInline     = true;
                uploadAttachment.IsLiveSite        = IsLiveSite;
                uploadAttachment.NodeGroupID       = GroupID;
                uploadAttachment.DocumentCulture   = DocumentContext.CurrentDocumentCulture.CultureCode;
                uploadAttachment.CheckPermissions  = true;
                uploadAttachment.Width             = 100;

                // Set allowed extensions
                if ((FieldInfo != null) && ValidationHelper.GetString(FieldInfo.Settings["extensions"], "") == "custom")
                {
                    // Load allowed extensions
                    uploadAttachment.AllowedExtensions = ValidationHelper.GetString(FieldInfo.Settings["allowed_extensions"], "");
                }
                else
                {
                    // Use site settings
                    string siteName = SiteContext.CurrentSiteName;
                    uploadAttachment.AllowedExtensions = SettingsKeyInfoProvider.GetStringValue(siteName + ".CMSUploadExtensions");
                }
                uploadAttachment.ReloadData();
            }

            // Check permissions, for group document library also group administrator can modify the permissions
            bool hasModifyPermission = (CurrentUser.IsAuthorizedPerDocument(LibraryNode, new NodePermissionsEnum[] { NodePermissionsEnum.Read, NodePermissionsEnum.ModifyPermissions }) == AuthorizationResultEnum.Allowed) || IsGroupAdmin;

            if (!hasModifyPermission)
            {
                btnPermissions.AddCssClass("hidden");
            }
            btnPermissions.Enabled = hasModifyPermission;
            pnlHeader.Visible      = hasModifyPermission || uploadVisible;
        }
    }
Esempio n. 12
0
    /// <summary>
    /// Performs search.
    /// </summary>
    private SearchResult PredictiveSearch(string searchText)
    {
        // Prepare search text
        var docCondition = new DocumentSearchCondition(PredictiveSearchDocumentTypes, PredictiveSearchCultureCode, CultureHelper.GetDefaultCultureCode(SiteContext.CurrentSiteName), PredictiveSearchCombineWithDefaultCulture);
        var condition    = new SearchCondition(PredictiveSearchCondition, PredictiveSearchMode, PredictiveSearchOptions, docCondition);

        string searchCondition = SearchSyntaxHelper.CombineSearchCondition(searchText, condition);

        // Prepare parameters
        SearchParameters parameters = new SearchParameters()
        {
            SearchFor                 = searchCondition,
            SearchSort                = PredictiveSearchSort,
            Path                      = PredictiveSearchPath,
            ClassNames                = PredictiveSearchDocumentTypes,
            CurrentCulture            = PredictiveSearchCultureCode,
            DefaultCulture            = CultureHelper.GetDefaultCultureCode(SiteContext.CurrentSiteName),
            CombineWithDefaultCulture = PredictiveSearchCombineWithDefaultCulture,
            CheckPermissions          = PredictiveSearchCheckPermissions,
            SearchInAttachments       = false,
            User                      = MembershipContext.AuthenticatedUser,
            SearchIndexes             = PredictiveSearchIndexes,
            StartingPosition          = 0,
            DisplayResults            = PredictiveSearchMaxResults,
            NumberOfProcessedResults  = 100 > PredictiveSearchMaxResults ? PredictiveSearchMaxResults : 100,
            NumberOfResults           = 0,
            AttachmentWhere           = null,
            AttachmentOrderBy         = null,
            BlockFieldOnlySearch      = PredictiveSearchBlockFieldOnlySearch,
        };

        var results = SearchHelper.Search(parameters);

        return(results);
    }
Esempio n. 13
0
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45302);

            ViewBag.Permission = permission;
            var varCircunstancias_del_Delito = new Circunstancias_del_DelitoModel();

            ViewBag.ObjectId  = "45302";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ICircunstancias_del_DelitoApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Circunstancias_del_DelitoData = _ICircunstancias_del_DelitoApiConsumer.GetByKeyComplete(Id).Resource.Circunstancias_del_Delitos[0];
                if (Circunstancias_del_DelitoData == null)
                {
                    return(HttpNotFound());
                }

                varCircunstancias_del_Delito = new Circunstancias_del_DelitoModel
                {
                    Clave                      = (int)Circunstancias_del_DelitoData.Clave
                    , Tipo_de_Lugar            = Circunstancias_del_DelitoData.Tipo_de_Lugar
                    , Tipo_de_LugarDescripcion = CultureHelper.GetTraduction(Convert.ToString(Circunstancias_del_DelitoData.Tipo_de_Lugar), "Tipo_de_Lugar_del_Robo") ?? (string)Circunstancias_del_DelitoData.Tipo_de_Lugar_Tipo_de_Lugar_del_Robo.Descripcion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ITipo_de_Lugar_del_RoboApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Tipo_de_Lugar_del_Robos_Tipo_de_Lugar = _ITipo_de_Lugar_del_RoboApiConsumer.SelAll(true);

            if (Tipo_de_Lugar_del_Robos_Tipo_de_Lugar != null && Tipo_de_Lugar_del_Robos_Tipo_de_Lugar.Resource != null)
            {
                ViewBag.Tipo_de_Lugar_del_Robos_Tipo_de_Lugar = Tipo_de_Lugar_del_Robos_Tipo_de_Lugar.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Tipo_de_Lugar_del_Robo", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varCircunstancias_del_Delito));
        }
Esempio n. 14
0
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44441);

            ViewBag.Permission = permission;
            var varDetalle_Registro_en_Actividad_Evento = new Detalle_Registro_en_Actividad_EventoModel();

            ViewBag.ObjectId  = "44441";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_Registro_en_Actividad_EventoApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Registro_en_Actividad_EventoData = _IDetalle_Registro_en_Actividad_EventoApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Registro_en_Actividad_Eventos[0];
                if (Detalle_Registro_en_Actividad_EventoData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Registro_en_Actividad_Evento = new Detalle_Registro_en_Actividad_EventoModel
                {
                    Folio       = (int)Detalle_Registro_en_Actividad_EventoData.Folio
                    , Actividad = Detalle_Registro_en_Actividad_EventoData.Actividad
                    , ActividadNombre_de_la_Actividad = CultureHelper.GetTraduction(Convert.ToString(Detalle_Registro_en_Actividad_EventoData.Actividad), "Detalle_Actividades_Evento") ?? (string)Detalle_Registro_en_Actividad_EventoData.Actividad_Detalle_Actividades_Evento.Nombre_de_la_Actividad
                    , Fecha                 = (Detalle_Registro_en_Actividad_EventoData.Fecha == null ? string.Empty : Convert.ToDateTime(Detalle_Registro_en_Actividad_EventoData.Fecha).ToString(ConfigurationProperty.DateFormat))
                    , Horario               = Detalle_Registro_en_Actividad_EventoData.Horario
                    , Es_para_un_familiar   = Detalle_Registro_en_Actividad_EventoData.Es_para_un_familiar.GetValueOrDefault()
                    , Numero_de_Empleado    = Detalle_Registro_en_Actividad_EventoData.Numero_de_Empleado
                    , Nombres               = Detalle_Registro_en_Actividad_EventoData.Nombres
                    , Apellido_Paterno      = Detalle_Registro_en_Actividad_EventoData.Apellido_Paterno
                    , Apellido_Materno      = Detalle_Registro_en_Actividad_EventoData.Apellido_Materno
                    , Nombre_Completo       = Detalle_Registro_en_Actividad_EventoData.Nombre_Completo
                    , Parentesco            = Detalle_Registro_en_Actividad_EventoData.Parentesco
                    , ParentescoDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Registro_en_Actividad_EventoData.Parentesco), "Parentescos_Empleados") ?? (string)Detalle_Registro_en_Actividad_EventoData.Parentesco_Parentescos_Empleados.Descripcion
                    , Sexo                                 = Detalle_Registro_en_Actividad_EventoData.Sexo
                    , SexoDescripcion                      = CultureHelper.GetTraduction(Convert.ToString(Detalle_Registro_en_Actividad_EventoData.Sexo), "Sexo") ?? (string)Detalle_Registro_en_Actividad_EventoData.Sexo_Sexo.Descripcion
                    , Fecha_de_nacimiento                  = (Detalle_Registro_en_Actividad_EventoData.Fecha_de_nacimiento == null ? string.Empty : Convert.ToDateTime(Detalle_Registro_en_Actividad_EventoData.Fecha_de_nacimiento).ToString(ConfigurationProperty.DateFormat))
                    , Estatus_de_la_Reservacion            = Detalle_Registro_en_Actividad_EventoData.Estatus_de_la_Reservacion
                    , Estatus_de_la_ReservacionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Registro_en_Actividad_EventoData.Estatus_de_la_Reservacion), "Estatus_Reservaciones_Actividad") ?? (string)Detalle_Registro_en_Actividad_EventoData.Estatus_de_la_Reservacion_Estatus_Reservaciones_Actividad.Descripcion
                    , Codigo_Reservacion                   = Detalle_Registro_en_Actividad_EventoData.Codigo_Reservacion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IDetalle_Actividades_EventoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Detalle_Actividades_Eventos_Actividad = _IDetalle_Actividades_EventoApiConsumer.SelAll(true);

            if (Detalle_Actividades_Eventos_Actividad != null && Detalle_Actividades_Eventos_Actividad.Resource != null)
            {
                ViewBag.Detalle_Actividades_Eventos_Actividad = Detalle_Actividades_Eventos_Actividad.Resource.Where(m => m.Nombre_de_la_Actividad != null).OrderBy(m => m.Nombre_de_la_Actividad).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Detalle_Actividades_Evento", "Nombre_de_la_Actividad") ?? m.Nombre_de_la_Actividad.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }
            _IParentescos_EmpleadosApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Parentescos_Empleadoss_Parentesco = _IParentescos_EmpleadosApiConsumer.SelAll(true);

            if (Parentescos_Empleadoss_Parentesco != null && Parentescos_Empleadoss_Parentesco.Resource != null)
            {
                ViewBag.Parentescos_Empleadoss_Parentesco = Parentescos_Empleadoss_Parentesco.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Parentescos_Empleados", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }
            _ISexoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Sexos_Sexo = _ISexoApiConsumer.SelAll(true);

            if (Sexos_Sexo != null && Sexos_Sexo.Resource != null)
            {
                ViewBag.Sexos_Sexo = Sexos_Sexo.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Sexo", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IEstatus_Reservaciones_ActividadApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion = _IEstatus_Reservaciones_ActividadApiConsumer.SelAll(true);

            if (Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion != null && Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion.Resource != null)
            {
                ViewBag.Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion = Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Estatus_Reservaciones_Actividad", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Registro_en_Actividad_Evento));
        }
Esempio n. 15
0
        public ActionResult AddDetalle_Registro_en_Actividad_Evento(int rowIndex = 0, int functionMode = 0, int id = 0)
        {
            int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;

            ViewBag.currentRowIndex = rowIndex;
            ViewBag.functionMode    = functionMode;
            ViewBag.Consult         = false;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44441);

            ViewBag.Permission = permission;
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDetalle_Registro_en_Actividad_EventoApiConsumer.SetAuthHeader(_tokenManager.Token);
            Detalle_Registro_en_Actividad_EventoModel varDetalle_Registro_en_Actividad_Evento = new Detalle_Registro_en_Actividad_EventoModel();


            if (id.ToString() != "0")
            {
                var Detalle_Registro_en_Actividad_EventosData = _IDetalle_Registro_en_Actividad_EventoApiConsumer.ListaSelAll(0, 1000, "Detalle_Registro_en_Actividad_Evento.Folio=" + id, "").Resource.Detalle_Registro_en_Actividad_Eventos;

                if (Detalle_Registro_en_Actividad_EventosData != null && Detalle_Registro_en_Actividad_EventosData.Count > 0)
                {
                    var Detalle_Registro_en_Actividad_EventoData = Detalle_Registro_en_Actividad_EventosData.First();
                    varDetalle_Registro_en_Actividad_Evento = new Detalle_Registro_en_Actividad_EventoModel
                    {
                        Folio       = Detalle_Registro_en_Actividad_EventoData.Folio
                        , Actividad = Detalle_Registro_en_Actividad_EventoData.Actividad
                        , ActividadNombre_de_la_Actividad = CultureHelper.GetTraduction(Convert.ToString(Detalle_Registro_en_Actividad_EventoData.Actividad), "Detalle_Actividades_Evento") ?? (string)Detalle_Registro_en_Actividad_EventoData.Actividad_Detalle_Actividades_Evento.Nombre_de_la_Actividad
                        , Fecha                 = (Detalle_Registro_en_Actividad_EventoData.Fecha == null ? string.Empty : Convert.ToDateTime(Detalle_Registro_en_Actividad_EventoData.Fecha).ToString(ConfigurationProperty.DateFormat))
                        , Horario               = Detalle_Registro_en_Actividad_EventoData.Horario
                        , Es_para_un_familiar   = Detalle_Registro_en_Actividad_EventoData.Es_para_un_familiar.GetValueOrDefault()
                        , Numero_de_Empleado    = Detalle_Registro_en_Actividad_EventoData.Numero_de_Empleado
                        , Nombres               = Detalle_Registro_en_Actividad_EventoData.Nombres
                        , Apellido_Paterno      = Detalle_Registro_en_Actividad_EventoData.Apellido_Paterno
                        , Apellido_Materno      = Detalle_Registro_en_Actividad_EventoData.Apellido_Materno
                        , Nombre_Completo       = Detalle_Registro_en_Actividad_EventoData.Nombre_Completo
                        , Parentesco            = Detalle_Registro_en_Actividad_EventoData.Parentesco
                        , ParentescoDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Registro_en_Actividad_EventoData.Parentesco), "Parentescos_Empleados") ?? (string)Detalle_Registro_en_Actividad_EventoData.Parentesco_Parentescos_Empleados.Descripcion
                        , Sexo                                 = Detalle_Registro_en_Actividad_EventoData.Sexo
                        , SexoDescripcion                      = CultureHelper.GetTraduction(Convert.ToString(Detalle_Registro_en_Actividad_EventoData.Sexo), "Sexo") ?? (string)Detalle_Registro_en_Actividad_EventoData.Sexo_Sexo.Descripcion
                        , Fecha_de_nacimiento                  = (Detalle_Registro_en_Actividad_EventoData.Fecha_de_nacimiento == null ? string.Empty : Convert.ToDateTime(Detalle_Registro_en_Actividad_EventoData.Fecha_de_nacimiento).ToString(ConfigurationProperty.DateFormat))
                        , Estatus_de_la_Reservacion            = Detalle_Registro_en_Actividad_EventoData.Estatus_de_la_Reservacion
                        , Estatus_de_la_ReservacionDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_Registro_en_Actividad_EventoData.Estatus_de_la_Reservacion), "Estatus_Reservaciones_Actividad") ?? (string)Detalle_Registro_en_Actividad_EventoData.Estatus_de_la_Reservacion_Estatus_Reservaciones_Actividad.Descripcion
                        , Codigo_Reservacion                   = Detalle_Registro_en_Actividad_EventoData.Codigo_Reservacion
                    };
                }
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IDetalle_Actividades_EventoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Detalle_Actividades_Eventos_Actividad = _IDetalle_Actividades_EventoApiConsumer.SelAll(true);

            if (Detalle_Actividades_Eventos_Actividad != null && Detalle_Actividades_Eventos_Actividad.Resource != null)
            {
                ViewBag.Detalle_Actividades_Eventos_Actividad = Detalle_Actividades_Eventos_Actividad.Resource.Where(m => m.Nombre_de_la_Actividad != null).OrderBy(m => m.Nombre_de_la_Actividad).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Detalle_Actividades_Evento", "Nombre_de_la_Actividad") ?? m.Nombre_de_la_Actividad.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }
            _IParentescos_EmpleadosApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Parentescos_Empleadoss_Parentesco = _IParentescos_EmpleadosApiConsumer.SelAll(true);

            if (Parentescos_Empleadoss_Parentesco != null && Parentescos_Empleadoss_Parentesco.Resource != null)
            {
                ViewBag.Parentescos_Empleadoss_Parentesco = Parentescos_Empleadoss_Parentesco.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Parentescos_Empleados", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }
            _ISexoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Sexos_Sexo = _ISexoApiConsumer.SelAll(true);

            if (Sexos_Sexo != null && Sexos_Sexo.Resource != null)
            {
                ViewBag.Sexos_Sexo = Sexos_Sexo.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Sexo", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IEstatus_Reservaciones_ActividadApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion = _IEstatus_Reservaciones_ActividadApiConsumer.SelAll(true);

            if (Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion != null && Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion.Resource != null)
            {
                ViewBag.Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion = Estatus_Reservaciones_Actividads_Estatus_de_la_Reservacion.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Folio), "Estatus_Reservaciones_Actividad", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Folio)
                }).ToList();
            }


            return(PartialView("AddDetalle_Registro_en_Actividad_Evento", varDetalle_Registro_en_Actividad_Evento));
        }
Esempio n. 16
0
        public JsonResult GetHotFile(string period, bool isHtml = false)
        {
            var data = IPPRepository.GetTopFile(period, CultureHelper.IsEnglishCulture());

            return(isHtml ? Json(data, "text/html", JsonRequestBehavior.AllowGet) : Json(data, JsonRequestBehavior.AllowGet));
        }
Esempio n. 17
0
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45185);

            ViewBag.Permission = permission;
            var varDetalle_del_Indicio = new Detalle_del_IndicioModel();

            ViewBag.ObjectId  = "45185";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_del_IndicioApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_del_IndicioData = _IDetalle_del_IndicioApiConsumer.GetByKeyComplete(Id).Resource.Detalle_del_Indicios[0];
                if (Detalle_del_IndicioData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_del_Indicio = new Detalle_del_IndicioModel
                {
                    Clave = (int)Detalle_del_IndicioData.Clave
                    , Numero_de_Indicio       = Detalle_del_IndicioData.Numero_de_Indicio
                    , Nombre_del_Indicio      = Detalle_del_IndicioData.Nombre_del_Indicio
                    , Descripcion_del_Indicio = Detalle_del_IndicioData.Descripcion_del_Indicio
                    , Motivo               = Detalle_del_IndicioData.Motivo
                    , Estatus              = Detalle_del_IndicioData.Estatus
                    , EstatusDescripcion   = CultureHelper.GetTraduction(Convert.ToString(Detalle_del_IndicioData.Estatus), "Estatus_de_Indicio") ?? (string)Detalle_del_IndicioData.Estatus_Estatus_de_Indicio.Descripcion
                    , Ubicacion_de_Indicio = Detalle_del_IndicioData.Ubicacion_de_Indicio
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IEstatus_de_IndicioApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Estatus_de_Indicios_Estatus = _IEstatus_de_IndicioApiConsumer.SelAll(true);

            if (Estatus_de_Indicios_Estatus != null && Estatus_de_Indicios_Estatus.Resource != null)
            {
                ViewBag.Estatus_de_Indicios_Estatus = Estatus_de_Indicios_Estatus.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Estatus_de_Indicio", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_del_Indicio));
        }
Esempio n. 18
0
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45665);

            ViewBag.Permission = permission;
            var varDetalle_de_Delito_Mandamiento_Judicial = new Detalle_de_Delito_Mandamiento_JudicialModel();

            ViewBag.ObjectId  = "45665";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_de_Delito_Mandamiento_JudicialApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_de_Delito_Mandamiento_JudicialData = _IDetalle_de_Delito_Mandamiento_JudicialApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Delito_Mandamiento_Judicials[0];
                if (Detalle_de_Delito_Mandamiento_JudicialData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_de_Delito_Mandamiento_Judicial = new Detalle_de_Delito_Mandamiento_JudicialModel
                {
                    Clave                  = (int)Detalle_de_Delito_Mandamiento_JudicialData.Clave
                    , Delito               = Detalle_de_Delito_Mandamiento_JudicialData.Delito
                    , DelitoDescripcion    = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Delito_Mandamiento_JudicialData.Delito), "Delito") ?? (string)Detalle_de_Delito_Mandamiento_JudicialData.Delito_Delito.Descripcion
                    , Modalidad            = Detalle_de_Delito_Mandamiento_JudicialData.Modalidad
                    , ModalidadDescripcion = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Delito_Mandamiento_JudicialData.Modalidad), "Modalidad_Delito") ?? (string)Detalle_de_Delito_Mandamiento_JudicialData.Modalidad_Modalidad_Delito.Descripcion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IModalidad_DelitoApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Modalidad_Delitos_Modalidad = _IModalidad_DelitoApiConsumer.SelAll(true);

            if (Modalidad_Delitos_Modalidad != null && Modalidad_Delitos_Modalidad.Resource != null)
            {
                ViewBag.Modalidad_Delitos_Modalidad = Modalidad_Delitos_Modalidad.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Modalidad_Delito", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_de_Delito_Mandamiento_Judicial));
        }
Esempio n. 19
0
    /// <summary>
    /// External data binding handler.
    /// </summary>
    private object UniGridSites_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        bool running = true;

        switch (sourceName.ToLowerCSafe())
        {
        case "editcontent":
            // Edit content action
            running = ValidationHelper.GetString(((DataRowView)((GridViewRow)parameter).DataItem).Row["sitestatus"], "").ToUpperCSafe() == SiteInfoProvider.SiteStatusToString(SiteStatusEnum.Running);
            if (!running)
            {
                ImageButton button = ((ImageButton)sender);
                button.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/Editcontentdisabled.png");
                button.Enabled  = false;
            }
            break;

        case "openlivesite":
            // Open live site action
            running = ValidationHelper.GetString(((DataRowView)((GridViewRow)parameter).DataItem).Row["sitestatus"], "").ToUpperCSafe() == SiteInfoProvider.SiteStatusToString(SiteStatusEnum.Running);
            if (!running)
            {
                ImageButton button = ((ImageButton)sender);
                button.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/Livesitedisabled.png");
                button.Enabled  = false;
            }
            break;

        case "sitestatus":
            // Status
        {
            DataRowView drv = (DataRowView)parameter;
            running = SiteInfoProvider.SiteStatusToEnum(ValidationHelper.GetString(drv["SiteStatus"], "")) == SiteStatusEnum.Running;
            bool offline = ValidationHelper.GetBoolean(drv["SiteIsOffline"], false);

            if (running)
            {
                if (offline)
                {
                    return(UniGridFunctions.SpanMsg(GetString("Site_List.Offline"), "SiteStatusOffline"));
                }
                else
                {
                    return(UniGridFunctions.SpanMsg(GetString("Site_List.Running"), "SiteStatusRunning"));
                }
            }
            else
            {
                return(UniGridFunctions.SpanMsg(GetString("Site_List.Stopped"), "SiteStatusStopped"));
            }
        }

        case "culture":
            // Culture
        {
            DataRowView drv         = (DataRowView)parameter;
            string      siteName    = ValidationHelper.GetString(drv["SiteName"], "");
            string      cultureCode = CultureHelper.GetDefaultCulture(siteName);
            return(UniGridFunctions.DocumentCultureFlag(cultureCode, null, Page));
        }
        }
        return(parameter);
    }
Esempio n. 20
0
 /// <summary>
 /// 更新语言翻译
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task UpdateLanguageText(UpdateLanguageTextInput input)
 {
     var culture = CultureHelper.GetCultureInfoByChecking(input.LanguageName);
     var source  = LocalizationManager.GetSource(input.SourceName);
     await _applicationLanguageTextManager.UpdateStringAsync(AbpSession.TenantId, source.Name, culture, input.Key, input.Value);
 }
Esempio n. 21
0
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45340);

            ViewBag.Permission = permission;
            var varLugares_Frecuentes_Solicitante_MASC = new Lugares_Frecuentes_Solicitante_MASCModel();

            ViewBag.ObjectId  = "45340";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ILugares_Frecuentes_Solicitante_MASCApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Lugares_Frecuentes_Solicitante_MASCData = _ILugares_Frecuentes_Solicitante_MASCApiConsumer.GetByKeyComplete(Id).Resource.Lugares_Frecuentes_Solicitante_MASCs[0];
                if (Lugares_Frecuentes_Solicitante_MASCData == null)
                {
                    return(HttpNotFound());
                }

                varLugares_Frecuentes_Solicitante_MASC = new Lugares_Frecuentes_Solicitante_MASCModel
                {
                    Clave                      = (int)Lugares_Frecuentes_Solicitante_MASCData.Clave
                    , Tipo_de_Lugar            = Lugares_Frecuentes_Solicitante_MASCData.Tipo_de_Lugar
                    , Tipo_de_LugarDescripcion = CultureHelper.GetTraduction(Convert.ToString(Lugares_Frecuentes_Solicitante_MASCData.Tipo_de_Lugar), "Lugares") ?? (string)Lugares_Frecuentes_Solicitante_MASCData.Tipo_de_Lugar_Lugares.Descripcion
                    , Descripcion              = Lugares_Frecuentes_Solicitante_MASCData.Descripcion
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ILugaresApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Lugaress_Tipo_de_Lugar = _ILugaresApiConsumer.SelAll(true);

            if (Lugaress_Tipo_de_Lugar != null && Lugaress_Tipo_de_Lugar.Resource != null)
            {
                ViewBag.Lugaress_Tipo_de_Lugar = Lugaress_Tipo_de_Lugar.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Lugares", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varLugares_Frecuentes_Solicitante_MASC));
        }
Esempio n. 22
0
    public void Should_Get_Localized_Text_If_Defined_In_Requested_Culture()
    {
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("en")))
        {
            _localizer["Car"].Value.ShouldBe("Car");
        }
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("en")))
        {
            _localizer["CarPlural"].Value.ShouldBe("Cars");
        }

        using (CultureHelper.Use(CultureInfo.GetCultureInfo("tr")))
        {
            _localizer["Car"].Value.ShouldBe("Araba");
        }
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("tr")))
        {
            _localizer["CarPlural"].Value.ShouldBe("Araba");
        }

        using (CultureHelper.Use(CultureInfo.GetCultureInfo("es")))
        {
            _localizer["Car"].Value.ShouldBe("Auto");
        }
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("es")))
        {
            _localizer["CarPlural"].Value.ShouldBe("Autos");
        }

        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-Hans")))
        {
            _localizer["Car"].Value.ShouldBe("汽车");
        }
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-Hans")))
        {
            _localizer["CarPlural"].Value.ShouldBe("汽车");
        }

        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-CN")))
        {
            _localizer["Car"].Value.ShouldBe("汽车");
        }
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-CN")))
        {
            _localizer["CarPlural"].Value.ShouldBe("汽车");
        }

        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-Hans-CN")))
        {
            _localizer["Car"].Value.ShouldBe("汽车");
        }
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-Hans-CN")))
        {
            _localizer["CarPlural"].Value.ShouldBe("汽车");
        }

        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-Hant")))
        {
            _localizer["Car"].Value.ShouldBe("汽車");
        }
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-Hant")))
        {
            _localizer["CarPlural"].Value.ShouldBe("汽車");
        }

        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-TW")))
        {
            _localizer["Car"].Value.ShouldBe("汽車");
        }
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-TW")))
        {
            _localizer["CarPlural"].Value.ShouldBe("汽車");
        }

        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-Hant-TW")))
        {
            _localizer["Car"].Value.ShouldBe("汽車");
        }
        using (CultureHelper.Use(CultureInfo.GetCultureInfo("zh-Hant-TW")))
        {
            _localizer["CarPlural"].Value.ShouldBe("汽車");
        }
    }
 /// <summary>
 /// Localise the control
 /// </summary>
 public void Localise()
 {
     labelUpOneLevel.Text = CultureHelper.GetString(Properties.Resources.ResourceManager, "UPONELEVEL");
 }
Esempio n. 24
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Do not process control by default
        StopProcessing = true;

        // Keep frequent objects
        CurrentUserInfo cui = MembershipContext.AuthenticatedUser;
        PageInfo        pi  = DocumentContext.CurrentPageInfo;

        if (pi == null)
        {
            IsPageNotFound = true;
            pi             = DocumentContext.CurrentCultureInvariantPageInfo ?? new PageInfo();
            checkChanges   = string.Empty;
        }

        ucUIToolbar.StopProcessing = true;

        // Get main UI element
        var element = UIElementInfoProvider.GetUIElementInfo(MODULE_NAME, ELEMENT_NAME);

        if (element == null)
        {
            return;
        }

        // Check whether user is authorized to edit page
        if ((pi != null) &&
            AuthenticationHelper.IsAuthenticated() &&
            cui.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Editor, SiteContext.CurrentSiteName) &&
            ((IsPageNotFound && pi.NodeID == 0) || cui.IsAuthorizedPerTreeNode(pi.NodeID, NodePermissionsEnum.Read) == AuthorizationResultEnum.Allowed) &&
            CMSPage.CheckUIElementAccessHierarchical(element, redirectToAccessDenied: false))
        {
            // Enable processing
            StopProcessing = false;

            // Check whether the preferred culture is RTL
            isRTL = CultureHelper.IsUICultureRTL();

            // Add link to CSS file
            CSSHelper.RegisterCSSLink(Page, "Design", "OnSiteEdit.css");
            CSSHelper.RegisterBootstrap(Page);

            // Filter UI element buttons
            ucUIToolbar.OnButtonFiltered += ucUIToolbar_OnButtonFiltered;
            ucUIToolbar.OnButtonCreated  += ucUIToolbar_OnButtonCreated;
            ucUIToolbar.OnGroupsCreated  += ucUIToolbar_OnGroupsCreated;
            ucUIToolbar.IsRTL             = isRTL;

            // Register edit script file
            RegisterEditScripts(pi);

            if (ViewMode.IsEditLive())
            {
                popupHandler.Visible           = true;
                IsLiveSite                     = false;
                MessagesPlaceHolder.IsLiveSite = false;
                MessagesPlaceHolder.Opacity    = 100;

                // Keep content of editable web parts when saving the document changes
                if (!IsPageNotFound)
                {
                    PortalManager.PreserveContent = true;
                }

                // Display warning in the Safe mode
                if (PortalHelper.SafeMode)
                {
                    string safeModeText        = GetString("onsiteedit.safemode") + "<br/><a href=\"" + RequestContext.RawURL.Replace("safemode=1", "safemode=0") + "\">" + GetString("general.close") + "</a> " + GetString("contentedit.safemode2");
                    string safeModeDescription = GetString("onsiteedit.safemode") + "<br/>" + GetString("general.seeeventlog");

                    // Display the warning message
                    ShowWarning(safeModeText, safeModeDescription, "");
                }

                ucUIToolbar.StopProcessing = false;

                // Ensure document redirection
                var redirectUrl = TreePathUtils.GetRedirectionUrl(pi);
                if (!String.IsNullOrEmpty(redirectUrl))
                {
                    redirectUrl = URLHelper.ResolveUrl(redirectUrl);
                    ShowInformation(GetString("onsiteedit.redirectinfo") + " <a href=\"" + redirectUrl + "\">" + redirectUrl + "</a>");
                }

                pnlUpdateProgress.Visible = true;
            }
            // Mode menu on live site
            else if (ViewMode.IsLiveSite())
            {
                // Hide the edit panel, show only slider button
                pnlToolbarSpace.Visible = false;
                pnlToolbar.Visible      = false;
                pnlSlider.Visible       = true;

                icon.CssClass = "cms-icon-80 icon-edit";
                icon.ToolTip  = GetString("onsitedit.editmode");

                lblSliderText.Text = GetString("onsiteedit.editmode");
                pnlButton.Attributes.Add("onclick", "OnSiteEdit_ChangeEditMode();");

                // Hide the OnSite edit button when displayed in CMSDesk
                pnlSlider.Style.Add("display", "none");
            }
        }
        // Hide control actions for unauthorized users
        else
        {
            plcEdit.Visible = false;
        }
    }
Esempio n. 25
0
    protected void btnOK_Click(Object sender, EventArgs e)
    {
        DateTime selTime = GetCurrentTime();

        // Add 'Close window' script
        if (editTime)
        {
            ltlScript.Text = ScriptHelper.GetScript("CloseWindow(" + ScriptHelper.GetString(controlId) + ", '" + selTime.ToString("d", CultureHelper.GetCultureInfo(mCulture)) + selTime.ToString(" HH:mm:ss") + "');");
        }
        else
        {
            ltlScript.Text = ScriptHelper.GetScript("CloseWindow(" + ScriptHelper.GetString(controlId) + ", '" + selTime.ToString("d", CultureHelper.GetCultureInfo(mCulture)) + "');");
        }
    }
Esempio n. 26
0
        private void translateTexts(
            Project project,
            FileInformation destinationFfi,
            string sourceLanguageCode,
            string destinationLanguageCode,
            string prefix)
        {
            project = project ?? Project.Empty;
            var continueOnErrors = project.TranslationContinueOnErrors;

            var delayMilliseconds = project.TranslationDelayMilliseconds;

            var translationCount        = 0;
            var translationSuccessCount = 0;
            var translationErrorCount   = 0;

            // --

            var tmpFileGroup = new FileGroup(Project);

            tmpFileGroup.AddFileInfo(destinationFfi);

            var data  = new DataProcessing(tmpFileGroup);
            var table = data.GetDataTableFromResxFiles(Project);

            // --

            string appID;
            string appID2;

            TranslationHelper.GetTranslationAppID(project, out appID, out appID2);

            var ti = TranslationHelper.GetTranslationEngine(project);

            var slc =
                ti.MapCultureToSourceLanguageCode(
                    appID, appID2,
                    CultureHelper.CreateCultureErrorTolerant(sourceLanguageCode));
            var dlc =
                ti.MapCultureToDestinationLanguageCode(
                    appID, appID2,
                    CultureHelper.CreateCultureErrorTolerant(destinationLanguageCode));

            // --

            foreach (DataRow row in table.Rows)
            {
                var sourceText = ConvertHelper.ToString(row[2]);

                if (!string.IsNullOrEmpty(sourceText))
                {
                    if (delayMilliseconds > 0)
                    {
                        Thread.Sleep(delayMilliseconds);
                    }

                    try
                    {
                        var destinationText =
                            prefix +
                            ti.Translate(
                                appID,
                                appID2,
                                sourceText,
                                slc,
                                dlc,
                                project.TranslationWordsToProtect,
                                project.TranslationWordsToRemove);

                        row[2] = destinationText;

                        translationSuccessCount++;
                    }
                    catch (Exception x)
                    {
                        translationErrorCount++;

                        if (continueOnErrors)
                        {
                            var prefixError = DefaultTranslationErrorPrefix.Trim() + @" ";

                            var destinationText = prefixError + x.Message;

                            if (row[2] != null)
                            {
                                row[2] = destinationText;
                            }
                        }
                        else
                        {
                            throw;
                        }
                    }

                    translationCount++;
                }
            }

            // Write back.
            data.SaveDataTableToResxFiles(project, table, false, false);
        }
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44553);

            ViewBag.Permission = permission;
            var varDetalle_Platillos = new Detalle_PlatillosModel();

            ViewBag.ObjectId  = "44553";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_PlatillosApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_PlatillosData = _IDetalle_PlatillosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Platilloss[0];
                if (Detalle_PlatillosData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Platillos = new Detalle_PlatillosModel
                {
                    Folio         = (int)Detalle_PlatillosData.Folio
                    , Cantidad    = Detalle_PlatillosData.Cantidad
                    , Unidad      = Detalle_PlatillosData.Unidad
                    , Ingrediente = Detalle_PlatillosData.Ingrediente
                    , IngredienteNombre_Ingrediente = CultureHelper.GetTraduction(Convert.ToString(Detalle_PlatillosData.Ingrediente), "Ingredientes") ?? (string)Detalle_PlatillosData.Ingrediente_Ingredientes.Nombre_Ingrediente
                    , Unidad_SMAE        = Detalle_PlatillosData.Unidad_SMAE
                    , Porciones          = Detalle_PlatillosData.Porciones
                    , Texto_para_mostrar = Detalle_PlatillosData.Texto_para_mostrar
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IIngredientesApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Ingredientess_Ingrediente = _IIngredientesApiConsumer.SelAll(true);

            if (Ingredientess_Ingrediente != null && Ingredientess_Ingrediente.Resource != null)
            {
                ViewBag.Ingredientess_Ingrediente = Ingredientess_Ingrediente.Resource.Where(m => m.Nombre_Ingrediente != null).OrderBy(m => m.Nombre_Ingrediente).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Ingredientes", "Nombre_Ingrediente") ?? m.Nombre_Ingrediente.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Platillos));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        RangeDateTimePicker datePickerObject = PickerControl as RangeDateTimePicker;

        if (datePickerObject == null)
        {
            return;
        }

        // Default settings
        int numberOfRows = 6;
        // Buttons NotAvaible,Done,Now
        bool showActionPanel = false;
        // Hides if date is selected
        bool hideOnDateSelection = false;
        // Display seconds
        bool displaySeconds = true;
        // Add icon - triggers datepicker show
        string shownOn = "button";
        // If true display time
        bool displayTime = datePickerObject.EditTime && !datePickerObject.DisableDaySelect && !datePickerObject.DisableMonthSelect;

        string minDate = String.Empty;
        string maxDate = String.Empty;

        if (datePickerObject.UseCalendarLimit)
        {
            if (datePickerObject.MinDate != DateTimeHelper.ZERO_TIME)
            {
                minDate = "minDate: " + (datePickerObject.MinDate.Date - DateTime.Now.Date).Days.ToString() + ",";
            }

            if (datePickerObject.MaxDate != DateTimeHelper.ZERO_TIME)
            {
                maxDate = "maxDate: " + (datePickerObject.MaxDate.Date - DateTime.Now.Date).Days.ToString() + ",";
            }
        }

        LoadResources(datePickerObject);

        int stepMonth = datePickerObject.DisableMonthSelect ? 12 : 1;

        CultureInfo        culture = new CultureInfo(datePickerObject.CultureCode, true);
        DateTimeFormatInfo info    = culture.DateTimeFormat;

        // Register default css a js files
        ScriptHelper.RegisterJQuery(Page);

        ScriptHelper.RegisterScriptFile(Page, "JQuery/jquery-ui-datetimepicker.js");
        ScriptHelper.RegisterScriptFile(Page, "Controls/modalCalendar.js");

        string datePattern = info.ShortDatePattern.Replace("yyyy", "yy").Replace("'", "");

        if (displayTime)
        {
            datePattern += " " + (displaySeconds ? info.LongTimePattern : info.ShortTimePattern);
        }

        bool use24HourMode = !datePattern.Contains("tt");

        // Generate 'now' string with full year
        string format = info.ShortDatePattern;

        if (Regex.Matches(format, "y").Count == 2)
        {
            format = format.Replace("yy", "yyyy");
        }

        string now = TimeZoneMethods.DateTimeConvert(DateTime.Now, datePickerObject.TimeZone, datePickerObject.CustomTimeZone).ToString(format, culture);

        // Localized settings
        string localize = String.Format("monthNames:{0},monthNamesShort:{1},dayNames:{2},dayNamesMin:{3},firstDay:{4},", ArrayToString(info.MonthNames), ArrayToString(info.AbbreviatedMonthNames), ArrayToString(info.DayNames), ArrayToString(info.ShortestDayNames), ConvertFirstDayToNumber(info.FirstDayOfWeek));

        localize += String.Format("AMDesignator:{0},PMDesignator:{1},closeText:{2},isRTL:{3},prevText:{4},nextText:{5},defaultDate:'{6}'", ScriptHelper.GetLocalizedString(info.AMDesignator), ScriptHelper.GetLocalizedString(info.PMDesignator), ScriptHelper.GetLocalizedString("general.ok"), culture.TextInfo.IsRightToLeft.ToString().ToLowerCSafe(), ScriptHelper.GetLocalizedString("calendar.previous"), ScriptHelper.GetLocalizedString("calendar.next"), now);

        // Classic settings
        String initParameters = String.Format("numberOfRows:{0},showTimePanel:{1},use24HourMode:{2},showButtonPanel:{3},hideOnDateSelection:{4},displaySeconds:{5},", numberOfRows, displayTime.ToString().ToLowerCSafe(), use24HourMode.ToString().ToLowerCSafe(), showActionPanel.ToString().ToLowerCSafe(), hideOnDateSelection.ToString().ToLowerCSafe(), displaySeconds.ToString().ToLowerCSafe());

        initParameters += String.Format("IconID:'{0}',showOn:'{1}',dateFormat:'{2}',disableDaySelect:{3},disableMonthSelect:{4},stepMonths:{5},changeMonth:{6},timeZoneOffset:{7},selectOtherMonths:true,showOtherMonths:true,changeYear:true", datePickerObject.CalendarImageClientID, shownOn, datePattern, datePickerObject.DisableDaySelect.ToString().ToLowerCSafe(), datePickerObject.DisableMonthSelect.ToString().ToLowerCSafe(), stepMonth, (!datePickerObject.DisableMonthSelect).ToString().ToLowerCSafe(), datePickerObject.TimeZoneOffset);

        // Init first calendar
        string calendarInit = "$j(function() {$j('#" + dateFrom.ClientID + "').cmsdatepicker({" + minDate + maxDate + localize + "," + initParameters + ",defaultTimeValue:" + (datePickerObject.UseDynamicDefaultTime ? 1 : 0) + "});";

        // Init second calendar
        calendarInit += "$j('#" + dateTo.ClientID + "').cmsdatepicker({" + minDate + maxDate + localize + "," + initParameters + ",defaultTimeValue:" + (datePickerObject.UseDynamicDefaultTime ? 2 : 0) + "})});";

        ScriptHelper.RegisterClientScriptBlock(Page, GetType(), ClientID + "_RegisterDatePickerFunction", ScriptHelper.GetScript(calendarInit));

        // Button OK
        btnOK.OnClientClick  = "$j('#" + datePickerObject.DateTimeTextBox.ClientID + "').val ($j('#" + dateFrom.ClientID + "').cmsdatepicker ('getFormattedDate'));";
        btnOK.OnClientClick += "$j('#" + datePickerObject.AlternateDateTimeTextBox.ClientID + "').val ($j('#" + dateTo.ClientID + "').cmsdatepicker ('getFormattedDate'));";
        btnOK.OnClientClick += "$j('#" + rangeCalendar.ClientID + "').hide();";

        if (datePickerObject.DisplayNAButton)
        {
            btnNA.OnClientClick = "$j('#" + rangeCalendar.ClientID + "').hide(); $j('#" + datePickerObject.DateTimeTextBox.ClientID + "').val('');$j('#" + datePickerObject.AlternateDateTimeTextBox.ClientID + "').val('');return false;";
            btnNA.Visible       = true;
        }

        if (!datePickerObject.PostbackOnOK)
        {
            btnOK.OnClientClick += "return false;";
        }

        // Icon
        string clickScript = " if( $j('#" + rangeCalendar.ClientID + @"').is(':hidden')) { 
            $j('#" + dateFrom.ClientID + "').cmsdatepicker('setDate',$j('#" + datePickerObject.DateTimeTextBox.ClientID + @"').val());     
            $j('#" + dateTo.ClientID + "').cmsdatepicker('setDate',$j('#" + datePickerObject.AlternateDateTimeTextBox.ClientID + @"').val());                           
            var offset = localizeRangeCalendar($j('#" + rangeCalendar.ClientID + "'),$j('#" + datePickerObject.DateTimeTextBox.ClientID + "')," + CultureHelper.IsUICultureRTL().ToString().ToLowerCSafe() + ",true);" +
                             "$j('#" + rangeCalendar.ClientID + "').css({left:offset.left+'px',top:offset.top+'px'});$j('#" + rangeCalendar.ClientID + "').show();}return false;";

        // Add image on click
        String script = "$j(\"#" + datePickerObject.CalendarImageClientID + "\").click(function() {" + clickScript + "});";

        ScriptHelper.RegisterStartupScript(this, typeof(string), ClientID + "CalendarImageInitScript", ScriptHelper.GetScript(script));

        datePickerObject.DateTimeTextBox.Attributes["OnClick"]          = clickScript;
        datePickerObject.AlternateDateTimeTextBox.Attributes["OnClick"] = clickScript;

        // Script for hiding calendar when clicked somewhere else
        ltlScript.Text = ScriptHelper.GetScript(@"$j(document).mousedown(function(event) { 
                var target = $j(event.target);    
                if ((target.closest('#" + rangeCalendar.ClientID + "').length == 0) && (target.parents('#" + rangeCalendar.ClientID + @"').length == 0) 
                 && (target.closest('#" + datePickerObject.CalendarImageClientID + "').length == 0) && (target.closest('#" + datePickerObject.DateTimeTextBox.ClientID + @"').length == 0) && (target.closest('#" + datePickerObject.AlternateDateTimeTextBox.ClientID + @"').length == 0))
                        $j('#" + rangeCalendar.ClientID + @"').hide(); 
                });");
    }
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 44571);

            ViewBag.Permission = permission;
            var varDetalle_Planes_de_Rutinas = new Detalle_Planes_de_RutinasModel();

            ViewBag.ObjectId  = "44571";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_Planes_de_RutinasApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_Planes_de_RutinasData = _IDetalle_Planes_de_RutinasApiConsumer.GetByKeyComplete(Id).Resource.Detalle_Planes_de_Rutinass[0];
                if (Detalle_Planes_de_RutinasData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_Planes_de_Rutinas = new Detalle_Planes_de_RutinasModel
                {
                    Folio              = (int)Detalle_Planes_de_RutinasData.Folio
                    , Numero_de_Dia    = Detalle_Planes_de_RutinasData.Numero_de_Dia
                    , Numero_de_DiaDia = CultureHelper.GetTraduction(Convert.ToString(Detalle_Planes_de_RutinasData.Numero_de_Dia), "Dias_de_la_semana") ?? (string)Detalle_Planes_de_RutinasData.Numero_de_Dia_Dias_de_la_semana.Dia
                    , Fecha            = (Detalle_Planes_de_RutinasData.Fecha == null ? string.Empty : Convert.ToDateTime(Detalle_Planes_de_RutinasData.Fecha).ToString(ConfigurationProperty.DateFormat))
                    , Realizado        = Detalle_Planes_de_RutinasData.Realizado.GetValueOrDefault()
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IDias_de_la_semanaApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Dias_de_la_semanas_Numero_de_Dia = _IDias_de_la_semanaApiConsumer.SelAll(true);

            if (Dias_de_la_semanas_Numero_de_Dia != null && Dias_de_la_semanas_Numero_de_Dia.Resource != null)
            {
                ViewBag.Dias_de_la_semanas_Numero_de_Dia = Dias_de_la_semanas_Numero_de_Dia.Resource.Where(m => m.Dia != null).OrderBy(m => m.Dia).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Dias_de_la_semana", "Dia") ?? m.Dia.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_Planes_de_Rutinas));
        }
Esempio n. 30
0
        public ActionResult TopicEditor(int?id)
        {
            var      topicCreate = id == null ? new TopicCreate() : IPPRepository.GetTopicById((int)id);
            IPPTopic ippTopic;

            topicCreate = topicCreate ?? new TopicCreate();
            var moduleItems = new List <SelectListItem>();
            IEnumerable <MODULEINFO> modules = IPPRepository.GetModuleList();

            foreach (var m in modules)
            {
                moduleItems.Add(new SelectListItem {
                    Value = m.ID.ToString(), Selected = m.ID == topicCreate.ModuleID ? true : false, Text = CultureHelper.IsEnglishCulture() ? m.NAMEEN : m.NAMECN
                });
            }

            ippTopic = new IPPTopic
            {
                ID                = topicCreate.ID,
                DescriptionCn     = topicCreate.DescriptionCn,
                DescriptionEn     = topicCreate.DescriptionEn,
                Tag               = topicCreate.Tag,
                NameCn            = topicCreate.NameCn,
                NameEn            = topicCreate.NameEn,
                ModuleItems       = moduleItems,
                Approver          = string.IsNullOrEmpty(topicCreate.Approver) ? UserSettingHelper.GetEikonUserID(Request) : topicCreate.Approver,
                IsApprove         = topicCreate.IsApprove,
                IsDirectDelete    = topicCreate.IsDirectDelete,
                IsInternalApprove = topicCreate.IsInternalApprove,
                ModuleID          = topicCreate.ModuleID.ToString(),
                RMLink            = topicCreate.RMLink,
                Thumbnail         = topicCreate.Thumbnail,
                ImageName         = topicCreate.ImageName
            };

            return(View(ippTopic));
        }
Esempio n. 31
0
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            int ModuleId   = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0;
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45187);

            ViewBag.Permission = permission;
            var varDetalle_de_Devolucion_de_Indicios = new Detalle_de_Devolucion_de_IndiciosModel();

            ViewBag.ObjectId  = "45187";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_de_Devolucion_de_IndiciosApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Detalle_de_Devolucion_de_IndiciosData = _IDetalle_de_Devolucion_de_IndiciosApiConsumer.GetByKeyComplete(Id).Resource.Detalle_de_Devolucion_de_Indicioss[0];
                if (Detalle_de_Devolucion_de_IndiciosData == null)
                {
                    return(HttpNotFound());
                }

                varDetalle_de_Devolucion_de_Indicios = new Detalle_de_Devolucion_de_IndiciosModel
                {
                    Clave = (int)Detalle_de_Devolucion_de_IndiciosData.Clave
                    , Fecha_de_Devolucion                  = (Detalle_de_Devolucion_de_IndiciosData.Fecha_de_Devolucion == null ? string.Empty : Convert.ToDateTime(Detalle_de_Devolucion_de_IndiciosData.Fecha_de_Devolucion).ToString(ConfigurationProperty.DateFormat))
                    , Hora_de_Devolucion                   = Detalle_de_Devolucion_de_IndiciosData.Hora_de_Devolucion
                    , Nombre_de_Persona_que_Entrega        = Detalle_de_Devolucion_de_IndiciosData.Nombre_de_Persona_que_Entrega
                    , Numero_de_Indicio                    = Detalle_de_Devolucion_de_IndiciosData.Numero_de_Indicio
                    , Numero_de_IndicioDescripcion         = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Devolucion_de_IndiciosData.Numero_de_Indicio), "Indicios_para_MPI") ?? (string)Detalle_de_Devolucion_de_IndiciosData.Numero_de_Indicio_Indicios_para_MPI.Descripcion
                    , Nombre_de_Indicio                    = Detalle_de_Devolucion_de_IndiciosData.Nombre_de_Indicio
                    , Descripcion_de_Devolucion_de_Indicio = Detalle_de_Devolucion_de_IndiciosData.Descripcion_de_Devolucion_de_Indicio
                    , Diligencia_que_Devuelve              = Detalle_de_Devolucion_de_IndiciosData.Diligencia_que_Devuelve
                    , Diligencia_que_DevuelveServicio      = CultureHelper.GetTraduction(Convert.ToString(Detalle_de_Devolucion_de_IndiciosData.Diligencia_que_Devuelve), "Servicios_Periciales") ?? (string)Detalle_de_Devolucion_de_IndiciosData.Diligencia_que_Devuelve_Servicios_Periciales.Servicio
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _IIndicios_para_MPIApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Indicios_para_MPIs_Numero_de_Indicio = _IIndicios_para_MPIApiConsumer.SelAll(true);

            if (Indicios_para_MPIs_Numero_de_Indicio != null && Indicios_para_MPIs_Numero_de_Indicio.Resource != null)
            {
                ViewBag.Indicios_para_MPIs_Numero_de_Indicio = Indicios_para_MPIs_Numero_de_Indicio.Resource.Where(m => m.Descripcion != null).OrderBy(m => m.Descripcion).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Indicios_para_MPI", "Descripcion") ?? m.Descripcion.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }
            _IServicios_PericialesApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Servicios_Pericialess_Diligencia_que_Devuelve = _IServicios_PericialesApiConsumer.SelAll(true);

            if (Servicios_Pericialess_Diligencia_que_Devuelve != null && Servicios_Pericialess_Diligencia_que_Devuelve.Resource != null)
            {
                ViewBag.Servicios_Pericialess_Diligencia_que_Devuelve = Servicios_Pericialess_Diligencia_que_Devuelve.Resource.Where(m => m.Servicio != null).OrderBy(m => m.Servicio).Select(m => new SelectListItem
                {
                    Text = CultureHelper.GetTraduction(Convert.ToString(m.Clave), "Servicios_Periciales", "Servicio") ?? m.Servicio.ToString(), Value = Convert.ToString(m.Clave)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varDetalle_de_Devolucion_de_Indicios));
        }