Exemplo n.º 1
0
 /// <summary>
 /// Saves the NVP detail.
 /// </summary>
 /// <param name="nameValuePairDetailProfile">The profile.</param>
 /// <returns>System.Int32.</returns>
 public void SaveNameValuePairDetail(MNameValuePairDetail nameValuePairDetailProfile)
 {
     m_DNameValuePair.DetailProfile = nameValuePairDetailProfile;
     if (DatabaseIsOnline())
     {
         m_DNameValuePair.SaveNVPDetail(nameValuePairDetailProfile);
     }
 }
Exemplo n.º 2
0
        void IDNameValuePair.SaveNVPDetail(MNameValuePairDetail profile)
        {
            string myStoreProcedure = "ZGWSystem.Set_Name_Value_Pair_Detail";

            SqlParameter[] mParameters = { new SqlParameter("@P_NVP_Detail_SeqID", profile.Id), new SqlParameter("@P_NVP_SeqID", profile.NameValuePairSeqId),    new SqlParameter("@P_NVP_Detail_Name", profile.Value), new SqlParameter("@P_NVP_Detail_Value", profile.Text), new SqlParameter("@P_Status_SeqID", profile.Status), new SqlParameter("@P_Sort_Order", profile.SortOrder), new SqlParameter("@P_Added_Updated_BY", GetAddedUpdatedBy(profile)),
                                           GetSqlParameter("@P_Primary_Key",                -1, ParameterDirection.Output),      GetSqlParameter("@P_ErrorCode",                                    -1, ParameterDirection.Output) };
            base.ExecuteNonQuery(myStoreProcedure, mParameters);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Deletes the NVP detail.
        /// </summary>
        /// <param name="detailProfile">The profile.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
        public bool DeleteNameValuePairDetail(MNameValuePairDetail detailProfile)
        {
            bool mRetVal = false;

            if (DatabaseIsOnline())
            {
                mRetVal = m_DNameValuePair.DeleteNVPDetail(detailProfile);
            }
            return(mRetVal);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Saves the detail.
        /// </summary>
        /// <param name="profile">The profile.</param>
        /// <returns>System.Int32.</returns>
        public static void SaveDetail(MNameValuePairDetail profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile", "profile cannot be a null reference (Nothing in Visual Basic)!");
            }
            MSecurityEntityProfile mSecurityProfile = SecurityEntityUtility.CurrentProfile();
            BNameValuePairs        mBNameValuePairs = new BNameValuePairs(mSecurityProfile);

            CacheController.RemoveFromCache(CachedNameValuePairDetailsTableName);
            mBNameValuePairs.SaveNameValuePairDetail(profile);
        }
Exemplo n.º 5
0
        bool IDNameValuePair.DeleteNVPDetail(MNameValuePairDetail profile)
        {
            string  myStoreProcedure = "ZGWSystem.Delete_Name_Value_Pair_Detail";
            Boolean mRetVal          = false;

            SqlParameter[] mParameters = { new SqlParameter("@P_NVP_SeqID", profile.NameValuePairSeqId), new SqlParameter("@P_NVP_Detail_SeqID", profile.Id) };
            try
            {
                base.ExecuteNonQuery(myStoreProcedure, mParameters);
                mRetVal = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(mRetVal);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Gets the NVP detail.
        /// </summary>
        /// <param name="nameValuePairSeqDetailId">The NVP seq det ID.</param>
        /// <param name="nameValuePairSeqId">The NVP seq ID.</param>
        /// <returns>MNameValuePairDetail.</returns>
        public static MNameValuePairDetail GetNameValuePairDetail(int nameValuePairSeqDetailId, int nameValuePairSeqId)
        {
            DataView             mDataView    = null;
            DataTable            mDataTable   = null;
            DataTable            mImportTable = null;
            MNameValuePairDetail mRetVal      = null;

            try
            {
                GetNameValuePairDetails(ref mDataTable, nameValuePairSeqId);
                mDataTable.Locale   = CultureInfo.InvariantCulture;
                mDataView           = mDataTable.DefaultView;
                mImportTable        = mDataTable.Clone();
                mDataView.RowFilter = "NVP_SEQ_DET_ID = " + nameValuePairSeqDetailId;
                foreach (DataRowView drv in mDataView)
                {
                    mImportTable.ImportRow(drv.Row);
                }
                mRetVal = new MNameValuePairDetail(mImportTable.Rows[0]);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (mDataTable != null)
                {
                    mDataTable.Dispose();
                    mDataTable = null;
                }
                if (mDataView != null)
                {
                    mDataView.Dispose();
                    mDataView = null;
                }
                if (mImportTable != null)
                {
                    mImportTable.Dispose();
                    mImportTable = null;
                }
            }
            return(mRetVal);
        }
Exemplo n.º 7
0
        public IHttpActionResult DeleteNameValuePairDetail(UINVPDetailProfile uiProfile)
        {
            string          mRetVal          = false.ToString();
            String          mAction          = GWWebHelper.GetQueryValue(HttpContext.Current.Request, "Action");
            int             mEditId          = int.Parse(HttpContext.Current.Items["EditId"].ToString());
            MAccountProfile mUpdatingAccount = AccountUtility.CurrentProfile();
            MSecurityInfo   mSecurityInfo    = new MSecurityInfo(FunctionUtility.GetProfile(mAction), mUpdatingAccount);

            Logger mLog = Logger.Instance();

            if (mEditId != uiProfile.NVP_SEQ_DET_ID)
            {
                Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            if (!mSecurityInfo.MayDelete)
            {
                Exception mError = new Exception("The account (" + mUpdatingAccount.Account + ") being used does not have the correct permissions to delete");
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            try
            {
                MNameValuePairDetail mProfile = new MNameValuePairDetail();
                mProfile.NameValuePairSeqId = uiProfile.NVP_SEQ_ID;
                mProfile.Id          = uiProfile.NVP_SEQ_DET_ID;
                mProfile.UpdatedBy   = mUpdatingAccount.Id;
                mProfile.UpdatedDate = DateTime.Now;
                mProfile.SortOrder   = uiProfile.SortOrder;
                mProfile.Text        = uiProfile.Text;
                mProfile.Value       = uiProfile.Value;
                mProfile.Status      = uiProfile.Status;
                NameValuePairUtility.DeleteDetail(mProfile);
            }
            catch (Exception ex)
            {
                mLog.Error(ex);
                throw;
            }
            return(this.Ok(mRetVal));
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string NVP_SEQ_ID             = GWWebHelper.GetQueryValue(Request, "NVP_SEQ_ID");
            string NVP_Detail_SeqID       = GWWebHelper.GetQueryValue(Request, "NVP_Detail_SeqID");
            MNameValuePairDetail mProfile = new MNameValuePairDetail();

            if (!String.IsNullOrEmpty(NVP_SEQ_ID) && !String.IsNullOrEmpty(NVP_Detail_SeqID))
            {
                int mSeqId    = int.Parse(NVP_SEQ_ID);
                int mSeqDetId = int.Parse(NVP_Detail_SeqID);
                if (mSeqDetId != -1)
                {
                    mProfile = NameValuePairUtility.GetNameValuePairDetail(mSeqDetId, mSeqId);
                }
                hdnNVP_SEQ_ID.Value     = mSeqId.ToString();
                hdnNVP_SEQ_DET_ID.Value = mProfile.Id.ToString();
                txtValue.Value          = mProfile.Value;
                txtText.Value           = mProfile.Text;
                txtSortOrder.Value      = mProfile.SortOrder.ToString();
                HttpContext.Current.Session.Add("EditId", mProfile.Id);
            }
            HttpContext.Current.Session.Add("EditId", mProfile.Id);
        }