Exemple #1
0
    public static string[] GetCompletionList(string prefixText, int count, string contextKey)
    {
        DMItemCategory Obj_ItemCategory = new DMItemCategory();

        String[] SearchList = Obj_ItemCategory.GetSuggestedRecord(prefixText);
        return(SearchList);
    }
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        try
        {
            int DeleteId = 0;
            if (ViewState["EditID"] != null)
            {
                DeleteId = Convert.ToInt32(ViewState["EditID"]);
            }
            if (DeleteId != 0)
            {
                Entity_ItemCategory.CategoryId = DeleteId;
                Entity_ItemCategory.UserId     = Convert.ToInt32(Session["UserID"]);
                Entity_ItemCategory.LoginDate  = DateTime.Now;

                int iDelete = Obj_ItemCategory.DeleteRecord(ref Entity_ItemCategory, out StrError);
                if (iDelete != 0)
                {
                    obj_Comman.ShowPopUpMsg("Record Deleted Successfully..!", this.Page);
                    MakeEmptyForm();
                }
            }
            Entity_ItemCategory = null;
            Obj_ItemCategory    = null;
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        int UpdateRow = 0;

        try
        {
            if (ViewState["EditID"] != null)
            {
                Entity_ItemCategory.CategoryId = Convert.ToInt32(ViewState["EditID"]);
            }
            Entity_ItemCategory.CategoryName = TxtItemCat.Text.Trim();
            Entity_ItemCategory.Prefix       = txtPrefix.Text.Trim();

            Entity_ItemCategory.UserId    = Convert.ToInt32(Session["UserId"]);
            Entity_ItemCategory.LoginDate = DateTime.Now;

            UpdateRow = Obj_ItemCategory.UpdateRecord(ref Entity_ItemCategory, out StrError);

            if (UpdateRow != 0)
            {
                obj_Comman.ShowPopUpMsg("Record Updated Successfully", this.Page);
                MakeEmptyForm();
                Entity_ItemCategory = null;
                Obj_ItemCategory    = null;
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        int InsertRow = 0;

        try
        {
            Ds = Obj_ItemCategory.ChkDuplicate(TxtItemCat.Text.Trim(), out StrError);
            if (Ds.Tables[0].Rows.Count > 0)
            {
                obj_Comman.ShowPopUpMsg("Please Enter Another Item Category..", this.Page);
                TxtItemCat.Focus();
            }
            else
            {
                Entity_ItemCategory.CategoryName = TxtItemCat.Text.Trim();
                Entity_ItemCategory.Prefix       = txtPrefix.Text;
                Entity_ItemCategory.UserId       = Convert.ToInt32(Session["UserId"]);
                Entity_ItemCategory.LoginDate    = DateTime.Now;

                InsertRow = Obj_ItemCategory.InsertRecord(ref Entity_ItemCategory, out StrError);

                if (InsertRow != 0)
                {
                    obj_Comman.ShowPopUpMsg("Record Saved Successfully", this.Page);
                    MakeEmptyForm();
                    Entity_ItemCategory = null;
                    Obj_ItemCategory    = null;
                }
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
 public void ReportGrid(string RepCondition)
 {
     try
     {
         Ds = Obj_ItemCategory.GetItemCategory(RepCondition, out StrError);
         if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
         {
             GrdReport.DataSource = Ds.Tables[0];
             GrdReport.DataBind();
         }
         else
         {
             GrdReport.DataSource = null;
             GrdReport.DataBind();
         }
         Obj_ItemCategory = null;
         Ds = null;
     }
     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_ItemCategory.GetItemCategoryForEdit(Convert.ToInt32(e.CommandArgument), out StrError);
                 if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
                 {
                     TxtItemCat.Text = Ds.Tables[0].Rows[0]["CategoryName"].ToString();
                     txtPrefix.Text  = Ds.Tables[0].Rows[0]["Prefix"].ToString();
                 }
                 else
                 {
                     MakeEmptyForm();
                 }
                 Ds = null;
                 Obj_ItemCategory = null;
                 if (!FlagEdit)
                 {
                     BtnUpdate.Visible = true;
                 }
                 BtnSave.Visible = false;
                 if (!FlagDel)
                 {
                     BtnDelete.Visible = true;
                 }
                 TxtItemCat.Focus();
             }
             break;
         }
         }
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
 }