Beispiel #1
0
    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.SizeName = TxtItemCat.Text.Trim();

                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); }
    }
Beispiel #2
0
    private void MakeEmptyForm()
    {
        ViewState["EditID"] = null;
        TxtItemCat.Focus();
        if (!FlagAdd)
        {
            BtnSave.Visible = true;
        }
        BtnDelete.Visible = false;
        BtnUpdate.Visible = false;
        TxtItemCat.Text   = string.Empty;
        TxtSearch.Text    = string.Empty;

        ReportGrid(StrCondition);
    }
Beispiel #3
0
 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); }
 }