private void companySaveButton_Click(object sender, EventArgs e)
 {
     // Regex Name = new Regex(@"^[a-zA-Z]+(([',. -][a-zA-Z ])?[a-zA-Z]*)*$");
     if (!Ch.IsMatch(companyTextBox.Text.Trim()))
     {
         cMessageBox.Information("Something went wrong");
     }
     else
     {
         CompanyModel companyModel = new CompanyModel();
         companyModel.Name = companyTextBox.Text.Trim();
         SetupGateway companyGateway = new SetupGateway();
         bool         isExist        = companyGateway.IsExistCompany(companyModel);
         if (isExist)
         {
             cMessageBox.Warning("Company Name Already Exist");
         }
         else
         {
             int rowAffect = companyGateway.SaveCompany(companyModel);
             if (rowAffect > 0)
             {
                 cMessageBox.Success("Company Successfully Saved");
                 CompanySetup_Load(sender, e);
             }
             else
             {
                 cMessageBox.Failed("Failed to Save, Please Try Again");
                 CompanySetup_Load(sender, e);
             }
         }
     } // Expression check else function end here......
 }
 // Items Section Code
 private void itemSaveButton_Click(object sender, EventArgs e)
 {
     if (!CN.IsMatch(itemNameTextBox.Text.Trim()) || !Nu.IsMatch(itemPriceTextBox.Text.Trim()) ||
         catagoryListBox.SelectedValue == null || companyListBox.SelectedValue == null)
     {
         cMessageBox.Warning("Please Make Sure That Your All Input is Correct");
     }
     else
     {
         ItemsModel itemsModel = new ItemsModel();
         itemsModel.CatagoryID = Convert.ToInt32(catagoryListBox.SelectedValue);
         itemsModel.CompanyID  = Convert.ToInt32(companyListBox.SelectedValue);
         itemsModel.Name       = itemNameTextBox.Text.Trim();
         itemsModel.Price      = Convert.ToInt32(itemPriceTextBox.Text.Trim());
         SetupGateway itemGateway = new SetupGateway();
         bool         isItemExist = itemGateway.IsItemExists(itemsModel);
         if (isItemExist == true)
         {
             cMessageBox.Information("Item Already Exist");
         }
         else
         {
             int rowAffect = itemGateway.SaveItem(itemsModel);
             if (rowAffect > 0)
             {
                 cMessageBox.Success("Item Successfully Saved");
                 ItemSetup_Load(sender, e);
             }
             else
             {
                 cMessageBox.Failed("Faild to Save, Please Try Again");
             }
         }
     }
 }
        public void ListofCompany()
        {
            // Companay Section Code
            SetupGateway        setupGateway = new SetupGateway();
            List <CompanyModel> companyList  = setupGateway.GetAllCompany();

            if (companyList != null)
            {
                companyGridview.Rows.Clear();
                totalCompanyLabel.Text           = "Total : " + companyList.Count + " Companies Found";
                companyGridview.ColumnCount      = 3;
                companyGridview.Columns[0].Name  = "SL";
                companyGridview.Columns[0].Width = 60;
                companyGridview.Columns[1].Name  = "ID";
                companyGridview.Columns[1].Width = 60;
                companyGridview.Columns[2].Name  = "Company Name";
                companyGridview.Columns[2].Width = 200;
                //   companyGridview.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                int rn = 0;
                foreach (CompanyModel company in companyList)
                {
                    int inc = companyList.Count;
                    if (inc > rn)
                    {
                        rn++;
                    }
                    companyGridview.Rows.Add(rn, company.Id, company.Name);
                }
            }
        }
 private void CompanyUpdateButton_Click(object sender, EventArgs e)
 {
     if (companyIdHidden.Text.Trim() != String.Empty && Ch.IsMatch(companyTextBox.Text.Trim()))
     {
         SetupGateway setupGateway = new SetupGateway();
         CompanyModel companyModel = new CompanyModel();
         companyModel.Name = companyTextBox.Text.Trim();
         companyModel.Id   = Convert.ToInt32(companyIdHidden.Text.Trim());
         bool isExist = setupGateway.IsExistCompany(companyModel);
         if (isExist)
         {
             cMessageBox.Warning("Company Name Already Exist");
         }
         else
         {
             int rowAffect = setupGateway.UpdateCompany(companyModel);
             if (rowAffect > 0)
             {
                 cMessageBox.Success("Company Name Updated Successfully");
                 CompanySetup_Load(sender, e);
             }
             else
             {
                 cMessageBox.Failed("Failed to Update");
                 CompanySetup_Load(sender, e);
             }
         }
     }
 }
