コード例 #1
0
        /// <summary>
        /// Function to Update values in ReceiptMaster Table
        /// </summary>
        /// <param name="receiptmasterinfo"></param>
        /// <returns></returns>
        public decimal ReceiptMasterEdit(ReceiptMasterInfo receiptmasterinfo)
        {
            decimal decRecieptMasterId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ReceiptMasterEdit", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam          = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.ReceiptMasterId;
                sprmparam          = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.VoucherNo;
                sprmparam          = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.InvoiceNo;
                sprmparam          = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.SuffixPrefixId;
                sprmparam          = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value    = receiptmasterinfo.Date;
                sprmparam          = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.LedgerId;
                sprmparam          = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.TotalAmount;
                sprmparam          = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.Narration;
                sprmparam          = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.VoucherTypeId;
                sprmparam          = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.UserId;
                sprmparam          = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value    = receiptmasterinfo.FinancialYearId;
                sprmparam          = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
                sprmparam.Value    = receiptmasterinfo.ExtraDate;
                sprmparam          = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.Extra1;
                sprmparam          = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value    = receiptmasterinfo.Extra2;
                decRecieptMasterId = Convert.ToDecimal(sccmd.ExecuteNonQuery().ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decRecieptMasterId);
        }
コード例 #2
0
        /// <summary>
        /// Function to get particular values from ReceiptMaster table based on the parameter
        /// </summary>
        /// <param name="receiptMasterId"></param>
        /// <returns></returns>
        public ReceiptMasterInfo ReceiptMasterView(decimal receiptMasterId)
        {
            ReceiptMasterInfo receiptmasterinfo = new ReceiptMasterInfo();
            SqlDataReader     sdrreader         = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ReceiptMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
                sprmparam.Value = receiptMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    receiptmasterinfo.ReceiptMasterId = decimal.Parse(sdrreader[0].ToString());
                    receiptmasterinfo.VoucherNo       = sdrreader[1].ToString();
                    receiptmasterinfo.InvoiceNo       = sdrreader[2].ToString();
                    receiptmasterinfo.SuffixPrefixId  = decimal.Parse(sdrreader[3].ToString());
                    receiptmasterinfo.Date            = DateTime.Parse(sdrreader[4].ToString());
                    receiptmasterinfo.LedgerId        = decimal.Parse(sdrreader[5].ToString());
                    receiptmasterinfo.TotalAmount     = decimal.Parse(sdrreader[6].ToString());
                    receiptmasterinfo.Narration       = sdrreader[7].ToString();
                    receiptmasterinfo.VoucherTypeId   = decimal.Parse(sdrreader[8].ToString());
                    receiptmasterinfo.UserId          = decimal.Parse(sdrreader[9].ToString());
                    receiptmasterinfo.FinancialYearId = decimal.Parse(sdrreader[10].ToString());
                    receiptmasterinfo.ExtraDate       = DateTime.Parse(sdrreader[11].ToString());
                    receiptmasterinfo.Extra1          = sdrreader[12].ToString();
                    receiptmasterinfo.Extra2          = sdrreader[13].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(receiptmasterinfo);
        }
コード例 #3
0
        /// <summary>
        /// Function to get particular values from eceiptMaster table based on the parameter
        /// </summary>
        /// <param name="decReceiptMastertId"></param>
        /// <returns></returns>
        public ReceiptMasterInfo ReceiptMasterViewByMasterId(decimal decReceiptMastertId)
        {
            ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
            SqlDataReader     sdrreader         = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ReceiptMasterViewByMasterId", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@receiptMasterId", SqlDbType.Decimal);
                sprmparam.Value = decReceiptMastertId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    InfoReceiptMaster.VoucherNo       = sdrreader["voucherNo"].ToString();
                    InfoReceiptMaster.InvoiceNo       = sdrreader["invoiceNo"].ToString();
                    InfoReceiptMaster.SuffixPrefixId  = decimal.Parse(sdrreader["suffixprefixId"].ToString());
                    InfoReceiptMaster.Date            = DateTime.Parse(sdrreader["date"].ToString());
                    InfoReceiptMaster.LedgerId        = decimal.Parse(sdrreader["ledgerId"].ToString());
                    InfoReceiptMaster.TotalAmount     = decimal.Parse(sdrreader["totalAmount"].ToString());
                    InfoReceiptMaster.Narration       = sdrreader["narration"].ToString();
                    InfoReceiptMaster.VoucherTypeId   = decimal.Parse(sdrreader["voucherTypeId"].ToString());
                    InfoReceiptMaster.UserId          = decimal.Parse(sdrreader["userId"].ToString());
                    InfoReceiptMaster.FinancialYearId = decimal.Parse(sdrreader["financialYearId"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(InfoReceiptMaster);
        }
コード例 #4
0
 /// <summary>
 /// Function to fill datagridview
 /// </summary>
 public void gridfill()
 {
     try
     {
         ReceiptMasterSP   SpReceiptMaster   = new ReceiptMasterSP();
         ReceiptMasterInfo InfoReceiptMaster = new ReceiptMasterInfo();
         DataTable         dtbl = new DataTable();
         if (cmbAccountLedger.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             if (txtFromDate.Text.Trim() != string.Empty && txtToDate.Text.Trim() != string.Empty)
             {
                 dtbl = SpReceiptMaster.ReceiptMasterSearch(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), Convert.ToDecimal(cmbAccountLedger.SelectedValue), txtVoucherNo.Text);
                 dgvReceiptRegister.DataSource = dtbl;
             }
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "RR4:" + ex.Message;
     }
 }