Exemplo n.º 1
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         BrandSP spBrand = new BrandSP();
         BrandInfo infoBrand = new BrandInfo();
         infoBrand.BrandName = txtBrandName.Text.Trim();
         infoBrand.Narration = txtNarration.Text.Trim(); ;
         infoBrand.Manufacturer = txtManufacturer.Text.Trim();
         infoBrand.ExtraDate = DateTime.Now;
         infoBrand.Extra1 = string.Empty;
         infoBrand.Extra2 = string.Empty;
         if (spBrand.BrandCheckIfExist(txtBrandName.Text.Trim(), 0) == false)
         {
             decIdentity = spBrand.BrandAdd(infoBrand);
             Messages.SavedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Brand name already exist");
             txtBrandName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Function to Update values in brand Table
 /// </summary>
 /// <param name="brandinfo"></param>
 /// <returns></returns>
 public bool BrandEdit(BrandInfo brandinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("BrandEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@brandId", SqlDbType.Decimal);
         sprmparam.Value = brandinfo.BrandId;
         sprmparam = sccmd.Parameters.Add("@brandName", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.BrandName;
         sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.Narration;
         sprmparam = sccmd.Parameters.Add("@manufacturer", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.Manufacturer;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = brandinfo.Extra2;
         sprmparam = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = brandinfo.ExtraDate;
         int inEffectedRow = sccmd.ExecuteNonQuery();
         if (inEffectedRow > 0)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         return false;
     }
     finally
     {
         sqlcon.Close();
     }
 }
Exemplo n.º 3
0
 /// <summary>
 ///  Grid fill function Againest DeliveryNote
 /// </summary>
 public void gridFillAgainestDeliveryNote()
 {
     DeliveryNoteMasterSP SPDeliveryNoteMaster = new DeliveryNoteMasterSP();
     DeliveryNoteDetailsSP SPDeliveryNoteDetails = new DeliveryNoteDetailsSP();
     ProductInfo infoproduct = new ProductInfo();
     SalesMasterSP spSalesMaster = new SalesMasterSP();
     BrandInfo InfoBrand = new BrandInfo();
     TaxInfo infoTax = new TaxInfo();
     TaxSP SPTax = new TaxSP();
     try
     {
         if (cmbSalesModeOrderNo.SelectedIndex > 0)
         {
             inMaxCount = 0;
             isValueChange = false;
             for (int i = 0; i < dgvSalesInvoice.RowCount - 1; i++)
             {
                 if (dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value != null && dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value.ToString() != string.Empty)
                 {
                     lstArrOfRemove.Add(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value.ToString());
                 }
             }
             dgvSalesInvoice.Rows.Clear();
             isValueChange = true;
             DataTable dtblMaster = SPDeliveryNoteMaster.SalesInvoiceGridfillAgainestDeliveryNote(Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString()));
             cmbPricingLevel.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["pricingLevelId"].ToString());
             cmbCurrency.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["exchangeRateId"].ToString());
             cmbPricingLevel.Enabled = false;
             cmbCurrency.Enabled = false;
             DataTable dtblDetails = SPDeliveryNoteDetails.SalesInvoiceGridfillAgainestDeliveryNoteUsingDeliveryNoteDetails(Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString()), decSalesInvoiceIdToEdit, DecSalesInvoiceVoucherTypeId);
             dtblDeliveryNoteDetails = dtblDetails;
             int inRowIndex = 0;
             foreach (DataRow drowDetails in dtblDetails.Rows)
             {
                 dgvSalesInvoice.Rows.Add();
                 IsSetGridValueChange = false;
                 isValueChange = false;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceDeliveryNoteDetailsId"].Value = drowDetails["deliveryNoteDetailsId"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductCode"].Value = drowDetails["productCode"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceBarcode"].Value = drowDetails["barcode"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvcmbSalesInvoiceBatch"].Value = Convert.ToDecimal(drowDetails["batchId"].ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherNo"].Value = drowDetails["voucherNo"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value = drowDetails["invoiceNo"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value = drowDetails["voucherTypeId"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value = "0";
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInRowIndex"].Value = drowDetails["deliveryNoteDetailsId"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value = drowDetails.ItemArray[2].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceUnitConversionId"].Value = drowDetails["unitConversionId"].ToString();
                 infoproduct = spSalesMaster.ProductViewByProductIdforSalesInvoice(Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value).ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductName"].Value = infoproduct.ProductName;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceMrp"].Value = infoproduct.Mrp;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicePurchaseRate"].Value = infoproduct.PurchaseRate;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceSalesRate"].Value = infoproduct.SalesRate;
                 InfoBrand = new BrandSP().BrandView(infoproduct.BrandId);
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceBrand"].Value = InfoBrand.BrandName;
                 infoTax = SPTax.TaxViewByProductId(Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value).ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvcmbSalesInvoiceTaxName"].Value = infoTax.TaxId;
                 isValueChange = false;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicembUnitName"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString());
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicembUnitName"].ReadOnly = true;
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceQty"].Value = drowDetails["Qty"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceRate"].Value = drowDetails["rate"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceAmount"].Value = drowDetails["amount"].ToString();
                 dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceConversionRate"].Value = drowDetails["conversionRate"].ToString();
                 isFromAgainest = true;
                 gridColumnMakeEnables();
                 int intIndex = 0;
                 intIndex = Convert.ToInt32(drowDetails["deliveryNoteDetailsId"].ToString());
                 if (inMaxCount < intIndex)
                     inMaxCount = intIndex;
                 inRowIndex++;
                 isValueChange = true;
                 isFromAgainest = false;
                 GrossValueCalculation(dgvSalesInvoice.Rows.Count - 2);
                 discountCalculation(dgvSalesInvoice.Rows.Count - 2);
                 taxAndGridTotalAmountCalculation(dgvSalesInvoice.Rows.Count - 2);
             }
             IsSetGridValueChange = true;
             for (int i = inRowIndex; i < dgvSalesInvoice.Rows.Count; ++i)
                 dgvSalesInvoice["dgvtxtSalesInvoiceInRowIndex", i].Value = GetNextinRowIndex().ToString();
             SerialNoforSalesInvoice();
             strVoucherNoTostockPost = dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherNo"].Value.ToString();
             strInvoiceNoTostockPost = dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value.ToString();
             decVouchertypeIdTostockPost = Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value);
         }
         else
         {
             SiGridTotalAmountCalculation();
             ClearGridAgainest();
         }
         SiGridTotalAmountCalculation();
     }
     catch (Exception ex)
     {
         MessageBox.Show("SI: 53" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Fill controls on datagridview cell double click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvBrand_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             BrandInfo infoBrand = new BrandInfo();
             BrandSP spBrand = new BrandSP();
             strBrandName = dgvBrand.CurrentRow.Cells["Column1"].Value.ToString();
             if (strBrandName != "NA")
             {
                 decBrandId = Convert.ToDecimal(dgvBrand.Rows[e.RowIndex].Cells["dgvtxtBrandid"].Value.ToString());
                 infoBrand = spBrand.BrandView(decBrandId);
                 txtBrandName.Text = infoBrand.BrandName;
                 txtManufacturer.Text = infoBrand.Manufacturer;
                 txtNarration.Text = infoBrand.Narration;
                 btnSave.Text = "Update";
                 txtBrandName.Focus();
                 btnDelete.Enabled = true;
                 strBrandName = infoBrand.BrandName;
             }
             else
             {
                 Messages.WarningMessage("NA Brand cannot update or delete");
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BR19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Function to edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         BrandSP spBrand = new BrandSP();
         BrandInfo infoBrand = new BrandInfo();
         infoBrand.BrandName = txtBrandName.Text.Trim();
         infoBrand.Narration = txtNarration.Text.Trim();
         infoBrand.Manufacturer = txtManufacturer.Text.Trim();
         infoBrand.Extra1 = string.Empty;
         infoBrand.Extra2 = string.Empty;
         infoBrand.ExtraDate = DateTime.Now;
         infoBrand.BrandId = decBrandId;
         if (txtBrandName.Text != strBrandName)
         {
             if (CheckExistenceOfBrandName() == false)
             {
                 if (spBrand.BrandEdit(infoBrand))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                     txtBrandName.Focus();
                 }
                 else if (infoBrand.BrandId == 1)
                 {
                     Messages.InformationMessage("Cannot update");
                     Clear();
                     txtBrandName.Focus();
                 }
             }
             else
             {
                 Messages.InformationMessage("Brand name already exists");
                 txtBrandName.Focus();
             }
         }
         else if (infoBrand.BrandId == 1)
         {
             Messages.InformationMessage("Cannot update");
             Clear();
             txtBrandName.Focus();
         }
         else
         {
             if (spBrand.BrandEdit(infoBrand))
             {
                 Messages.UpdatedMessage();
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Function to get particular values from brand table based on the parameter
 /// </summary>
 /// <param name="brandId"></param>
 /// <returns></returns>
 public BrandInfo BrandView(decimal brandId)
 {
     BrandInfo brandinfo = new BrandInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("BrandView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@brandId", SqlDbType.Decimal);
         sprmparam.Value = brandId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             brandinfo.BrandName = sdrreader[1].ToString();
             brandinfo.Narration = sdrreader[2].ToString();
             brandinfo.Manufacturer = sdrreader[3].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return brandinfo;
 }