コード例 #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         BusinessObjects.Company company = new BusinessObjects.Company();
         company.CompanyId         = CompanyID;
         company.CompanyName       = txtCompanyName.Text.Trim();
         company.Country           = txtCountry.Text.Trim();
         company.Address           = txtAddress.Text.Trim();
         company.City              = txtCity.Text.Trim();
         company.State             = cmbState.SelectedValue.ToString();
         company.CompanyPhone      = txtCompanyPhone.Text.Trim();
         company.Email             = txtEmail.Text.Trim();
         company.Website           = txtWebsite.Text.Trim();
         company.TIN               = txtTIN.Text.Trim();
         company.ServiceTaxNo      = txtServiceTaxNo.Text.Trim();
         company.AdditionalDetails = txtAdditionalDetails.Text.Trim();
         company.PAN               = txtPAN.Text.Trim();
         company.Currency          = String.Empty;
         company.Logo              = ImageName;
         company.Status            = true;
         companyService.UpdateCompany(company);
         CustomMessageBox.Show(string.Format(Constants.SUCCESSFULL_SAVE_MESSAGE, txtCompanyName.Text),
                               Constants.CONSTANT_INFORMATION,
                               Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                               CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
     }
     catch (Exception ex) {
         MessageBox.Show("Error : " + ex.Message);
     }
 }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Tax tax = new Tax();

            tax.TaxId         = TaxId;
            tax.TaxName       = txtTaxName.Text.Trim();
            tax.TaxPercentage = Convert.ToDecimal(txtTaxPercentage.Text);
            masterService.UpdateTax(tax);
            CustomMessageBox.Show(string.Format(Constants.SUCCESSFULL_TAX_SAVE_MESSAGE, txtTaxName.Text),
                                  Constants.CONSTANT_INFORMATION,
                                  Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                                  CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
            this.Close();
        }
コード例 #3
0
ファイル: AddTaxes.cs プロジェクト: UmeshTayade/SleekBill
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DataGridViewRow row       = dgvTaxes.Rows[rowIndex];
            int             taxId     = Convert.ToInt32(row.Cells["TaxId"].Value);
            DialogResult    dialogRes = CustomMessageBox.Show(Constants.DELETE_WARNING,
                                                              Constants.CONSTANT_INFORMATION,
                                                              Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.YesNo,
                                                              CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Information));

            if (dialogRes == System.Windows.Forms.DialogResult.Yes)
            {
                masterService.DeactivateTax(taxId);
            }

            BindTaxDetailsDataGrid();
        }