Пример #5
0
 private void catagorySaveButton_Click(object sender, EventArgs e)
 {
     if (!Ch.IsMatch(catagoryTextBox.Text.Trim()))
     {
         cMessageBox.Warning("Invaild Input Detected");
     }
     else
     {
         CatagoryModel catagoryModel = new CatagoryModel();
         catagoryModel.Name = catagoryTextBox.Text.Trim();
         SetupGateway catagoryGateway = new SetupGateway();
         bool         isExist         = catagoryGateway.IsExists(catagoryModel);
         if (isExist == true)
         {
             cMessageBox.Information("Category Already Exist");
         }
         else
         {
             int rowAffect = catagoryGateway.SaveCatagory(catagoryModel);
             if (rowAffect > 0)
             {
                 cMessageBox.Success("Category Successfully Saved");
                 CatagorySetup_Load(sender, e);
             }
             else
             {
                 cMessageBox.Failed("Failed To Save Category, Try Again");
                 CatagorySetup_Load(sender, e);
             }
         }
     }
 }
Пример #6
0
        public void CatagoriesList()
        {
            catagoryGridview.Rows.Clear();

            SetupGateway         setupGateway = new SetupGateway();
            List <CatagoryModel> catagorylist = setupGateway.GetAllCatagory();

            if (catagorylist != null)
            {
                totalCatagoryLabel.Text           = "TotaL : " + catagorylist.Count + " Categories Found";
                catagoryGridview.ColumnCount      = 3;
                catagoryGridview.Columns[0].Name  = "SL";
                catagoryGridview.Columns[0].Width = 60;
                catagoryGridview.Columns[1].Name  = "ID";
                catagoryGridview.Columns[1].Width = 60;
                catagoryGridview.Columns[2].Name  = "Category Name";
                catagoryGridview.Columns[2].Width = 200;
                //  catagoryGridview.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                int rn = 0;
                foreach (CatagoryModel catagory in catagorylist)
                {
                    int inc = catagorylist.Count;
                    if (inc > rn)
                    {
                        rn++;
                    }
                    catagoryGridview.Rows.Add(rn, catagory.Id, catagory.Name);
                }
            }
        }
Пример #7
0
        private void CatagoryUpdateButton_Click(object sender, EventArgs e)
        {
            SetupGateway setupGateway = new SetupGateway();

            if (idhiddenLabel.Text.Trim() != String.Empty && Ch.IsMatch(catagoryTextBox.Text.Trim()))
            {
                CatagoryModel catagory = new CatagoryModel();
                catagory.Name = catagoryTextBox.Text.Trim();
                catagory.Id   = Convert.ToInt32(idhiddenLabel.Text);
                bool isExist = setupGateway.IsExists(catagory);
                if (isExist == true)
                {
                    cMessageBox.Information("Category Already Exist");
                }
                else
                {
                    int rowAffect = setupGateway.UpdateCatagory(catagory);
                    if (rowAffect > 0)
                    {
                        cMessageBox.Success("Category Updated");
                        CatagorySetup_Load(sender, e);
                    }
                    else
                    {
                        cMessageBox.Failed("Faild to Updated Category");
                        CatagorySetup_Load(sender, e);
                    }
                }
            }
        }
