protected void btSave_Click(object sender, EventArgs e)
 {
     if (btSave.Text == "Save")
     {
         IncidentCategoryClass obj = new IncidentCategoryClass();
         obj.IncidentCategoryName = tbIncidentCategoryName.Text;
         obj.IsActive             = cbIsActive.Checked;
         MEMBERS.SQLReturnValue mRes;
         obj.Flag = "ADD";
         mRes     = IncidentCategoryClass.Insert_Update_IncidentCategory(obj);
         ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true);
     }
     else if (btSave.Text == "Edit")
     {
         IncidentCategoryClass obj = new IncidentCategoryClass();
         obj.IncidentCategoryName = tbIncidentCategoryName.Text;
         obj.IsActive             = cbIsActive.Checked;
         MEMBERS.SQLReturnValue mRes;
         obj.Flag = "EDIT";
         obj.IncidentCategoryIDP = Int64.Parse(hfIncidentCategoryIDP.Value);
         mRes        = IncidentCategoryClass.Insert_Update_IncidentCategory(obj);
         btSave.Text = "Save";
         ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true);
     }
     ClearControls();
     BindData();
 }
    protected void dgcategory_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int index = 0;
        IncidentCategoryClass p = new IncidentCategoryClass();

        if (e.CommandName == "Up")
        {
            index = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[1]);

            if (index > 0)
            {
                int mobilePriority = index;

                p.priority            = mobilePriority - 1;
                p.IncidentCategoryIDP = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[0]);
                p.Flag = "CATEGORY_UP";
                int outsave = IncidentCategoryClass.GetPriority(p).ValueFromSQL;
                BindData();
            }
        }
        if (e.CommandName == "Down")
        {
            index = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[1]);
            int mobilePriority = index;
            p.priority            = mobilePriority + 1;
            p.IncidentCategoryIDP = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[0]);
            p.Flag = "CATEGORY_DOWN";
            int outsave = IncidentCategoryClass.GetPriority(p).ValueFromSQL;
            BindData();
        }
    }
    protected void rptData_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandArgument != null)
        {
            Int64 IncidentCategoryIDP = Int64.Parse(e.CommandArgument.ToString());
            switch (e.CommandName)
            {
            case "cEdit":
                hfID.Value = IncidentCategoryIDP.ToString();
                DataTable dtGetCity = IncidentCategoryClass.GetIncidentCategory_ByCategoryID(IncidentCategoryIDP);
                if (dtGetCity.Rows.Count > 0)
                {
                    tbIncidentCategoryName.Text = dtGetCity.Rows[0]["IncidentCategoryName"].ToString();
                    cbIsActive.Checked          = bool.Parse(dtGetCity.Rows[0]["IsActive"].ToString());
                    pnC.Visible      = true;
                    pnG.Visible      = false;
                    btAddNew.Visible = false;
                }
                break;

            case "cDelete":
                MEMBERS.SQLReturnValue mRes = IncidentCategoryClass.DeleteIncidentCategory_ByCategoryID(IncidentCategoryIDP);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true);
                ClearControls();
                BindData();
                break;
            }
        }
    }
    protected void btSave_Click(object sender, EventArgs e)
    {
        IncidentCategoryClass obj = new IncidentCategoryClass();

        obj.IncidentCategoryName = tbIncidentCategoryName.Text;
        obj.IsActive             = cbIsActive.Checked;
        MEMBERS.SQLReturnValue mRes;
        if (hfID.Value == string.Empty)
        {
            obj.Flag = "ADD";
            mRes     = IncidentCategoryClass.Insert_Update_IncidentCategory(obj);
        }
        else
        {
            obj.Flag = "EDIT";
            obj.IncidentCategoryIDP = Int64.Parse(hfID.Value);
            mRes = IncidentCategoryClass.Insert_Update_IncidentCategory(obj);
        }
        ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true);
        ClearControls();
        BindData();
        pnC.Visible      = false;
        pnG.Visible      = true;
        btAddNew.Visible = true;
    }
    protected void dgbanner_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int index = 0;
        IncidentCategoryClass p = new IncidentCategoryClass();

        if (e.CommandName == "Up")
        {
            index = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[1]);

            if (index > 0)
            {
                int mobilePriority = index;
                p.priority  = mobilePriority - 1;
                p.bannerIDP = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[0]);
                p.Flag      = "banner_up";
                int outsave = IncidentCategoryClass.GetBannerPriority(p).ValueFromSQL;
                BindBanner();
            }
        }
        if (e.CommandName == "Down")
        {
            index = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[1]);
            int mobilePriority = index;
            p.priority  = mobilePriority + 1;
            p.bannerIDP = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[0]);
            p.Flag      = "banner_down";
            int outsave = IncidentCategoryClass.GetBannerPriority(p).ValueFromSQL;
            BindBanner();
        }
    }
 public void BindData()
 {
     dgcategory.DataSource = IncidentCategoryClass.GetAllIncidentCategory();
     dgcategory.DataBind();
 }
 public void BindData()
 {
     rptData.DataSource = IncidentCategoryClass.GetAllIncidentCategory();
     rptData.DataBind();
 }