コード例 #4
0
ファイル: AddTaxes.cs プロジェクト: UmeshTayade/SleekBill
        private void btnAddTax_Click(object sender, EventArgs e)
        {
            Tax tax = new Tax();

            tax.TaxName       = txtTaxName.Text.Trim();
            tax.TaxPercentage = Math.Round(Convert.ToDecimal(txtTaxPercentage.Text), 2);
            tax.IsDefault     = false;
            tax.Status        = true;
            int taxId = masterService.AddTax(tax);

            CustomMessageBox.Show(Constants.SUCCESSFULL_TAX_ADD_MESSAGE,
                                  Constants.CONSTANT_INFORMATION,
                                  Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                                  CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
            BindTaxDetailsDataGrid();
        }
コード例 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Client client = new Client();

            client.ClientName             = txtClientName.Text.Trim();
            client.ContactName            = txtContactName.Text.Trim();
            client.Phone                  = txtPhone.Text.Trim();
            client.Email                  = txtEmail.Text.Trim();
            client.TIN                    = txtTIN.Text.Trim();
            client.BillingAddress         = txtBillingAddress.Text.Trim();
            client.City                   = txtCity.Text.Trim();
            client.Country                = txtCountry.Text.Trim();
            client.Zip                    = txtZip.Text.Trim();
            client.StateCode              = Convert.ToString(cmbState.SelectedValue);
            client.ShipToDifferentAddress = chkDifferentAddress.Checked;
            client.ShippingAddress        = txtShippingAddress.Text.Trim();
            client.ShippingCity           = txtShippingCity.Text.Trim();
            client.ShippingStateCode      = Convert.ToString(cmbShippingState.SelectedValue);
            client.ShippingZip            = txtShippingZip.Text.Trim();
            client.ShippingCountry        = txtShippingCountry.Text.Trim();
            client.PrivateClientDetails   = txtPrivateClientDetails.Text.Trim();
            client.OtherClientDetails     = txtOtherClientDetails.Text.Trim();
            client.Status                 = true;
            client.CreatedDate            = DateTime.Now.Date;

            if (clientID == 0)
            {
                int clientId = clientService.AddClient(client);
                ResetControls();
                CustomMessageBox.Show(string.Format(Constants.SUCCESSFULL_ADD_MESSAGE, Constants.CONSTANT_CLIENT, txtClientName.Text),
                                      Constants.CONSTANT_INFORMATION,
                                      Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                                      CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
            }
            else
            {
                client.ClientId = clientID;
                clientService.UpdateClient(client);
                CustomMessageBox.Show(string.Format(Constants.SUCCESSFULL_SAVE_MESSAGE, txtClientName.Text),
                                      Constants.CONSTANT_INFORMATION,
                                      Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                                      CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
            }

            this.Close();
        }
コード例 #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Product product = new Product();
                product.ProductName = txtProductName.Text.Trim();
                product.Description = txtProdDesc.Text.Trim();
                product.UnitPrice   = Convert.ToDecimal(txtUnitPrice.Text);
                product.Quantity    = Convert.ToInt32(txtQuantity.Text);
                product.TaxId       = Convert.ToInt32(cmbTaxRate.SelectedValue);
                product.Status      = true;

                if (productID == 0)
                {
                    int productId = productService.AddProduct(product);
                    ResetControls();
                    CustomMessageBox.Show(string.Format(Constants.SUCCESSFULL_ADD_MESSAGE, Constants.CONSTANT_PRODUCT, txtProductName.Text),
                                          Constants.CONSTANT_INFORMATION,
                                          Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                                          CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
                }
                else
                {
                    product.ProductId = productID;
                    productService.UpdateProduct(product);
                    CustomMessageBox.Show(string.Format(Constants.SUCCESSFULL_SAVE_MESSAGE, txtProductName.Text),
                                          Constants.CONSTANT_INFORMATION,
                                          Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                                          CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
                }
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error :" + ex.Message);
            }
        }
コード例 #7
0
        private void btnSaveInvoice_Click(object sender, EventArgs e)
        {
            try
            {
                int invoiceId      = string.IsNullOrEmpty(txtInvoiceNumber.Text) ? 0 : Convert.ToInt32(txtInvoiceNumber.Text);
                var invoiceDetails = invoiceService.GetInvoice(invoiceId);
                var comapnyDetails = (from company in companyService.GetAllCompany()
                                      .Where(v => v.Status == true)
                                      select company).SingleOrDefault();

                Invoice invoice = new Invoice();
                invoice.InvoiceId       = invoiceId;
                invoice.CompanyId       = comapnyDetails.CompanyId;
                invoice.ClientId        = ClientId;
                invoice.IssueDate       = dtpIssueDate.Value.Date;
                invoice.PurchaseOrderNo = string.IsNullOrEmpty(txtPONumber.Text) ? String.Empty : txtPONumber.Text;
                invoice.PaymentTermId   = Convert.ToInt32(cmbPaymentTerms.SelectedValue);
                invoice.DueDate         = dtpDueDate.Value.Date;
                invoice.Discount        = string.IsNullOrEmpty(txtDiscount.Text) ? decimal.Zero : Convert.ToDecimal(txtDiscount.Text);
                invoice.RoundOffTotal   = chkRoundOff.Checked;
                invoice.MarkInvoicePaid = chkMarkInvoicePaid.Checked;

                if (chkMarkInvoicePaid.Checked)
                {
                    invoice.PaymentTypeId = Convert.ToInt32(cmbPaymentType.SelectedValue);
                    invoice.AmountPaid    = string.IsNullOrEmpty(txtAmountPaid.Text) ? decimal.Zero : Convert.ToDecimal(txtAmountPaid.Text);

                    if (invoiceDetails == null || invoiceDetails.InvoiceId == 0)
                    {
                        invoice.PaymentDate = DateTime.Now.Date;
                    }
                    else
                    {
                        if (invoiceDetails.AmountPaid > 0)
                        {
                            if (invoiceDetails.AmountPaid == invoice.AmountPaid)
                            {
                                invoice.PaymentDate = invoiceDetails.PaymentDate;
                            }
                            else
                            {
                                invoice.PaymentDate = DateTime.Now.Date;
                            }
                        }
                    }
                    string paymentStatus = String.Empty;

                    if (invoice.AmountPaid == 0)
                    {
                        paymentStatus = ePaymentStatus.Unpaid.ToString();
                    }
                    else if (invoice.AmountPaid > 0)
                    {
                        if (invoice.AmountPaid < TotalValue)
                        {
                            paymentStatus = ePaymentStatus.Partial.ToString();
                        }
                        else if (invoice.AmountPaid == TotalValue)
                        {
                            paymentStatus = ePaymentStatus.Paid.ToString();
                        }
                        else
                        {
                            paymentStatus = ePaymentStatus.Paid.ToString();
                        }
                    }

                    if (invoice.PaymentDate.Date > invoice.DueDate.Date)
                    {
                        if (String.IsNullOrEmpty(paymentStatus))
                        {
                            paymentStatus = String.Concat(paymentStatus, ",", ePaymentStatus.Overdue.ToString());
                        }
                        else
                        {
                            paymentStatus = ePaymentStatus.Overdue.ToString();
                        }
                    }

                    invoice.PaymentStatus = paymentStatus;
                }
                else
                {
                    invoice.PaymentTypeId = 0;
                    invoice.AmountPaid    = decimal.Zero;
                }

                invoice.Notes          = string.IsNullOrEmpty(txtNotes.Text) ? String.Empty : txtNotes.Text;
                invoice.TotalAmount    = TotalValue;
                invoice.NotesForClient = string.IsNullOrEmpty(txtNoteForClient.Text) ? String.Empty : txtNoteForClient.Text;
                invoice.PrivateNotes   = string.IsNullOrEmpty(txtprivateNotes.Text) ? String.Empty : txtprivateNotes.Text;
                invoice.Status         = true;

                if (invoiceDetails == null || invoiceDetails.InvoiceId == 0)
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        invoiceService.AddInvoice(invoice);
                        lstInvoiceProduct = lstInvoiceProduct.OrderBy(s => s.InvoiceProductId).ToList <InvoiceProduct>();

                        for (int i = 0; i < lstInvoiceProduct.Count; i++)
                        {
                            InvoiceProduct invoiceProduct = new InvoiceProduct();
                            invoiceProduct.InvoiceId   = lstInvoiceProduct[i].InvoiceId;
                            invoiceProduct.ProductId   = lstInvoiceProduct[i].ProductId;
                            invoiceProduct.ProductName = lstInvoiceProduct[i].ProductName;
                            invoiceProduct.Description = lstInvoiceProduct[i].Description;
                            invoiceProduct.Quantity    = lstInvoiceProduct[i].Quantity;
                            invoiceProduct.TaxId       = lstInvoiceProduct[i].TaxId;
                            invoiceProduct.TaxValue    = lstInvoiceProduct[i].TaxValue;
                            invoiceProduct.UnitPrice   = lstInvoiceProduct[i].UnitPrice;
                            invoiceProduct.TotalPrice  = lstInvoiceProduct[i].TotalPrice;
                            invoiceService.AddInvoiceProducts(invoiceProduct);
                        }

                        scope.Complete();
                    }
                }
                else
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        invoiceService.UpdateInvoice(invoice);

                        for (int i = 0; i < lstInvoiceProduct.Count; i++)
                        {
                            InvoiceProduct invoiceProduct = new InvoiceProduct();
                            invoiceProduct.InvoiceId   = lstInvoiceProduct[i].InvoiceId;
                            invoiceProduct.ProductId   = lstInvoiceProduct[i].ProductId;
                            invoiceProduct.ProductName = lstInvoiceProduct[i].ProductName;
                            invoiceProduct.Description = lstInvoiceProduct[i].Description;
                            invoiceProduct.Quantity    = lstInvoiceProduct[i].Quantity;
                            invoiceProduct.TaxId       = lstInvoiceProduct[i].TaxId;
                            invoiceProduct.TaxValue    = lstInvoiceProduct[i].TaxValue;
                            invoiceProduct.UnitPrice   = lstInvoiceProduct[i].UnitPrice;
                            invoiceProduct.TotalPrice  = lstInvoiceProduct[i].TotalPrice;
                            invoiceService.UpdateInvoiceProducts(invoiceProduct);
                        }

                        scope.Complete();
                    }
                }

                CustomMessageBox.Show(string.Format(Constants.SUCCESSFULL_ADD_INVOICE_MESSAGE, invoice.InvoiceId),
                                      Constants.CONSTANT_INFORMATION,
                                      Sleek_Bill.Controls.CustomMessageBox.eDialogButtons.OK,
                                      CustomImages.GetDialogImage(Sleek_Bill.Controls.CustomImages.eCustomDialogImages.Success));
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Saving invoice: " + ex.Message);
            }
        }
