GetFilled() public method

public GetFilled ( string templateSuffix, bool validate, bool throwException, string &retMessage ) : string
templateSuffix string
validate bool
throwException bool
retMessage string
return string
Example #1
0
        public static string GetListAllItemView(long pageNo, long itemsPerPage, long dataIndex, string templateSuffix)
        {
            string message = "";
            if (itemsPerPage == 0) itemsPerPage = UtilsGeneric.DefaultItemsPerPage;
            long totalPages;
            long totalItems;
            string htmlTextItemList = "";
            string htmlAddItemList = "";

            if (UtilsSecurity.HaveAdminRole() == false)
            {
                TemplateDataTypeView dataTypeView = new TemplateDataTypeView
                {
                    DataIndex = dataIndex.ToString(),
                    PageNo = pageNo.ToString(),
                    ItemsPerPage = itemsPerPage.ToString(),
                    TemplateSuffix = templateSuffix,
                };
                htmlTextItemList = dataTypeView.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }
            else
            {
                #region Add Link

                if (UtilsSecurity.HaveAdminRole() == true)
                {
                    TemplateDataTypeSaveAdd templateSaveAdd = new TemplateDataTypeSaveAdd
                    {
                        DataIndex = dataIndex.ToString(),
                        PageNo = pageNo.ToString(),
                        ItemsPerPage = itemsPerPage.ToString(),
                        TemplateSuffix = templateSuffix,
                    };
                    htmlAddItemList = templateSaveAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }

                #endregion

                #region Get Fill List

                #region Get Paged Data

                List<CNS_DataType> cnsDataTypeList = DataCommon.GetAllCnsDataType(pageNo, itemsPerPage, out totalPages, out totalItems);

                #endregion

                if (cnsDataTypeList.Count > 0)
                {
                    #region Get Pager Details

                    string topPagerDetails = UtilsGeneric.GetItemPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalPages, RefreshListFunctionName, "");
                    string bottomPagerDetails = UtilsGeneric.GetLinkPagerView(pageNo, itemsPerPage, dataIndex, templateSuffix, totalPages, totalItems, RefreshListFunctionName, "");

                    #endregion

                    #region Append Top Pager

                    if (topPagerDetails.Trim().Length > 0)
                    {
                        htmlTextItemList += topPagerDetails;
                    }

                    #endregion

                    #region Append Items

                    int index = 0;
                    for (; index < cnsDataTypeList.Count; index++)
                    {
                        CNS_DataType cnsDataType = cnsDataTypeList[index];
                        string htmlTextItemTemplate = GetListSingleItemView(cnsDataType, pageNo, itemsPerPage, dataIndex, templateSuffix);
                        htmlTextItemList += htmlTextItemTemplate;
                    }

                    #endregion

                    #region Append Bottom Pager

                    if (bottomPagerDetails.Trim().Length > 0)
                    {
                        htmlTextItemList += bottomPagerDetails;
                    }

                    #endregion
                }

                #endregion

                #region Set Fill List

                if (htmlTextItemList.Length == 0)
                {
                    TemplateDataTypeListDetailEmpty dataTypeListDetailEmpty = new TemplateDataTypeListDetailEmpty
                    {
                        DataIndex = dataIndex.ToString(),
                        PageNo = pageNo.ToString(),
                        ItemsPerPage = itemsPerPage.ToString(),
                        TemplateSuffix = templateSuffix,
                    };
                    htmlTextItemList = dataTypeListDetailEmpty.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);

                }

                #endregion
            }

            return htmlAddItemList + htmlTextItemList;
        }
Example #2
0
        public static string GetSaveDetailView(long dataTypeId, long pageNo, long itemsPerPage, long dataIndex, string templateSuffix)
        {
            string message = "";
            string htmlSaveDetail = "";
            long revisionNo = 0;
            string dataTypeName = "";
            bool dataTypeIsDefault = false;
            bool dataTypeIsActive = true;
            bool dataTypeIsSystem = false;

            if (UtilsSecurity.HaveAdminRole() == false)
            {
                TemplateDataTypeView dataTypeView = new TemplateDataTypeView
                {
                    DataIndex = dataIndex.ToString(),
                    PageNo = pageNo.ToString(),
                    ItemsPerPage = itemsPerPage.ToString(),
                    TemplateSuffix = templateSuffix
                };
                htmlSaveDetail = dataTypeView.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
            }
            else
            {
                #region Get DataType Details

                if (dataTypeId > 0)
                {
                    CNS_DataType cnsDataTypeExisting = DataCommon.GetCnsDataType(dataTypeId);
                    if (cnsDataTypeExisting != null)
                    {
                        dataTypeName = cnsDataTypeExisting.DataType;

                        dataTypeIsDefault = cnsDataTypeExisting.IsDefault;
                        dataTypeIsActive = cnsDataTypeExisting.IsActive;
                        dataTypeIsSystem = cnsDataTypeExisting.IsSystem;
                        revisionNo = cnsDataTypeExisting.RevisionNo;
                    }
                }

                #endregion

                #region Set Action

                bool showAdminInfo = false;
                bool enableSave = true;
                bool enableDelete = true;
                if (UtilsSecurity.HaveAdminRole() == false)
                {
                    showAdminInfo = true;
                    enableSave = false;
                    enableDelete = false;
                }

                #endregion

                #region Set Template

                string addActionHtml = "";
                string editActionHtml = "";
                if (dataTypeId == 0)
                {
                    var templateSaveAdd = new TemplateDataTypeSaveDetailAdd
                    {
                        AddActionDisabled = !enableSave,
                        DataIndex = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage = itemsPerPage.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix = templateSuffix,                        
                    };
                    addActionHtml = templateSaveAdd.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }
                else
                {
                    var templateSaveEdit = new TemplateDataTypeSaveDetailEdit
                    {
                        Id = dataTypeId.ToString(),
                        DataIndex = dataIndex.ToString("N0", CultureInfo.InvariantCulture),
                        PageNo = pageNo.ToString("N0", CultureInfo.InvariantCulture),
                        ItemsPerPage = itemsPerPage.ToString("N0", CultureInfo.InvariantCulture),
                        TemplateSuffix = templateSuffix,

                        SaveActionDisabled = !enableSave,
                        DeleteActionDisabled = !enableDelete,
                    };
                    editActionHtml = templateSaveEdit.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException, out message);
                }

                List<TemplateDataTypeSaveDetail.IsActiveVisible> isActiveVisibleList = new List<TemplateDataTypeSaveDetail.IsActiveVisible>();
                if (dataTypeIsActive ==true)
                {
                    isActiveVisibleList.Add(new TemplateDataTypeSaveDetail.IsActiveVisible
                    {
                        IsActive = dataTypeIsActive
                    });
                }

                var templateSaveDetail = new TemplateDataTypeSaveDetail
                {
                    //Id = dataRefTypeId.ToString("N0", CultureInfo.InvariantCulture),
                    RevisionNo = revisionNo.ToString(),          
                    DataTypeName = dataTypeName,
                    DataTypeNameDisabled = dataTypeIsSystem,       
                    IsDefault = dataTypeIsDefault,
                    IsActiveVisibleList = isActiveVisibleList,

                    AddAction = addActionHtml,
                    EditAction = editActionHtml,
                    ShowAdminInfo = showAdminInfo,
                };

                htmlSaveDetail = templateSaveDetail.GetFilled(templateSuffix, UtilsGeneric.Validate, UtilsGeneric.ThrowException,
                                                                      out message);

                #endregion
            }

            return htmlSaveDetail;
        }