コード例 #1
0
 /// <summary>
 /// Edit Function When update datas in Register or Report
 /// </summary>
 public void EditFunction()
 {
     try
     {
         decimal decSalesOrderSuffixPrefixId = 0;
         SalesOrderBll bllSalesOrder = new SalesOrderBll();
         SalesOrderMasterInfo infoSalesOrderMaster = new SalesOrderMasterInfo();
         SalesOrderDetailsInfo infoSalesOrderDetails = new SalesOrderDetailsInfo();
         infoSalesOrderMaster.VoucherTypeId = decSalesVoucherId;
         for (int inI = 0; inI < dgvSalesOrder.Rows.Count - 1; inI++)
         {
             if (Convert.ToDecimal(dgvSalesOrder.Rows[inI].Cells["dgvtxtSalesOrderDetailsId"].Value) != null && Convert.ToDecimal(dgvSalesOrder.Rows[inI].Cells["dgvtxtSalesOrderDetailsId"].Value) != 0)
             {
                 //for (int i = 0; i < dgvSalesOrder.Rows.Count - 1; i++)
                 //{
                 isEditDetails = Convert.ToString(bllSalesOrder.SalesOrderRefererenceCheckForEditDetails(Convert.ToDecimal(dgvSalesOrder.Rows[inI].Cells["dgvtxtSalesOrderDetailsId"].Value)));
                 //}
             }
         }
         isEditMaster = Convert.ToString(bllSalesOrder.SalesOrderRefererenceCheckForEditMaster(decSalesOrderMasterId));
         if (isEditMaster == "False" && isEditDetails == "False")
         {
             infoSalesOrderMaster.SalesOrderMasterId = decSalesOrderMasterId;
             infoSalesOrderMaster.Cancelled = cbxCancelled.Checked;
             infoSalesOrderMaster.Date = Convert.ToDateTime(txtDate.Text);
             infoSalesOrderMaster.DueDate = Convert.ToDateTime(txtDueDate.Text);
             infoSalesOrderMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
             infoSalesOrderMaster.SuffixPrefixId = Convert.ToDecimal(decSalesOrderSuffixPrefixId);
             infoSalesOrderMaster.VoucherNo = strVoucherNo;
             infoSalesOrderMaster.InvoiceNo = txtOrderNo.Text;
             infoSalesOrderMaster.UserId = PublicVariables._decCurrentUserId;
             infoSalesOrderMaster.PricinglevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString());
             infoSalesOrderMaster.EmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString());
             if (cmbQuotationNo.SelectedIndex == -1)
             {
                 infoSalesOrderMaster.QuotationMasterId = 0;
             }
             else
             {
                 infoSalesOrderMaster.QuotationMasterId = Convert.ToDecimal(cmbQuotationNo.SelectedValue.ToString());
             }
             infoSalesOrderMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
             infoSalesOrderMaster.ExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
             infoSalesOrderMaster.Narration = txtNarration.Text.Trim();
             infoSalesOrderMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text);
             infoSalesOrderMaster.Extra1 = string.Empty;
             infoSalesOrderMaster.Extra2 = string.Empty;
             RemoveSalesOrderDetails();
             bllSalesOrder.SalesOrderMasterEdit(infoSalesOrderMaster);
             SalesOrderDetailsEditFill();
             Messages.UpdatedMessage();
             if (frmSalesOrderRegisterObj != null)
             {
                 if (cbxPrintAfterSave.Checked == true)
                 {
                     if (new SettingsBll().SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decSalesOrderMasterId);
                     }
                     else
                     {
                         Print(decSalesOrderMasterId);
                     }
                 }
                 this.Close();
                 frmSalesOrderRegisterObj.GridFill();
             }
             if (frmSalesOrderReportObj != null)
             {
                 if (cbxPrintAfterSave.Checked == true)
                 {
                     if (new SettingsBll().SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decSalesOrderMasterId);
                     }
                     else
                     {
                         Print(decSalesOrderMasterId);
                     }
                 }
                 this.Close();
                 frmSalesOrderReportObj.GridFill();
             }
             if (frmDayBookObj != null)
             {
                 if (cbxPrintAfterSave.Checked == true)
                 {
                     if (new SettingsBll().SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decSalesOrderMasterId);
                     }
                     else
                     {
                         Print(decSalesOrderMasterId);
                     }
                 }
                 this.Close();
             }
             if (objVoucherSearch != null)
             {
                 if (cbxPrintAfterSave.Checked == true)
                 {
                     if (new SettingsBll().SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decSalesOrderMasterId);
                     }
                     else
                     {
                         Print(decSalesOrderMasterId);
                     }
                 }
                 this.Close();
                 objVoucherSearch.GridFill();
             }
         }
         else
         {
             Messages.ReferenceExistsMessageForUpdate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SO47:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }