Beispiel #1
0
        private void ListBoxItems_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            switch (index)
            {
            case 0:
                LedgerModel model = (LedgerModel)ListBoxItems.SelectedItem;

                /*MainWindow window = new MainWindow();
                 * window.GridPrincipal.Children.Clear();
                 * window.GridPrincipal.Children.Add(new DisplayLedgers(model));*/
                callingForm.LedgerClicked(model);
                break;

            case 1:
                GroupModel groupModel = (GroupModel)ListBoxItems.SelectedItem;
                callingForm.GroupClicked(groupModel);
                break;

            case 2:
                CostCenterModel costCenterModel = (CostCenterModel)ListBoxItems.SelectedItem;
                callingForm.CostCenterClicked(costCenterModel);
                break;

            case 3:
                CostCategoryModel categoryModel = (CostCategoryModel)ListBoxItems.SelectedItem;
                callingForm.CategoryClicked(categoryModel);
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        public int AddCostCenter(CostCenterModel costCenterModel)
        {
            CostCenterEntity costCenterEntity = Mapper.Map <CostCenterModel, CostCenterEntity>(costCenterModel);

            costCenterEntity.IsHidden = "F";
            costCenterEntity          = _costCenterDal.Insert(costCenterEntity);
            return(costCenterEntity.Cid);
        }
Beispiel #3
0
        /// <summary>
        /// Insert into DB a department object
        /// </summary>
        /// <param name="costCenter"></param>
        /// <returns></returns>
        public Task <int> InsertCostCenter(CostCenterModel costCenter)
        {
            string procName = "Company.CostCenterInsert";

            var res = _db.SaveDataAsync <CostCenterModel, int>(procName, costCenter);

            return(res);
        }
Beispiel #4
0
 public DisplayCostCenter(ICreateRequestor caller, CostCenterModel costCenterModel)
 {
     InitializeComponent();
     callingForm = caller;
     model       = costCenterModel;
     LoadListData();
     WireUpLists();
     WireUpForm();
 }
Beispiel #5
0
        private void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            if (ValidateForm())
            {
                CostCenterModel   model            = new CostCenterModel();
                CostCenterModel   selectedModel    = (CostCenterModel)UnderComboBox.SelectedItem;
                CostCategoryModel selectedCategory = (CostCategoryModel)CategoryInputComboBox.SelectedItem;
                model.cc_name        = NameInputTextBox.Text;
                model.cc_alias       = AliasInputTetxBox.Text;
                model.under_category = selectedCategory.category_id;
                model.under_cc       = selectedModel.cost_center_id;

                GlobalConfig.Connection.CreateCostCenter(model);
                if (MessageBox.Show("Cost Center Created", "", MessageBoxButton.OK) == MessageBoxResult.OK)
                {
                    callingForm.Home(2);
                }
            }
            else
            {
                MessageBox.Show("Please Fill in the Details Properly!");
            }
        }
 public void CostCenterClicked(CostCenterModel model)
 {
     GridPrincipal.Children.Clear();
     GridPrincipal.Children.Add(new DisplayCostCenter(this, model));
 }
Beispiel #7
0
        /// <summary>
        /// Update specific department from db
        /// </summary>
        /// <param name="costCenter">Model to update</param>
        /// <returns></returns>
        public Task UpdateCostCenter(CostCenterModel costCenter)
        {
            string procName = "Company.CostCenterUpdate";

            return(_db.UpdateDataAsync(procName, costCenter));
        }
Beispiel #8
0
        /// <summary>
        /// Get all the costcenters from db based on costcenter object params
        /// </summary>
        /// <param name="costCenter">Model to search for. Params must be initialized with '%' for search</param>
        /// <returns></returns>
        public Task <List <CostCenterModel> > GetCostCenterList(CostCenterModel costCenter)
        {
            string procName = "Company.CostCenterSelect";

            return(_db.GetDataAsync <CostCenterModel, dynamic>(procName, costCenter));
        }