예제 #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (this.lblErrorMessage.Text.Length != 0)
        {
            this.lblErrorMessage.Text = "";
        }

        if (this.txtBranchName.Text.Length == 0)
        {
            this.lblErrorMessage.Text = "Branch Name field can not be blank. Please Insert";
            txtBranchName.Focus();
            return;
        }

        else if (this.txtBranchAddress.Text.Length == 0)
        {
            this.lblErrorMessage.Text = "Branch Address field can not be blank. Please Insert";
            this.txtBranchAddress.Focus();
            return;
        }
        else if (this.txtCashInSafeLimit.Text.Length == 0)
        {
            this.lblErrorMessage.Text = "Cash In Safe Limit field can not be blank.You must enter a number.";
            this.txtCashInSafeLimit.Focus();
            return;
        }

        try
        {
            BranchInfoDTO brdto = Populate();

            IBranchInfoBL brFacade = Facade.GetInstance().createBranchBL();
            brFacade.addNewBranch(brdto);
            this.lblErrorMessage.Text = "Data Save Successfully.";
            this.txtBR_PK.Value       = "";


            int    codeno = 0;
            string num;
            int    brcodeno = Convert.ToInt32(brdto.BranchCode);
            codeno = (brcodeno + 1);
            num    = codeno.ToString("000");
            GridView1.DataBind();
        }
        catch (Exception Exp)
        {
            lblErrorMessage.Text = cls.ErrorString(Exp);
        }

        finally
        {
            Initilize_Page_Control();
        }
    }
예제 #2
0
    private void DropDownListBrnachName(Facade facade)
    {
        IBranchInfoBL        BranchList  = facade.createBranchBL();
        List <BranchInfoDTO> oBranchList = BranchList.GetBranchInfo();

        int i = 0;

        ddlBranchName.Items.Clear();
        ddlBranchName.Items.Add("(Select branch name)");
        this.ddlBranchName.Items[i].Value = "";
        foreach (BranchInfoDTO newDto in oBranchList)
        {
            i++;
            this.ddlBranchName.Items.Add(newDto.BranchName);
            this.ddlBranchName.Items[i].Value = newDto.PrimaryKey.ToString();
        }
    }