Пример #8
0
        private void History_Load(object sender, EventArgs e)
        {
            // Hide Something
            startClander.Visible   = false;
            endClander.Visible     = false;
            exportButton.Visible   = false;
            ItemListBox.DataSource = null;
            startDate.Text         = "";
            endDate.Text           = "";
            historyGridView.Rows.Clear();



            // Load Data To catagory and CompanyList
            SetupGateway         setupGateway = new SetupGateway();
            List <CatagoryModel> catagorylist = setupGateway.GetAllCatagory();
            List <CompanyModel>  companyList  = setupGateway.GetAllCompany();

            if (catagorylist != null)
            {
                var catagoryList = catagorylist.Select(x => new
                {
                    Value = x.Id,
                    Text  = x.Name
                }).ToList();
                catagoryListBox.ValueMember   = "Value";
                catagoryListBox.DisplayMember = "Text";
                catagoryListBox.DataSource    = catagoryList;
                catagoryListBox.SelectedValue = 0;
                catagoryListBox.SelectedText  = "--Select Category--";
            }
            else
            {
                catagoryListBox.SelectedValue = 0;
                catagoryListBox.SelectedText  = "--No Categories Found--";
            }
            if (companyList != null)
            {
                var companylist = companyList.Select(x => new
                {
                    Value = x.Id,
                    Text  = x.Name
                }).ToList();
                companyListBox.ValueMember   = "Value";
                companyListBox.DisplayMember = "Text";
                companyListBox.DataSource    = companylist;
                companyListBox.SelectedValue = 0;
                companyListBox.SelectedText  = "--Select Company--";
            }
            else
            {
                companyListBox.SelectedValue = 0;
                companyListBox.SelectedText  = "--No Companies Found--";
            }
        }
        private void ItemSetup_Load(object sender, EventArgs e)
        {
            itemsGridView.Rows.Clear();
            itemNameTextBox.Text  = "";
            itemPriceTextBox.Text = "";
            itemsIdHidden.Text    = "";
            // Load Data To catagory and CompanyList
            SetupGateway         setupGateway = new SetupGateway();
            List <CatagoryModel> catagorylist = setupGateway.GetAllCatagory();
            List <CompanyModel>  companyList  = setupGateway.GetAllCompany();

            if (catagorylist.Count > 0)
            {
                var catagoryList = catagorylist.Select(x => new
                {
                    Value = x.Id,
                    Text  = x.Name
                }).ToList();
                catagoryListBox.ValueMember   = "Value";
                catagoryListBox.DisplayMember = "Text";
                catagoryListBox.DataSource    = catagoryList;
                catagoryListBox.SelectedValue = 0;
                catagoryListBox.SelectedText  = "--Select Category--";
            }
            else
            {
                catagoryListBox.SelectedValue = 0;
                catagoryListBox.Text          = "";
                catagoryListBox.SelectedText  = "--No Category--";
            }
            if (companyList.Count > 0)
            {
                var companylist = companyList.Select(x => new
                {
                    Value = x.Id,
                    Text  = x.Name
                }).ToList();
                companyListBox.ValueMember   = "Value";
                companyListBox.DisplayMember = "Text";
                companyListBox.DataSource    = companylist;
                companyListBox.SelectedValue = 0;
                companyListBox.SelectedText  = "--Select Company--";
            }
            else
            {
                companyListBox.SelectedValue = 0;
                companyListBox.Text          = "";
                companyListBox.SelectedText  = "--No Company--";
            }
        }
Пример #10
0
        public void LoadCatagoryAndCompany()
        {
            // Load Data To catagory and CompanyList
            SetupGateway setupGateway = new SetupGateway();
            List<CatagoryModel> catagorylist = setupGateway.GetAllCatagory();
            List<CompanyModel> companyList = setupGateway.GetAllCompany();

            if (catagorylist.Count > 0)
            {
                var catagoryList = catagorylist.Select(x => new
                {
                    Value = x.Id,
                    Text = x.Name
                }).ToList();
                catagoryListBox.ValueMember = "Value";
                catagoryListBox.DisplayMember = "Text";
                catagoryListBox.DataSource = catagoryList;
                catagoryListBox.SelectedValue = 0;
                catagoryListBox.SelectedText = "--Select Category--";
            }
            else
            {
                catagoryListBox.SelectedValue = 0;
                catagoryListBox.Text = "";
                catagoryListBox.SelectedText = "--No Category--";
            }
            if (companyList.Count > 0)
            {
                var companylist = companyList.Select(x => new
                {
                    Value = x.Id,
                    Text = x.Name
                }).ToList();
                companyListBox.ValueMember = "Value";
                companyListBox.DisplayMember = "Text";
                companyListBox.DataSource = companylist;
                companyListBox.SelectedValue = 0;
                companyListBox.SelectedText = "--Select Company--";
            }
            else
            {
                companyListBox.SelectedValue = 0;
                companyListBox.Text = "";
                companyListBox.SelectedText = "--No Company--";
            }
        }
 private void companyDeleteButton_Click(object sender, EventArgs e)
 {
     if (companyIdHidden.Text.Trim() != String.Empty && Ch.IsMatch(companyTextBox.Text.Trim()))
     {
         if (MessageBox.Show("Are sure to delete this?", "Confirm?", MessageBoxButtons.YesNo,
                             MessageBoxIcon.Question) == DialogResult.Yes)
         {
             SetupGateway setupGateway = new SetupGateway();
             string       Id           = companyIdHidden.Text.Trim();
             int          rowAffect    = setupGateway.DeleteCompany(Id);
             if (rowAffect > 0)
             {
                 cMessageBox.Success("Company Deleted");
                 CompanySetup_Load(sender, e);
             }
             else
             {
                 cMessageBox.Failed("Failed to Delete");
             }
         }
     }
 }
