Ejemplo n.º 1
0
 private void DeleteProductRawMaterial()
 {
     if (gridProductRawMaterials.SelectedRows.Count > 0)
     {
         productRawMaterialID = int.Parse(gridProductRawMaterials.SelectedRows[0].Cells[0].Value.ToString());
         if (productRawMaterialID != 0)
         {
             DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (result == DialogResult.Yes)
             {
                 Factories.CreateProduct().DeleteProductRawMaterial(productRawMaterialID);
                 LocalUtils.ShowDeleteSuccessMessage(this);
                 LoadProductRawMaterialGridList();
                 productRawMaterialID = 0;
             }
         }
         else
         {
             LocalUtils.ShowNoRecordFoundMessage(this);
         }
     }
     else
     {
         LocalUtils.ShowNoRecordSelectedMessage(this);
     }
 }
Ejemplo n.º 2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (gridList.SelectedRows.Count > 0)
         {
             id = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString());
             if (id != 0)
             {
                 DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                 if (result == DialogResult.Yes)
                 {
                     Factories.CreateSupplyInventory().Delete(id);
                     LocalUtils.ShowDeleteSuccessMessage(this);
                     ShowMainGrid();
                     id = 0;
                 }
             }
             else
             {
                 LocalUtils.ShowNoRecordFoundMessage(this);
             }
         }
         else
         {
             LocalUtils.ShowNoRecordSelectedMessage(this);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 3
0
        private void SetProductRawMaterialData()
        {
            if (gridProductRawMaterials.SelectedRows.Count > 0)
            {
                // get id
                productRawMaterialID = int.Parse(gridProductRawMaterials.SelectedRows[0].Cells[0].Value.ToString());
                if (productRawMaterialID != 0)
                {
                    //show and hide controls
                    page.SetPage(pageUpdateProductRawMaterials);
                    lblAddEditTitle.Text = "Edit Record";
                    bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);

                    // populate data
                    var obj = Factories.CreateProduct().GetProductRawMaterial(productRawMaterialID);
                    cboSupplyClass.SelectedItem = LocalUtils.GetSelectedItemX(cboSupplyClass.Items, obj.SupplyClassID.ToString());
                    cboSupplyTypes.SelectedItem = LocalUtils.GetSelectedItemX(cboSupplyTypes.Items, obj.SupplyTypeID.ToString());
                    txtQuantity.Text            = obj.Quantity.ToString();
                }
                else
                {
                    LocalUtils.ShowNoRecordFoundMessage(this);
                }
            }
            else
            {
                LocalUtils.ShowNoRecordSelectedMessage(this);
            }
        }
Ejemplo n.º 4
0
        public void Edit()
        {
            try
            {
                if (gridList.SelectedRows.Count > 0)
                {
                    // get id
                    id = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString());
                    if (id != 0)
                    {
                        //show and hide controls

                        lblAddEditTitle.Text = "Edit Record";
                        SetData();
                        mainPage.SetPage(pageDetail);
                        bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);
                    }
                    else
                    {
                        supplyClassID = int.Parse(gridList.SelectedRows[0].Cells[1].Value.ToString());
                        supplyTypeID  = int.Parse(gridList.SelectedRows[0].Cells[2].Value.ToString());
                        Save();
                        SetData();
                    }
                }
                else
                {
                    LocalUtils.ShowNoRecordSelectedMessage(this);
                }
            }
            catch (Exception ex)
            {
                LocalUtils.ShowErrorMessage(this, ex.Message);
            }
        }
Ejemplo n.º 5
0
        private void Edit()
        {
            try
            {
                var grid = gridProducts;

                if (grid.SelectedRows.Count > 0)
                {
                    _productID = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString());
                    if (_productID != 0)
                    {
                        page.SetPage(pageProductDetail);
                        SetData();
                    }
                }
                else
                {
                    LocalUtils.ShowNoRecordSelectedMessage(this);
                }
            }
            catch (Exception ex)
            {
                LocalUtils.ShowErrorMessage(this, ex.ToString());
            }
        }
Ejemplo n.º 6
0
        private void Edit()
        {
            try
            {
                var grid = gridChat;

                if (grid.SelectedRows.Count > 0)
                {
                    _userID = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString());
                    if (_userID != 0)
                    {
                        var user = Factories.CreateUser().GetUser(_userID);
                        if (user.UserName == CurrentUser.Name)
                        {
                            LocalUtils.ShowErrorMessage(this, "You cannot message your self!");
                        }
                        else
                        {
                            CheckUnreadMessage();
                            var frmChatMessage = new frmChatMessage(user.UserName);
                            frmChatMessage.Show();
                        }
                    }
                }
                else
                {
                    LocalUtils.ShowNoRecordSelectedMessage(this);
                }
            }
            catch (Exception ex)
            {
                LocalUtils.ShowErrorMessage(this, ex.ToString());
            }
        }
Ejemplo n.º 7
0
 private void Delete()
 {
     try
     {
         if (gridList.SelectedRows.Count > 0)
         {
             userID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString());
             if (userID != 0)
             {
                 DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Milk Collection", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                 if (result == DialogResult.Yes)
                 {
                     Factories.CreateUser().Delete(userID);
                     LocalUtils.ShowDeleteSuccessMessage(this);
                     ShowMainGrid();
                     userID = 0;
                 }
             }
             else
             {
                 LocalUtils.ShowNoRecordFoundMessage(this);
             }
         }
         else
         {
             LocalUtils.ShowNoRecordSelectedMessage(this);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 8
0
        private void Delete()
        {
            try
            {
                var grid = gridProducts;

                if (grid.SelectedRows.Count > 0)
                {
                    var posTransactionProductID = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString());
                    if (posTransactionProductID != 0)
                    {
                        DialogResult result = MetroMessageBox.Show(this, "Are you sure you want to delete this record?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (result == DialogResult.Yes)
                        {
                            Factories.CreateProducts().Delete(posTransactionProductID);
                            LoadProducts();
                        }
                    }
                    else
                    {
                        LocalUtils.ShowNoRecordFoundMessage(this);
                    }
                }
                else
                {
                    LocalUtils.ShowNoRecordSelectedMessage(this);
                }
            }
            catch (Exception ex)
            {
                //LocalUtils.ShowErrorMessage(this, ex.ToString());
            }
        }
Ejemplo n.º 9
0
 private void Edit()
 {
     try
     {
         if (gridList.SelectedRows.Count > 0)
         {
             // get id
             userID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString());
             if (userID != 0)
             {
                 //show and hide controls
                 mainPage.SetPage(pageDetail);
                 bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);
                 ResetInputs(pnlAddEdit);
                 SetData();
             }
             else
             {
                 LocalUtils.ShowNoRecordFoundMessage(this);
                 mainPage.SetPage(pageGridMain);
                 bunifuTransition1.ShowSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);
             }
         }
         else
         {
             LocalUtils.ShowNoRecordSelectedMessage(this);
         }
     }
     catch (Exception ex)
     {
         LocalUtils.ShowErrorMessage(this, ex.ToString());
     }
 }
Ejemplo n.º 10
0
        private void gridProducts_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                var grid = gridProductLogs;

                if (grid.SelectedRows.Count > 0)
                {
                    var id = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString());
                    if (id != 0)
                    {
                        //var model = Factories.CreateProducts().Get(_productID);
                    }
                    else
                    {
                        LocalUtils.ShowNoRecordFoundMessage(this);
                    }
                }
                else
                {
                    LocalUtils.ShowNoRecordSelectedMessage(this);
                }
            }
            catch (Exception ex)
            {
                //LocalUtils.ShowErrorMessage(this, ex.ToString());
            }
        }
