protected void btnYes_Click(object sender, EventArgs e)
 {
     long branchDeptCodeToDeleteId = long.Parse(gvBrandDepartmentCode.SelectedValue.ToString());
     BranchDepartmentCode branchDeptCodeToDelete = new BranchDepartmentCode
     {
          RecordNumber = branchDeptCodeToDeleteId
     };
     BranchDeptCodeManager.Delete(branchDeptCodeToDelete);
     gvBrandDepartmentCode.DataBind();
     initializeBranches();
 }
 protected void btnSaveBranchDepartmentCode_Click(object sender, EventArgs e)
 {
     BranchDepartmentCode newBranchDeptCode = new BranchDepartmentCode
     {
          BranchName= DDLBranches.SelectedValue,
           DepartmentCode = txtBranchDepartmentCode.Text
     };
     BranchDeptCodeManager.Save(newBranchDeptCode);
     gvBrandDepartmentCode.DataBind();
     initializeBranches();
 }
 protected void btnSaveUpdate_Click(object sender, EventArgs e)
 {
     long branchDeptCodeToDeleteId = long.Parse(gvBrandDepartmentCode.SelectedValue.ToString());
     BranchDepartmentCode branchDeptCodeToUpdate = new BranchDepartmentCode
     {
         BranchName = DDLBranchesUpdate.SelectedValue,
         DepartmentCode = txtBranchDeptCodeToUpdate.Text,
         RecordNumber = branchDeptCodeToDeleteId
     };
     BranchDeptCodeManager.Save(branchDeptCodeToUpdate);
     gvBrandDepartmentCode.DataBind();
     initializeBranches();
 }
 protected void btnCreate_Click(object sender, EventArgs e)
 {
     BranchDepartmentCode branchDepartmentCode = new BranchDepartmentCode
     {
          BranchName = txtBranchName.Text ,
           DepartmentCode = txtBranchDepartmentCode.Text
     };
     BranchDeptCodeManager.Save(branchDepartmentCode);
     txtBranchDepartmentCodePreview.Text = branchDepartmentCode.DepartmentCode;
     txtSeriesNumber.Text = generateSeriesNumber(branchDepartmentCode.DepartmentCode, int.Parse(hfLastPullOutLetterNumber.Value))[0];
     pnlBranchDepartmentCodeCommand.Visible = false;
 }