예제 #1
0
    private void MakeEmptyForm()
    {
        TxtUnit.Focus();
        if (!FlagAdd)
        {
            BtnSave.Visible = true;
        }
        BtnUpdate.Visible = false;
        BtnDelete.Visible = false;
        TxtUnit.Text      = string.Empty;
        TxtSearch.Text    = string.Empty;

        ReportGrid(StrCondition);
    }
예제 #2
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_Unit.GetUnitForEdit(Convert.ToInt32(e.CommandArgument), out StrError);
                    if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
                    {
                        TxtUnit.Text = DS.Tables[0].Rows[0]["Unit"].ToString();
                    }
                    else
                    {
                        MakeEmptyForm();
                    }
                    DS       = null;
                    Obj_Unit = null;
                    if (!FlagEdit)
                    {
                        BtnUpdate.Visible = true;
                    }
                    BtnSave.Visible = false;
                    if (!FlagDel)
                    {
                        BtnDelete.Visible = true;
                    }
                    TxtUnit.Focus();
                }

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

        try
        {
            DS = Obj_Unit.ChkDuplicate(TxtUnit.Text.Trim(), out StrError);

            if (DS.Tables[0].Rows.Count > 0)
            {
                obj_Comm.ShowPopUpMsg("Unit Name Already Exist..!", this.Page);
                TxtUnit.Focus();
            }
            else
            {
                Entity_Unit.UnitName  = TxtUnit.Text.Trim();
                Entity_Unit.UserId    = Convert.ToInt32(Session["UserId"]);
                Entity_Unit.LoginDate = DateTime.Now;
                Entity_Unit.IsDeleted = false;

                InsertRow = Obj_Unit.InsertRecord(ref Entity_Unit, out StrError);

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