Пример #12
0
        private void catagoryDeleteButton_Click(object sender, EventArgs e)
        {
            SetupGateway setupGateway = new SetupGateway();

            if (idhiddenLabel.Text.Trim() != String.Empty && catagoryTextBox.Text.Trim() != String.Empty)
            {
                if (cMessageBox.Quiestion("Are you sure to delete this?"))
                {
                    string id        = idhiddenLabel.Text.Trim();
                    int    rowAffect = setupGateway.DeleteCatagory(id);
                    if (rowAffect > 0)
                    {
                        cMessageBox.Success("Category Deleted");
                        CatagorySetup_Load(sender, e);
                    }
                    else
                    {
                        cMessageBox.Failed("Failed To Delete Category");
                        CatagorySetup_Load(sender, e);
                    }
                }
            }
        }
Пример #13
0
        private void StockOut_Load(object sender, EventArgs e)
        {
            listofStockOut.Clear();
            stockOutCard.Rows.Clear();

            // Text Box
            catagoryListBox.Enabled        = true;
            companyListBox.Enabled         = true;
            ItemListBox.DataSource         = null;
            ItemListBox.Enabled            = true;
            discountPercentTextBox.Enabled = true;
            discountPriceTexBox.Enabled    = true;
            vatPercentTextBox.Enabled      = true;
            outQuantityTextBox.Enabled     = true;
            stockOutCard.Enabled           = true;
            modelBox.Enabled             = true;
            modelBox.Text                = "N/A";
            priceTextBox.Text            = "";
            outTotalPriceTextBox.Text    = "";
            availAbleQuatityTextBox.Text = "";
            outQuantityTextBox.Text      = "";
            discountPercentTextBox.Text  = "";
            discountPriceTexBox.Text     = "";
            vatPercentTextBox.Text       = "";
            vatPriceTextBox.Text         = "";
            netBillTexBox.Text           = "";
            cardTitle.Text               = "";


            // Customer name and label fileds
            mnumberBox.Visible      = false;
            customerNameBox.Visible = false;
            addressTextBox.Visible  = false;
            nameLabel.Visible       = false;
            addLabel.Visible        = false;
            numberLabel.Visible     = false;
            // Button for actioins
            saleButton.Enabled    = true;
            saleButton.Visible    = false;
            lostButton.Visible    = false;
            damageButton.Visible  = false;
            okButton.Visible      = false;
            cancelButton.Visible  = false;
            addCardButton.Enabled = true;



            // Load Data To catagory and CompanyList
            SetupGateway         setupGateway = new SetupGateway();
            List <CatagoryModel> catagorylist = setupGateway.GetAllCatagory();
            List <CompanyModel>  companyList  = setupGateway.GetAllCompany();

            if (catagorylist.Count > 0)
            {
                var catagoryList = catagorylist.Select(x => new
                {
                    Value = x.Id,
                    Text  = x.Name
                }).ToList();
                catagoryListBox.ValueMember   = "Value";
                catagoryListBox.DisplayMember = "Text";
                catagoryListBox.DataSource    = catagoryList;
                catagoryListBox.SelectedValue = 0;
                catagoryListBox.SelectedText  = "--Select Category--";
            }
            else
            {
                catagoryListBox.SelectedValue = 0;
                catagoryListBox.Text          = "";
                catagoryListBox.SelectedText  = "--No Category Found--";
            }
            if (companyList.Count > 0)
            {
                var companylist = companyList.Select(x => new
                {
                    Value = x.Id,
                    Text  = x.Name
                }).ToList();
                companyListBox.ValueMember   = "Value";
                companyListBox.DisplayMember = "Text";
                companyListBox.DataSource    = companylist;
                companyListBox.SelectedValue = 0;
                companyListBox.SelectedText  = "--Select Company--";
            }
            else
            {
                companyListBox.SelectedValue = 0;
                companyListBox.Text          = "";
                companyListBox.SelectedText  = "--No Company Found--";
            }
        }