コード例 #1
0
 /// <summary>
 /// Function to insert values to RejectionOutMaster Table
 /// </summary>
 /// <param name="rejectionoutmasterinfo"></param>
 public void RejectionOutMasterAdd(RejectionOutMasterInfo rejectionoutmasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("RejectionOutMasterAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@rejectionOutMasterId", SqlDbType.Decimal);
         sprmparam.Value = rejectionoutmasterinfo.RejectionOutMasterId;
         sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = rejectionoutmasterinfo.VoucherNo;
         sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = rejectionoutmasterinfo.InvoiceNo;
         sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = rejectionoutmasterinfo.SuffixPrefixId;
         sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = rejectionoutmasterinfo.VoucherTypeId;
         sprmparam       = sccmd.Parameters.Add("@materialReceiptMasterId", SqlDbType.Decimal);
         sprmparam.Value = rejectionoutmasterinfo.MaterialReceiptMasterId;
         sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = rejectionoutmasterinfo.Date;
         sprmparam       = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
         sprmparam.Value = rejectionoutmasterinfo.LedgerId;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = rejectionoutmasterinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@exchangeRateId", SqlDbType.Decimal);
         sprmparam.Value = rejectionoutmasterinfo.ExchangeRateId;
         sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = rejectionoutmasterinfo.TotalAmount;
         sprmparam       = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
         sprmparam.Value = rejectionoutmasterinfo.UserId;
         sprmparam       = sccmd.Parameters.Add("@lrNo", SqlDbType.VarChar);
         sprmparam.Value = rejectionoutmasterinfo.LrNo;
         sprmparam       = sccmd.Parameters.Add("@transportationCompany", SqlDbType.VarChar);
         sprmparam.Value = rejectionoutmasterinfo.TransportationCompany;
         sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = rejectionoutmasterinfo.FinancialYearId;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = rejectionoutmasterinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = rejectionoutmasterinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = rejectionoutmasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
コード例 #2
0
        /// <summary>
        /// Function to get particular values from RejectionOutMaster table based on the parameter
        /// </summary>
        /// <param name="rejectionOutMasterId"></param>
        /// <returns></returns>
        public RejectionOutMasterInfo RejectionOutMasterView(decimal rejectionOutMasterId)
        {
            RejectionOutMasterInfo rejectionoutmasterinfo = new RejectionOutMasterInfo();
            SqlDataReader          sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("RejectionOutMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@rejectionOutMasterId", SqlDbType.Decimal);
                sprmparam.Value = rejectionOutMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    rejectionoutmasterinfo.RejectionOutMasterId    = decimal.Parse(sdrreader[0].ToString());
                    rejectionoutmasterinfo.VoucherNo               = sdrreader[1].ToString();
                    rejectionoutmasterinfo.InvoiceNo               = sdrreader[2].ToString();
                    rejectionoutmasterinfo.SuffixPrefixId          = decimal.Parse(sdrreader[3].ToString());
                    rejectionoutmasterinfo.VoucherTypeId           = decimal.Parse(sdrreader[4].ToString());
                    rejectionoutmasterinfo.MaterialReceiptMasterId = decimal.Parse(sdrreader[5].ToString());
                    rejectionoutmasterinfo.Date                  = DateTime.Parse(sdrreader[6].ToString());
                    rejectionoutmasterinfo.LedgerId              = decimal.Parse(sdrreader[7].ToString());
                    rejectionoutmasterinfo.Narration             = sdrreader[8].ToString();
                    rejectionoutmasterinfo.ExchangeRateId        = decimal.Parse(sdrreader[9].ToString());
                    rejectionoutmasterinfo.TotalAmount           = decimal.Parse(sdrreader[10].ToString());
                    rejectionoutmasterinfo.UserId                = decimal.Parse(sdrreader[11].ToString());
                    rejectionoutmasterinfo.LrNo                  = sdrreader[12].ToString();
                    rejectionoutmasterinfo.TransportationCompany = sdrreader[13].ToString();
                    rejectionoutmasterinfo.FinancialYearId       = decimal.Parse(sdrreader[14].ToString());
                    rejectionoutmasterinfo.ExtraDate             = DateTime.Parse(sdrreader[15].ToString());
                    rejectionoutmasterinfo.Extra1                = sdrreader[16].ToString();
                    rejectionoutmasterinfo.Extra2                = sdrreader[17].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(rejectionoutmasterinfo);
        }