Ejemplo n.º 1
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (!ValidationUtility.FieldNotAllowNull(this))
     {
         return;
     }
     Model.BrankBank branch = new BrankBank();
     CoverObjectUtility.GetAutoBindingData(this, branch);
     branch.BankId = bank.BankId;
     branch.SetCreate();
     try
     {
         using (IUnitOfWork uow = new UnitOfWork())
         {
             uow.BrankBankBaseRepository.Add(branch);
             uow.Commit();
         }
         labelNotify1.SetText(UI.createsuccess, ToolBoxCS.LabelNotify.EnumStatus.Success);
         if (AddnewBranch != null)
         {
             AddnewBranch(bank, CRUD.Insert, branch);
         }
         Close();
     }
     catch
     {
         labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
Ejemplo n.º 2
0
        public bool hasBranch(Bank bank)
        {
            BrankBank br = Connection.Query <BrankBank>("select * from BrankBank where BankId = @BankId", new { @BankId = bank.BankId }, transaction: Transaction).FirstOrDefault();

            if (br == null)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        private object createObject(Model.Bank bank = null, BrankBank branch = null)
        {
            object obj = null;

            //insert for bank
            if (bank != null && branch == null)
            {
                obj = new object[]
                {
                    bank.BankId,
                    bank.BankCode,
                    bank.BankName,
                    bank.Address,
                    bank.Phone,
                    bank.Fax,
                    bank.Email,
                    bank.Note,
                    bank.CreateDate,
                    bank.CreateBy,
                    bank.ModifyDate,
                    bank.ModifyBy
                };
            }
            if (bank == null && branch != null)
            {
                obj = new object[]
                {
                    branch.BrankBankID,
                    null,//code
                    branch.BrankName,
                    branch.BrankAddress,
                    branch.Phone,
                    null, //fax
                    null, //email
                    branch.Note,
                    branch.CreateDate,
                    branch.CreateBy,
                    branch.ModifyDate,
                    branch.ModifyBy
                };
            }
            return(obj);
        }
Ejemplo n.º 4
0
        private void treeList1_DoubleClick(object sender, EventArgs e)
        {
            TreeList        tree = sender as TreeList;
            TreeListHitInfo hi   = tree.CalcHitInfo(tree.PointToClient(Control.MousePosition));

            if (hi.Node != null)
            {
                TreeListNode node = treeList1.Selection[0];
                if (node.Tag.ToString() == "Parent") //is Parent (BANK)
                {
                    frmEditBankUpdate obj1 = new frmEditBankUpdate(getBankRecord(node));
                    obj1.updateBank = InsertOrUpdate;
                    obj1.ShowDialog();
                }
                else //is Child (Branch)
                {
                    BrankBank bran = getBranchBankRecord(node);
                    frmEditBranchBankUpdate obj2 = new frmEditBranchBankUpdate(bran);
                    obj2.updateBranch = InsertOrUpdate;
                    obj2.ShowDialog();
                }
            }
        }
Ejemplo n.º 5
0
        private BrankBank getBranchBankRecord(TreeListNode node)
        {
            if (node == null)
            {
                return(null);
            }
            BrankBank branch = new BrankBank();

            UtilityFunction.ConvertTreeListNodeToObj <Model.BrankBank>(treeList1, node, branch);
            branch.BrankBankID  = Convert.ToInt32(node.GetDisplayText("BankId"));
            branch.BrankName    = node.GetDisplayText("BankName");
            branch.BrankAddress = node.GetDisplayText("Address");
            //branch.Phone = node.GetDisplayText("Phone");
            //branch.Note = node.GetDisplayText("Note");
            //if (!string.IsNullOrEmpty(node.GetDisplayText("CreateDate")))
            //    branch.CreateDate = Convert.ToDateTime(node.GetDisplayText("CreateDate"));
            //branch.CreateBy = node.GetDisplayText("CreateBy");
            //if (!string.IsNullOrEmpty(node.GetDisplayText("ModifyDate")))
            //    branch.ModifyDate = Convert.ToDateTime(node.GetDisplayText("ModifyDate"));
            //branch.ModifyBy = node.GetDisplayText("ModifyBy");
            branch.Bank = getBankRecord(node.ParentNode);
            return(branch);
        }
Ejemplo n.º 6
0
 public frmEditBranchBankUpdate(BrankBank branch)
 {
     InitializeComponent();
     this.branch = branch;
 }