Beispiel #1
0
    protected void chkIsHasOther_OnCheckedChanged(object sender, EventArgs e)
    {
        foreach (GridDataItem item in rgFlagReason.Items)
        {
            CheckBox    chkIsHasOther = (CheckBox)item.FindControl("chkIsHasOther");
            HiddenField hdfIdOther    = (HiddenField)item.FindControl("hdfIdOther");
            if (hdfIdOther != null)
            {
                try
                {
                    FlagReasons f = FlagReasons.GetFlagReasons(new Guid(hdfIdOther.Value));
                    if (f != null)
                    {
                        if (chkIsHasOther.Checked)
                        {
                            f.isHasOther = true;
                            //f.Description = string.Empty;
                        }
                        else
                        {
                            f.isHasOther = false;
                        }

                        f.Save();
                    }
                }
                catch { }
            }
        }
        BindGrid(true);
    }
Beispiel #2
0
 protected void chkAcDec_OnCheckedChanged(object sender, EventArgs e)
 {
     foreach (GridDataItem item in rgFlagReason.Items)
     {
         CheckBox    chkAcDec = (CheckBox)item.FindControl("chkAcDec");
         HiddenField hdfId    = (HiddenField)item.FindControl("hdfId");
         if (hdfId != null)
         {
             try
             {
                 FlagReasons f = FlagReasons.GetFlagReasons(new Guid(hdfId.Value));
                 if (f != null)
                 {
                     if (chkAcDec != null)
                     {
                         if (chkAcDec.Checked)
                         {
                             f.IsActive = true;
                         }
                         else
                         {
                             f.IsActive = false;
                         }
                         f.Save();
                     }
                 }
             }
             catch { }
         }
     }
     BindGrid(true);
 }
Beispiel #3
0
    protected void rgFlagReason_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            FlagReasons f        = (FlagReasons)e.Item.DataItem;
            CheckBox    chkAcDec = (CheckBox)e.Item.FindControl("chkAcDec");
            HiddenField hdfId    = (HiddenField)e.Item.FindControl("hdfId");
            hdfId.Value = f.Id.ToString();
            CheckBox    chkIsHasOther = (CheckBox)e.Item.FindControl("chkIsHasOther");
            HiddenField hdfIdOther    = (HiddenField)e.Item.FindControl("hdfIdOther");
            hdfIdOther.Value = f.Id.ToString();


            if (f.IsActive)
            {
                chkAcDec.Checked = true;
            }
            else
            {
                chkAcDec.Checked = false;
            }
            if (f.isHasOther)
            {
                chkIsHasOther.Checked = true;
            }
            else
            {
                chkIsHasOther.Checked = false;
            }


            LinkButton lnkBtnDelete = (LinkButton)e.Item.FindControl("lnkBtnDelete");
            lnkBtnDelete.Attributes.Add("onclick", "return DeleteConfirmation('" + ((GridDataItem)e.Item)["Bodyname"].Text + "');");
        }
        else if (e.Item.ItemType == GridItemType.Pager)
        {
            RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");

            PageSizeCombo.Items.Clear();
            PageSizeCombo.Items.Add(new RadComboBoxItem("50", "50"));
            PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", rgFlagReason.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("100", "100"));
            PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", rgFlagReason.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("200", "200"));
            PageSizeCombo.FindItemByText("200").Attributes.Add("ownerTableViewId", rgFlagReason.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("All", "99999"));
            PageSizeCombo.FindItemByText("All").Attributes.Add("ownerTableViewId", rgFlagReason.MasterTableView.ClientID);
            PageSizeCombo.FindItemByValue(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
        }
    }
Beispiel #4
0
 protected void rgFlagReason_ItemCommand(object sender, GridCommandEventArgs e)
 {
     lblError.Text = "";
     if (e.CommandName == "EditItem")
     {
         Response.Redirect("FlagReasonCMS.aspx?Id=" + ((GridDataItem)e.Item)["Id"].Text);
     }
     if (e.CommandName == "DeleteItem")
     {
         GridDataItem item = (GridDataItem)e.Item;
         FlagReasons.DeleteFlagReasons(new Guid(item["Id"].Text));
         lblError.Text = item["Bodyname"].Text + " Is deleted<br>";
     }
 }
Beispiel #5
0
 private void PopulateForm(FlagReasons f)
 {
     txtDescription.Text = f.Description;
     txtBodyName.Text    = f.Bodyname;
     chkHasOther.Checked = f.isHasOther;
     if (chkHasOther.Checked)
     {
         pnlOther.Visible = false;
     }
     else
     {
         pnlOther.Visible = true;
     }
     chkIsActive.Checked = f.IsActive;
 }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            f            = FlagReasons.NewFlagReasons();
            flagIdString = Request.QueryString["id"];
            if ((flagIdString != null && Guid.TryParse(flagIdString, out flagId)))
            {
                f = FlagReasons.GetFlagReasons(flagId);
            }

            LoadForm();
            PopulateForm(f);
        }
    }
Beispiel #7
0
    protected void btnSave_OnClick(object sender, EventArgs e)
    {
        if (!ValidateForm())
        {
            return;
        }
        else
        {
            if (Request.QueryString["id"] == null)
            {
                f = FlagReasons.NewFlagReasons();
                f.DateCreatedString = DateTime.Now.ToString();
            }
            else
            {
                f = FlagReasons.GetFlagReasons(new Guid(Request.QueryString["id"]));
                f.DateModifiedString = DateTime.Now.ToString();
            }
            f.Bodyname = txtBodyName.Text;
            f.IsActive = chkIsActive.Checked;
            if (chkHasOther.Checked)
            {
                f.isHasOther  = true;
                f.Description = "";
            }
            else if (!chkHasOther.Checked)
            {
                f.isHasOther  = false;
                f.Description = txtDescription.Text;
            }

            if (f.IsValid)
            {
                f.Save();
                Response.Redirect("FlagReasonCMSList.aspx");
            }
        }
    }