//User Right Function===========

    private void MakeEmptyForm()
    {
        if (!FlagAdd)
        {
            BtnSave.Visible = true;
        }
        BtnUpdate.Visible      = false;
        BtnDelete.Visible      = false;
        TxtCostCentre.Text     = string.Empty;
        ddlSite.SelectedValue  = "0";
        ddlTower.SelectedValue = "0";
        TxtSearch.Text         = string.Empty;
        ReportGrid(StrCondition);
        TxtCostCentre.Focus();
    }
    protected void GrdReport_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            switch (e.CommandName)
            {
            case ("Select"):
            {
                if (Convert.ToInt32(e.CommandArgument) != 0)
                {
                    ViewState["EditID"] = Convert.ToInt32(e.CommandArgument);
                    DS = Obj_SL.GetStockLOcationForEdit(Convert.ToInt32(e.CommandArgument), out StrError);
                    if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
                    {
                        TxtCostCentre.Text     = DS.Tables[0].Rows[0]["Location"].ToString();
                        ddlSite.SelectedValue  = DS.Tables[0].Rows[0]["SiteId"].ToString();
                        ddlTower.SelectedValue = DS.Tables[0].Rows[0]["TowerId"].ToString();
                    }
                    else
                    {
                        MakeEmptyForm();
                    }
                    DS     = null;
                    Obj_SL = null;
                    if (!FlagEdit)
                    {
                        BtnUpdate.Visible = true;
                    }
                    BtnSave.Visible = false;
                    if (!FladDel)
                    {
                        BtnDelete.Visible = true;
                    }
                    TxtCostCentre.Focus();
                }

                break;
            }
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        int InsertRow = 0;

        try
        {
            DS = Obj_SL.ChkDuplicate(TxtCostCentre.Text.Trim(), out StrError);

            if (DS.Tables[0].Rows.Count > 0)
            {
                obj_Comm.ShowPopUpMsg("Cost Location Name Already Exist..!", this.Page);
                TxtCostCentre.Focus();
            }
            else
            {
                Entity_SL.Location  = TxtCostCentre.Text.Trim();
                Entity_SL.SiteId    = Convert.ToInt32(ddlSite.SelectedValue);
                Entity_SL.TowerId   = Convert.ToInt32(ddlTower.SelectedValue);
                Entity_SL.CompanyId = 0;
                Entity_SL.UserId    = Convert.ToInt32(Session["UserId"]);
                Entity_SL.LoginDate = DateTime.Now;
                Entity_SL.IsDeleted = false;
                InsertRow           = Obj_SL.InsertRecord(ref Entity_SL, out StrError);

                if (InsertRow != 0)
                {
                    obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page);
                    MakeEmptyForm();
                    Entity_SL = null;
                    obj_Comm  = null;
                }
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }