Example #1
0
        public async Task DeleteBranch(BranchCreateModel data)
        {
            try
            {
                switch (data.companyType)
                {
                case "MSP":
                    await Task.Run(() => ManageMSP.DeleteMSPLocationBranch(data.id, "Branch"));

                    break;

                case "Customer":
                    await Task.Run(() => ManageCustomer.DeleteCustomerLocationBranch(data.id, "Branch"));

                    break;

                case "Supplier":
                    await Task.Run(() => ManageSupplier.DeleteSupplierBranchLocation(data.id, "Branch"));

                    break;
                }

                await Task.Run(() => ManageBranch.DeleteBranch(data.id));
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        public async Task <BranchCreateModel> CreateBranch(BranchCreateModel data)
        {
            try
            {
                BranchCreateModel model      = null;
                tblBranch         dataBranch = await Task.Run(() => ManageBranch.InsertBranch(data.ConvertTotblBranch()));

                model         = (await Task.Run(() => ManageBranch.GetBranchDetails(dataBranch.ID))).ConvertToBranch();
                data.branchId = model.id;

                switch (data.companyType)
                {
                case "MSP":
                    tblMSPLocationBranch dataMSP = await Task.Run(() => ManageMSP.InsertMSPLocationBranch(data.ConvertTotblMSPLocationBranch()));

                    break;

                case "Customer":
                    tblCustomerLocationBranch dataCustomer = await Task.Run(() => ManageCustomer.InsertCustomerLocationBranch(data.ConvertTotblCustomerLocationBranch()));

                    break;

                case "Supplier":
                    tblSupplierLocationBranch dataSupplier = await Task.Run(() => ManageSupplier.InsertSupplierLocationBranch(data.ConvertTotblSupplierLocationBranch()));

                    break;
                }

                return(model);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #3
0
        public async Task <BranchCreateModel> UpdateBranch(BranchCreateModel model)
        {
            try
            {
                tblBranch data = await Task.Run(() => ManageBranch.UpdateBranch(model.ConvertTotblBranch()));

                return(data.ConvertToBranch());
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #4
0
        public async Task <List <BranchCreateModel> > GetBranchesByLocation(LocationBranchModel data)
        {
            try
            {
                List <BranchCreateModel> model    = null;
                List <tblBranch>         resModel = null;
                long Id = data != null?Convert.ToInt64(data.locationId) : 0;

                resModel = await Task.Run(() => ManageBranch.GetBranchsByLocation(Id));

                model = resModel.Select(a => a.ConvertToBranch()).ToList();

                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }