Exemplo n.º 1
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);
 }
Exemplo n.º 2
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);
    }
Exemplo n.º 3
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");
            }
        }
    }