コード例 #1
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         var      notDeletableIds = new List <int>();
         string[] deleteIndexList = DeleteIds.Split(',');
         foreach (string index in deleteIndexList)
         {
             var data = new HelpPageContextDataModel();
             data.HelpPageContextId = int.Parse(index);
             if (!Framework.Components.Core.HelpPageContextDataManager.IsDeletable(data, SessionVariables.RequestProfile))
             {
                 notDeletableIds.Add(Convert.ToInt32(data.HelpPageContextId));
             }
         }
         if (notDeletableIds.Count == 0)
         {
             foreach (string index in deleteIndexList)
             {
                 var data = new HelpPageContextDataModel();
                 data.HelpPageContextId = int.Parse(index);
                 Framework.Components.Core.HelpPageContextDataManager.Delete(data, SessionVariables.RequestProfile);
             }
             Framework.Components.Audit.AuditHistoryDataManager.DeleteDataBySystemEntity(DeleteIds, (int)Framework.Components.DataAccess.SystemEntity.HelpPageContext, SessionVariables.RequestProfile);
             Response.Redirect(Page.GetRouteUrl("HelpPageContextEntityRoute", new { Action = "Default", SetId = true }), false);
         }
         else
         {
             var msg = String.Empty;
             foreach (var id in notDeletableIds)
             {
                 if (!string.IsNullOrEmpty(msg))
                 {
                     msg += ", <br/>";
                 }
                 msg += "HelpPageContextId: " + id + " has detail records";
             }
             Response.Write(msg);
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
コード例 #2
0
        public static bool IsDeletable(HelpPageContextDataModel data, RequestProfile requestProfile)
        {
            var isDeletable = true;
            var ds          = GetChildren(data, requestProfile);

            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataTable dt in ds.Tables)
                {
                    if (dt.Rows.Count > 0)
                    {
                        isDeletable = false;
                        break;
                    }
                }
            }
            return(isDeletable);
        }
コード例 #3
0
        public void LoadData(int HelpPageContextId, bool showId)
        {
            var data = new HelpPageContextDataModel();

            data.HelpPageContextId = HelpPageContextId;
            var oHelpPageContextTable = HelpPageContextDataManager.GetDetails(data, SessionVariables.RequestProfile);

            if (oHelpPageContextTable.Rows.Count == 1)
            {
                var row = oHelpPageContextTable.Rows[0];

                if (!showId)
                {
                    txtHelpPageContextId.Text = Convert.ToString(row[HelpPageContextDataModel.DataColumns.HelpPageContextId]);

                    dynAuditHistory.Visible = true;
                    // only show Audit History in case of Update page, not for Clone.
                    oHistoryList.Setup((int)SystemEntity.HelpPageContext, HelpPageContextId, "HelpPageContext");
                    dynAuditHistory.Visible = PerferenceUtility.GetUserPreferenceByKeyAsBoolean(ApplicationCommon.HistoryGridVisibilityKey, "HelpPageContext");
                }
                else
                {
                    txtHelpPageContextId.Text = String.Empty;
                }
                txtDescription.InnerText = Convert.ToString(row[StandardDataModel.StandardDataColumns.Description]);
                txtName.Text             = Convert.ToString(row[StandardDataModel.StandardDataColumns.Name]);
                txtSortOrder.Text        = Convert.ToString(row[StandardDataModel.StandardDataColumns.SortOrder]);

                oUpdateInfo.LoadText(oHelpPageContextTable.Rows[0]);
            }
            else
            {
                txtHelpPageContextId.Text = String.Empty;
                txtDescription.InnerText  = String.Empty;
                txtName.Text      = String.Empty;
                txtSortOrder.Text = String.Empty;
            }
        }
コード例 #4
0
        public static List <HelpPageContextDataModel> GetEntityDetails(HelpPageContextDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.HelpPageContextSearch ";

            var parameters =
                new
            {
                AuditId             = requestProfile.AuditId
                , ApplicationId     = requestProfile.ApplicationId
                , ApplicationMode   = requestProfile.ApplicationModeId
                , ReturnAuditInfo   = returnAuditInfo
                , HelpPageContextId = dataQuery.HelpPageContextId
                , Name = dataQuery.Name
            };

            List <HelpPageContextDataModel> result;

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                result = dataAccess.Connection.Query <HelpPageContextDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList();
            }

            return(result);
        }
コード例 #5
0
        public static string ToSQLParameter(HelpPageContextDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

            switch (dataColumnName)
            {
            case HelpPageContextDataModel.DataColumns.HelpPageContextId:
                if (data.HelpPageContextId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, HelpPageContextDataModel.DataColumns.HelpPageContextId, data.HelpPageContextId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, HelpPageContextDataModel.DataColumns.HelpPageContextId);
                }
                break;

            default:
                returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName);
                break;
            }

            return(returnValue);
        }
コード例 #6
0
        public static DataTable Search(HelpPageContextDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }
コード例 #7
0
        public static void Update(HelpPageContextDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("HelpPageContext.Update", sql, DataStoreKey);
        }
コード例 #8
0
        public static HelpPageContextDataModel GetDetails(HelpPageContextDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }