Esempio n. 1
0
    protected void grvList_Select(object sender, CommandEventArgs e)
    {
        mDeleteMediaSubject();

        MediaSubjects mediaSubject = new MediaSubjects();

        mediaSubject.AddNew();
        mediaSubject.pIDMedia            = Convert.ToInt32(e.CommandArgument);
        mediaSubject.pIDSubject          = pSubjectID;
        mediaSubject.pIDMediaSubjectType = pMediaSubjectTypeID;
        mediaSubject.Save();

        mSave();
    }
Esempio n. 2
0
 protected void btnAddToPage_Click(object sender, EventArgs e)
 {
     try
     {
         pMessage.Clear();
         bool          hasSelect = false;
         int           item;
         MediaSubjects mediaSubjects = new MediaSubjects();
         foreach (GridViewRow grvRow in grvList.Rows)
         {
             if (((CheckBox)grvRow.FindControl("chkList")).Checked)
             {
                 item = Convert.ToInt32(grvList.DataKeys[grvRow.RowIndex][Medias.ColumnNames.IDMedia].ToString());
                 mediaSubjects.LoadByPrimaryKey(item, pSubjectID, pMediaSubjectTypeID);
                 if (mediaSubjects.RowCount == 0)
                 {
                     mediaSubjects.AddNew();
                     mediaSubjects.pIDMedia            = item;
                     mediaSubjects.pIDSubject          = pSubjectID;
                     mediaSubjects.pIDMediaSubjectType = pMediaSubjectTypeID;
                     mediaSubjects.pPriority           = mSetPriority();
                     mediaSubjects.Save();
                     hasSelect = true;
                 }
                 else
                 {
                     pMessage.Add(Farschidus.Translator.AppTranslate["thumbnail.popup.message.alreadyExist"] + ": " + mediaSubjects.Medias.pFileName, Farschidus.Web.UI.Message.MessageTypes.Information);
                 }
             }
         }
         if (hasSelect)
         {
             mLoadAll();
             pMessage.Add(Farschidus.Translator.AppTranslate["general.message.success"], Farschidus.Web.UI.Message.MessageTypes.Success);
         }
     }
     catch (Exception ex)
     {
         pMessage.Add(ex.Message, Farschidus.Web.UI.Message.MessageTypes.Error);
     }
     finally
     {
         mShowMessage(pMessage);
         uplAddEdit.Update();
     }
 }