private void mLoadAll() { Languages lang = new Languages(); lang.LoadByLanguageCode(Global.MethodsAndProps.CurrentLanguageCode); Subjects ListItems = new Subjects(); ListItems.LoadByIDParent(subjectID); //ListItems.LoadByIDSubjectTypeAndIDLanguage((byte)SubjectTypes.Enum.listItem, language); ListItems.Sort = Subjects.ColumnNames.Priority; Subjects result = new Subjects(); for (int i = 0; i < limit; i++) { result.AddNew(); result.pIDSubject = ListItems.pIDSubject; result.pTitle = ListItems.pTitle; result.pAlias = ListItems.pAlias; ListItems.MoveNext(); } rptSidebar.DataSource = result.DefaultView; rptSidebar.DataBind(); }
private void mSave() { if (mValidateAddEdit()) { DAL.GlobalCore.TransactionMgr tx = DAL.GlobalCore.TransactionMgr.ThreadTransactionMgr(); bool isNew = false; try { tx.BeginTransaction(); Subjects subjects = new Subjects(); if (pIDSubject.HasValue) { subjects.LoadByPrimaryKey(pIDSubject.Value); } else { subjects.AddNew(); subjects.pPriority = mSetPriority(); pIDSubject = subjects.pIDSubject = Guid.NewGuid(); subjects.pDate = DateTime.UtcNow.AddHours(Global.MethodsAndProps.TimeZone); isNew = true; } subjects.pIDSubjectType = (byte)SubjectTypes.Enum.listItem; subjects.pIDLanguage = pLanguageID; subjects.pTitle = txtTitle.Text; HiddenField TCMEValue = (HiddenField)tinyMCE.FindControl("TCMEValue"); subjects.pBody = System.Web.HttpUtility.HtmlDecode(TCMEValue.Value); subjects.pIsActive = cbxIsActive.Checked; subjects.pIDParent = pSubjectTypeID.Value; subjects.pDate = Convert.ToDateTime(string.Format("{0} {1}", Convert.ToDateTime(txtDate.Text).ToString(Global.MethodsAndProps.DateFormat), DateTime.UtcNow.AddHours(Global.MethodsAndProps.TimeZone).ToString("HH:mm:ss"))); subjects.pAlias = Global.MethodsAndProps.mAliasCorrection(txtAlias.Text); subjects.Save(); //mUpdateSiteMap = No Need, as there is "List Name" for urls in Sitemaps if (isNew) { mSetPopupData(subjects); } tx.CommitTransaction(); pMessage.Clear(); pMessage.Add(Farschidus.Translator.AppTranslate["general.message.success"], Farschidus.Web.UI.Message.MessageTypes.Success); mShowMessage(pMessage); } catch (Exception ex) { tx.RollbackTransaction(); pMessage.Clear(); pMessage.Add(ex.Message, Farschidus.Web.UI.Message.MessageTypes.Error); mShowMessage(pMessage); } } else { mShowMessage(pMessage); } }
private void mSave() { if (mValidateAddEdit()) { DAL.GlobalCore.TransactionMgr tx = DAL.GlobalCore.TransactionMgr.ThreadTransactionMgr(); bool isNew = false; try { tx.BeginTransaction(); Subjects subjects = new Subjects(); if (pIDSubject.HasValue) { subjects.LoadByPrimaryKey(pIDSubject.Value); } else { subjects.AddNew(); subjects.pPriority = mSetPriority(); pIDSubject = subjects.pIDSubject = Guid.NewGuid(); subjects.pDate = DateTime.UtcNow.AddHours(Global.MethodsAndProps.TimeZone); isNew = true; } subjects.pIDSubjectType = (byte)SubjectTypes.Enum.category; subjects.pIDLanguage = pLanguageID; subjects.pTitle = txtTitle.Text; HiddenField TCMEValue = (HiddenField)tinyMCE.FindControl("TCMEValue"); subjects.pBody = System.Web.HttpUtility.HtmlDecode(TCMEValue.Value); subjects.pIsActive = true; //subjects.pIDParent = Not applicable. subjects.pAlias = Global.MethodsAndProps.mAliasCorrection(txtAlias.Text); subjects.Save(); if (isNew) { mSetPopupData(subjects); } tx.CommitTransaction(); pMessage.Clear(); pMessage.Add(Farschidus.Translator.AppTranslate["general.message.success"], Farschidus.Web.UI.Message.MessageTypes.Success); mShowMessage(pMessage); } catch (Exception ex) { tx.RollbackTransaction(); pMessage.Clear(); pMessage.Add(ex.Message, Farschidus.Web.UI.Message.MessageTypes.Error); mShowMessage(pMessage); } } else { mShowMessage(pMessage); } }
private void mSave() { if (mValidateAddEdit()) { DAL.GlobalCore.TransactionMgr tx = DAL.GlobalCore.TransactionMgr.ThreadTransactionMgr(); bool isNew = false; try { tx.BeginTransaction(); Subjects subjects = new Subjects(); subjects.LoadBySubjectAliasAndIDSubjectType(pIDUser.Value.ToString(), (byte)SubjectTypes.Enum.userPage); if (subjects.RowCount > 0) { // Do Nothing, It's an Edit action } else { subjects.AddNew(); subjects.pIDSubject = Guid.NewGuid(); subjects.pDate = DateTime.UtcNow.AddHours(Global.MethodsAndProps.TimeZone); isNew = true; } subjects.pIDSubjectType = (byte)SubjectTypes.Enum.userPage; subjects.pIDLanguage = pLanguageID; subjects.pTitle = txtTitle.Text; HiddenField TCMEValue = (HiddenField)tinyMCE.FindControl("TCMEValue"); subjects.pBody = System.Web.HttpUtility.HtmlDecode(TCMEValue.Value); subjects.pIsActive = cbxIsActive.Checked; subjects.pAlias = pIDUser.ToString(); subjects.SetColumnNull(Subjects.ColumnNames.IDParent); subjects.Save(); if(isNew) mSetPopupData(subjects); tx.CommitTransaction(); pMessage.Clear(); pMessage.Add(Farschidus.Translator.AppTranslate["general.message.success"], Farschidus.Web.UI.Message.MessageTypes.Success); mShowMessage(pMessage); } catch (Exception ex) { tx.RollbackTransaction(); pMessage.Clear(); pMessage.Add(ex.Message, Farschidus.Web.UI.Message.MessageTypes.Error); mShowMessage(pMessage); } } else { mShowMessage(pMessage); } }
private void mSave() { if (mValidateAddEdit()) { DAL.GlobalCore.TransactionMgr tx = DAL.GlobalCore.TransactionMgr.ThreadTransactionMgr(); bool isNew = false; try { tx.BeginTransaction(); Subjects subjects = new Subjects(); if (pIDSubject.HasValue) { subjects.LoadByPrimaryKey(pIDSubject.Value); } else { subjects.AddNew(); subjects.pPriority = mSetPriority(); pIDSubject = subjects.pIDSubject = Guid.NewGuid(); subjects.pDate = DateTime.UtcNow.AddHours(Global.MethodsAndProps.TimeZone); isNew = true; } subjects.pIDSubjectType = Convert.ToByte(ddlAddEditGalleryType.SelectedValue); subjects.pIDLanguage = pLanguageID; subjects.pTitle = txtTitle.Text; HiddenField TCMEValue = (HiddenField)tinyMCE.FindControl("TCMEValue"); subjects.pBody = System.Web.HttpUtility.HtmlDecode(TCMEValue.Value); subjects.pIsActive = cbxIsActive.Checked; if (ddlCategory.SelectedIndex != 0) { subjects.pIDParent = new Guid(ddlCategory.SelectedValue); } else { subjects.SetColumnNull(Subjects.ColumnNames.IDParent); } subjects.pAlias = Global.MethodsAndProps.mAliasCorrection(txtAlias.Text); subjects.Save(); if (pIDSubject.HasValue) { Global.MethodsAndProps.mUpdateSiteMap(subjects.pIDSubject.ToString(), subjects.pAlias, Global.Constants.STRING_GALLERY_MODULE); } if (isNew) { mSetPopupData(subjects); } tx.CommitTransaction(); pMessage.Clear(); pMessage.Add(Farschidus.Translator.AppTranslate["general.message.success"], Farschidus.Web.UI.Message.MessageTypes.Success); mShowMessage(pMessage); } catch (Exception ex) { tx.RollbackTransaction(); pMessage.Clear(); pMessage.Add(ex.Message, Farschidus.Web.UI.Message.MessageTypes.Error); mShowMessage(pMessage); } } else { mShowMessage(pMessage); } }