protected void BtnSave_Click(object sender, EventArgs e)
    {
        int InsertRow = 0, InsertRowDtls = 0;

        try
        {
            if (ChkDetails() == true)
            {
                Ds = Obj_Call.ChkDuplicate(ddlProject.SelectedValue, out StrError);
                if (Ds.Tables[0].Rows.Count > 0)
                {
                    Obj_Comm.ShowPopUpMsg("Record is Already Present..", this.Page);
                }
                else
                {
                    Entity_Call.PCId = Convert.ToInt32(ddlProject.SelectedValue);

                    Entity_Call.UserId    = Convert.ToInt32(Session["UserID"]);
                    Entity_Call.LoginDate = DateTime.Now;
                    InsertRow             = Obj_Call.InsertRecord(ref Entity_Call, out StrError);
                    if (InsertRow > 0)
                    {
                        if (ViewState["CurrentTable"] != null)
                        {
                            DataTable dtInsert = new DataTable();
                            dtInsert = (DataTable)ViewState["CurrentTable"];
                            for (int i = 0; i < dtInsert.Rows.Count; i++)
                            {
                                Entity_Call.CompanyBankId      = InsertRow;
                                Entity_Call.ProjectCompanyId   = Convert.ToInt32(dtInsert.Rows[i]["ProjectCompanyId"].ToString());
                                Entity_Call.BankTypeId         = Convert.ToInt32(dtInsert.Rows[i]["BankTypeId"].ToString());
                                Entity_Call.BankName           = dtInsert.Rows[i]["BankName"].ToString();
                                Entity_Call.Branch             = dtInsert.Rows[i]["Branch"].ToString();
                                Entity_Call.AccountNo          = dtInsert.Rows[i]["AccountNo"].ToString();
                                Entity_Call.RTGSNo             = dtInsert.Rows[i]["RTGSNo"].ToString();
                                Entity_Call.ChequeDrawnAccName = dtInsert.Rows[i]["ChequeDrawnAccName"].ToString();

                                InsertRowDtls = Obj_Call.InsertDetailsRecord(ref Entity_Call, out StrError);
                            }
                        }
                        if (InsertRow > 0)
                        {
                            Obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page);
                            //MakeControlEmpty();
                            MakeEmptyForm();
                            Entity_Call = null;
                            Obj_Call    = null;
                        }
                    }
                }
            }


            else
            {
                Obj_Comm.ShowPopUpMsg("Please Enter Details ..!", this.Page);
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
    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_Call.GetRecordForEdit(Convert.ToInt32(e.CommandArgument), out StrError);
                    if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
                    {
                        ddlProject.SelectedValue = Ds.Tables[0].Rows[0]["PCId"].ToString();
                    }
                    else
                    {
                        MakeEmptyForm();
                    }

                    if (Ds.Tables.Count > 0 && Ds.Tables[1].Rows.Count > 0)
                    {
                        GridDetails.DataSource = Ds.Tables[1];
                        GridDetails.DataBind();
                        ViewState["CurrentTable"] = Ds.Tables[1];
                    }
                    else
                    {
                        //MakeEmptyForm();
                        SetInitialRow();
                    }
                    Ds              = null;
                    Obj_Call        = null;
                    BtnSave.Visible = false;
                    if (!FlagEdit)
                    {
                        BtnUpdate.Visible = true;
                    }
                    if (!FlagDel)
                    {
                        BtnDelete.Visible = true;
                    }
                    //TxtCountry.Focus();
                }

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

        try
        {
            if (ViewState["EditID"] != null)
            {
                Entity_Call.CompanyBankId = Convert.ToInt32(ViewState["EditID"]);
            }
            Entity_Call.PCId = Convert.ToInt32(ddlProject.SelectedValue);

            Entity_Call.UserId    = Convert.ToInt32(Session["UserId"]);
            Entity_Call.LoginDate = DateTime.Now;
            UpdateRow             = Obj_Call.UpdateRecord(ref Entity_Call, out StrError);
            if (UpdateRow > 0)
            {
                if (ViewState["CurrentTable"] != null)
                {
                    DataTable dtInsert = new DataTable();
                    dtInsert = (DataTable)ViewState["CurrentTable"];
                    for (int i = 0; i < dtInsert.Rows.Count; i++)
                    {
                        Entity_Call.CompanyBankId      = Convert.ToInt32(ViewState["EditID"]);;
                        Entity_Call.ProjectCompanyId   = Convert.ToInt32(dtInsert.Rows[i]["ProjectCompanyId"].ToString());
                        Entity_Call.BankTypeId         = Convert.ToInt32(dtInsert.Rows[i]["BankTypeId"].ToString());
                        Entity_Call.BankName           = dtInsert.Rows[i]["BankName"].ToString();
                        Entity_Call.Branch             = dtInsert.Rows[i]["Branch"].ToString();
                        Entity_Call.AccountNo          = dtInsert.Rows[i]["AccountNo"].ToString();
                        Entity_Call.RTGSNo             = dtInsert.Rows[i]["RTGSNo"].ToString();
                        Entity_Call.ChequeDrawnAccName = dtInsert.Rows[i]["ChequeDrawnAccName"].ToString();
                        UpdateRowDtls = Obj_Call.InsertDetailsRecord(ref Entity_Call, out StrError);
                    }
                }
                if (UpdateRow > 0)
                {
                    Obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page);
                    MakeControlEmpty();
                    MakeEmptyForm();

                    Entity_Call = null;
                    Obj_Call    = null;
                }
            }
        }


        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
 public static string[] GetCompletionList(string prefixText, int count, string contextKey)
 {
     if (string.IsNullOrEmpty((HttpContext.Current.Cache["Dir"]).ToString()))
     {
         DataTable DtNew = null;
         return(null);
     }
     else
     {
         DMCompanyBankMaster Obj_Call = new DMCompanyBankMaster();
         DataTable           DtNew    = (DataTable)HttpContext.Current.Cache["Dir"];
         var query = from r in DtNew.AsEnumerable()
                     where (r.Field <string>("Name").ToLower()).Contains(prefixText.ToLower())
                     select(r.Field <string>("Name"));
         string[] SearchList = query.ToArray();
         return(SearchList);
     }
 }