예제 #1
0
 protected void btnAddToPage_Click(object sender, EventArgs e)
 {
     try
     {
         SubjectProperties subjectProperties = new SubjectProperties(pSubjectID, Convert.ToInt32(ddlProperties.SelectedValue));
         if (subjectProperties.RowCount.Equals(0))
         {
             subjectProperties.AddNew();
             subjectProperties.pIDSubject    = pSubjectID;
             subjectProperties.pIDProperty   = Convert.ToInt32(ddlProperties.SelectedValue);
             subjectProperties.pIsSearchable = chbIsSearchable.Checked;
             subjectProperties.Save();
             pMessage.Clear();
             pMessage.Add(Farschidus.Translator.AppTranslate["general.message.success"], Farschidus.Web.UI.Message.MessageTypes.Success);
             mLoadAllGroupProperties();
         }
         else
         {
             pMessage.Add(Farschidus.Translator.AppTranslate["property.popup.message.alreadyExist"], Farschidus.Web.UI.Message.MessageTypes.Information);
         }
     }
     catch (Exception ex)
     {
         pMessage.Clear();
         pMessage.Add(ex.Message, Farschidus.Web.UI.Message.MessageTypes.Error);
     }
     finally
     {
         mShowMessage(pMessage);
     }
 }
예제 #2
0
 protected void btnRemoveFromPage_Click(object sender, EventArgs e)
 {
     try
     {
         pMessage.Clear();
         bool hasSelect = false;
         int  item;
         SubjectProperties subjectProperties = new SubjectProperties();
         foreach (GridViewRow grvRow in grvGroupPropeties.Rows)
         {
             if (((CheckBox)grvRow.FindControl("chkPageList")).Checked)
             {
                 item = Convert.ToInt32(grvGroupPropeties.DataKeys[grvRow.RowIndex][SubjectProperties.ColumnNames.IDProperty].ToString());
                 subjectProperties.LoadByPrimaryKey(pSubjectID, item);
                 if (subjectProperties.RowCount > 0)
                 {
                     subjectProperties.MarkAsDeleted(false);
                     subjectProperties.Save();
                     hasSelect = true;
                 }
             }
         }
         if (hasSelect)
         {
             //reorderMediaSubjects(subjectProperties);
             mLoadAllGroupProperties();
             pMessage.Add(Farschidus.Translator.AppTranslate["general.message.deleted"], Farschidus.Web.UI.Message.MessageTypes.Success);
         }
     }
     catch (Exception ex)
     {
         pMessage.Add(ex.Message, Farschidus.Web.UI.Message.MessageTypes.Error);
     }
     finally
     {
         mShowMessage(pMessage);
     }
 }