Ejemplo n.º 11
0
        private void ViewDetail()
        {
            try
            {
                var grid = gridList;

                if (grid.SelectedRows.Count > 0)
                {
                    posTransactionID = int.Parse(grid.SelectedRows[0].Cells[0].Value.ToString());
                    if (posTransactionID != 0)
                    {
                        page.SetPage(pageTransactionDetails);
                        SetData();
                        LoadPosTransactionProducts();
                    }
                }
                else
                {
                    LocalUtils.ShowNoRecordSelectedMessage(this);
                }
            }
            catch (Exception ex)
            {
                LocalUtils.ShowErrorMessage(this, ex.ToString());
            }
        }
Ejemplo n.º 12
0
        private void SetProductData()
        {
            try
            {
                if (gridList.SelectedRows.Count > 0)
                {
                    // get id
                    productID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString());
                    if (productID != 0)
                    {
                        //show and hide controls
                        page.SetPage(pageUpdateProduct);
                        lblAddEditTitle.Text = "Edit Record";
                        bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);

                        // populate data
                        var model = Factories.CreateProduct().Get(productID);
                        productID           = model.ID;
                        txtProductName.Text = model.Name;
                        txtUnitPrice.Text   = model.UnitPrice.ToString();
                        chkProduce.Checked  = model.IsProduce;
                        LoadProductRawMaterialGridList();
                        page.SetPage(pageUpdateProduct);
                        lblAddEditTitle.Text = "Edit Record";
                        bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);
                    }
                    else
                    {
                        LocalUtils.ShowNoRecordFoundMessage(this);
                        page.SetPage(pageUpdateProduct);
                        bunifuTransition1.ShowSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);
                    }
                }
                else
                {
                    LocalUtils.ShowNoRecordSelectedMessage(this);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 13
0
        private void SetProductionData()
        {
            try
            {
                if (gridProductionList.SelectedRows.Count > 0)
                {
                    // get id
                    productionID = int.Parse(gridProductionList.SelectedRows[0].Cells[0].Value.ToString());
                    if (productionID != 0)
                    {
                        //show and hide controls
                        page.SetPage(pageUpdateProduction);
                        lblAddEditTitle.Text = "Edit Record";
                        bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);

                        // populate data
                        var obj = Factories.CreateProduction().Get(productionID);
                        dtDate.Value             = obj.Date;
                        cboProducts.SelectedItem = LocalUtils.GetSelectedItemX(cboProducts.Items, obj.ProductID.ToString());
                        txtQuantity.Text         = obj.Quantity.ToString();

                        page.SetPage(pageUpdateProduction);
                        lblAddEditTitle.Text = "Edit Record";
                        bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);
                    }
                    else
                    {
                        LocalUtils.ShowNoRecordFoundMessage(this);
                        page.SetPage(pageUpdateProduction);
                        bunifuTransition1.ShowSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);
                    }
                }
                else
                {
                    LocalUtils.ShowNoRecordSelectedMessage(this);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 14
0
        private void SetMainData()
        {
            try
            {
                if (gridList.SelectedRows.Count > 0)
                {
                    // get id
                    expenseID = int.Parse(gridList.SelectedRows[0].Cells[0].Value.ToString());
                    if (expenseID != 0)
                    {
                        //show and hide controls
                        mainPage.SetPage(tabMainData);
                        lblAddEditTitle.Text = "Edit Record";
                        bunifuTransition1.HideSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);

                        var obj = mainLogic.GetBy(expenseID);
                        dtDate.Value                = obj.Date;
                        txtParticulars.Text         = obj.Particular;
                        txtTotal.Text               = obj.Total.ToString();
                        txtUnitPrice.Text           = obj.UnitPrice.ToString();
                        txtQuantity.Text            = obj.Quantity.ToString();
                        cboExpenseType.SelectedItem = LocalUtils.GetSelectedItemX(cboExpenseType.Items, obj.ExpenseTypeID.ToString());
                    }
                    else
                    {
                        LocalUtils.ShowNoRecordFoundMessage(this);
                        mainPage.SetPage(tabGridList);
                        bunifuTransition1.ShowSync(pnlSide, false, BunifuAnimatorNS.Animation.Transparent);
                    }
                }
                else
                {
                    LocalUtils.ShowNoRecordSelectedMessage(this);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }