Exemplo n.º 1
0
 protected void btnSaveChanges_Click(object sender, EventArgs e)
 {
     try
     {
         if (ddlIslemler.SelectedIndex > 0 & Core.IsUserAdmin)
         {
             bool chkState = false;
             switch (ddlIslemler.SelectedIndex)
             {
                 case 1:
                 case 3:
                     chkState = true;
                     break;
             }
             if (ddlIslemler.SelectedIndex == 1 || ddlIslemler.SelectedIndex == 2)
             {
                 foreach (GridViewRow item in dataGrid1.Rows)
                     if (((CheckBox)item.Cells[0].FindControl("chkSelected")).Checked)
                         Core.Update("yorum", "yoneticionay", BAYMYO.UI.Converts.NullToGuidString(dataGrid1.DataKeys[item.RowIndex][0]), chkState);
                 GetDataPaging();
             }
             else if (ddlIslemler.SelectedIndex == 3 || ddlIslemler.SelectedIndex == 4)
             {
                 foreach (GridViewRow item in dataGrid1.Rows)
                     if (((CheckBox)item.Cells[0].FindControl("chkSelected")).Checked)
                         Core.Update("yorum", "aktif", BAYMYO.UI.Converts.NullToGuidString(dataGrid1.DataKeys[item.RowIndex][0]), chkState);
                 GetDataPaging();
             }
             else if (ddlIslemler.SelectedIndex == 5)
             {
                 foreach (GridViewRow item in dataGrid1.Rows)
                     if (((CheckBox)item.Cells[0].FindControl("chkSelected")).Checked)
                         YorumMethods.Publish(BAYMYO.UI.Converts.NullToGuidString(dataGrid1.DataKeys[item.RowIndex][0]));
                 GetDataPaging();
             }
             else if (ddlIslemler.SelectedIndex == 6)
             {
                 foreach (GridViewRow item in dataGrid1.Rows)
                     if (((CheckBox)item.Cells[0].FindControl("chkSelected")).Checked)
                         YorumMethods.Delete(BAYMYO.UI.Converts.NullToGuidString(dataGrid1.DataKeys[item.RowIndex][0]));
                 GetDataPaging();
             }
         }
     }
     catch (Exception ex)
     {
         pageNumberLiteral.Text = ex.Message;
     }
 }
Exemplo n.º 2
0
        protected void rptComments_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (this.IsCommandActive)
            {
                switch (e.CommandName)
                {
                case "aktif":
                    using (HiddenField hv = rptComments.Items[e.Item.ItemIndex].FindControl("hfID") as HiddenField)
                    {
                        if (hv != null)
                        {
                            using (Yorum m = YorumMethods.GetYorum(BAYMYO.UI.Converts.NullToGuidString(hv.Value)))
                            {
                                if (!string.IsNullOrEmpty(m.ID))
                                {
                                    m.Aktif = true;
                                    YorumMethods.Update(m);
                                    GetDataPaging();
                                    CustomizeControl1.MessageText = MessageBox.Show(DialogResult.Succes, "Yorum başarılı bir şekilde aktif edildi!");
                                }
                            }
                        }
                    }
                    break;

                case "pasif":
                    using (HiddenField hv = rptComments.Items[e.Item.ItemIndex].FindControl("hfID") as HiddenField)
                    {
                        if (hv != null)
                        {
                            using (Yorum m = YorumMethods.GetYorum(BAYMYO.UI.Converts.NullToGuidString(hv.Value)))
                            {
                                if (!string.IsNullOrEmpty(m.ID))
                                {
                                    m.Aktif = false;
                                    YorumMethods.Update(m);
                                    GetDataPaging();
                                    CustomizeControl1.MessageText = MessageBox.Show(DialogResult.Succes, "Yorum başarılı bir şekilde pasif edildi!");
                                }
                            }
                        }
                    }
                    break;

                case "remove":
                    using (HiddenField hv = rptComments.Items[e.Item.ItemIndex].FindControl("hfID") as HiddenField)
                    {
                        if (hv != null)
                        {
                            using (Yorum m = YorumMethods.GetYorum(BAYMYO.UI.Converts.NullToGuidString(hv.Value)))
                            {
                                if (!string.IsNullOrEmpty(m.ID))
                                {
                                    YorumMethods.Delete(m);
                                    GetDataPaging();
                                    CustomizeControl1.MessageText = MessageBox.Show(DialogResult.Stop, "Yorum başarılı bir şekilde pasif edildi!");
                                }
                            }
                        }
                    }
                    break;
                }
            }
        }