コード例 #8
0
ファイル: Main.cs プロジェクト: Lolwis111/BCS_Software
        /// <summary>
        /// Creates a new Main window
        /// </summary>
        /// <param name="serverIp">Server IP to connect to</param>
        /// <param name="port">Port to connect on</param>
        /// <param name="isHost">Is this instance the server?</param>
        /// <param name="starter">Instance to Starter window</param>
        /// <param name="debugMode">start in debug mode</param>
        /// <param name="firstMove">Is this player starting?</param>
        /// <param name="customImages">Paths to the custom images</param>
        /// <param name="stateName">Name of your state</param>
        /// <param name="statePoints">Points your state has</param>
        public Main(string serverIp, int port, bool isHost, Starter starter, bool debugMode, bool firstMove, CustomImages customImages, string stateName, int statePoints)
        {
            _debug    = debugMode;
            _starter  = starter;
            _ip       = serverIp;
            _isHost   = isHost;
            _yourTurn = firstMove;

            _playerYou = new Player // Create your player
            {
                IsReady     = false,
                Jets        = 0,
                LivePoints  = statePoints,
                Name        = stateName,
                Soldiers    = 0,
                StartPoints = statePoints,
                Tanks       = 0
            };

            _port = port;

            InitializeComponent();

            LoadImages(customImages); // load the custom textures
        }
コード例 #9
0
ファイル: Main.cs プロジェクト: Lolwis111/BCS_Software
        private void LoadImages(CustomImages customImages)
        {
            if (customImages.JetImagePath == "#std")
            {
                pcJetYou.Image   = Resource.jet98;
                pcJetEnemy.Image = Resource.jet98;
            }
            else
            {
                if (File.Exists(customImages.JetImagePath))
                {
                    pcJetYou.Image   = Image.FromFile(customImages.JetImagePath);
                    pcJetEnemy.Image = Image.FromFile(customImages.JetImagePath);
                }
                else
                {
                    listBoxLog.Items.Add("Textur für 'Jet' nicht gefunden! Benutze Standart");
                    pcJetYou.Image   = Resource.jet98;
                    pcJetEnemy.Image = Resource.jet98;
                }
            }

            if (customImages.SoldierImagePath == "#std")
            {
                pcSoldierYou.Image   = Resource.soldier98;
                pcSoldierEnemy.Image = Resource.soldier98;
            }
            else
            {
                if (File.Exists(customImages.JetImagePath))
                {
                    pcSoldierYou.Image   = Image.FromFile(customImages.SoldierImagePath);
                    pcSoldierEnemy.Image = Image.FromFile(customImages.SoldierImagePath);
                }
                else
                {
                    listBoxLog.Items.Add("Textur für 'Soldat' nicht gefunden! Benutze Standart");
                    pcSoldierYou.Image   = Resource.soldier98;
                    pcSoldierEnemy.Image = Resource.soldier98;
                }
            }

            if (customImages.TankImagePath == "#std")
            {
                pcTankYou.Image   = Resource.tank98;
                pcTankEnemy.Image = Resource.tank98;
            }
            else
            {
                if (File.Exists(customImages.JetImagePath))
                {
                    pcTankYou.Image   = Image.FromFile(customImages.TankImagePath);
                    pcTankEnemy.Image = Image.FromFile(customImages.TankImagePath);
                }
                else
                {
                    listBoxLog.Items.Add("Textur für 'Panzer' nicht gefunden! Benutze Standart");
                    pcTankYou.Image   = Resource.tank98;
                    pcTankEnemy.Image = Resource.tank98;
                }
            }
        }