コード例 #1
0
        /// <summary>
        /// Function to Update values in PDCReceivableMaster Table
        /// </summary>
        /// <param name="pdcreceivablemasterinfo"></param>
        public void PDCReceivableMasterEdit(PDCReceivableMasterInfo pdcreceivablemasterinfo)
        {
            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PDCReceivableMasterEdit", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@pdcReceivableMasterId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.PdcReceivableMasterId;
                sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.VoucherNo;
                sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.InvoiceNo;
                sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.SuffixPrefixId;
                sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
                sprmparam.Value = pdcreceivablemasterinfo.Date;
                sprmparam       = sccmd.Parameters.Add("@ledgerId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.LedgerId;
                sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.Amount;
                sprmparam       = sccmd.Parameters.Add("@chequeNo", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.ChequeNo;
                sprmparam       = sccmd.Parameters.Add("@chequeDate", SqlDbType.DateTime);
                sprmparam.Value = pdcreceivablemasterinfo.ChequeDate;
                sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.Narration;
                sprmparam       = sccmd.Parameters.Add("@userId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.UserId;
                sprmparam       = sccmd.Parameters.Add("@bankId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.BankId;
                sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.VoucherTypeId;
                sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
                sprmparam.Value = pdcreceivablemasterinfo.FinancialYearId;
                sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
                sprmparam.Value = pdcreceivablemasterinfo.ExtraDate;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = pdcreceivablemasterinfo.Extra2;
                sccmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            finally
            {
                sqlcon.Close();
            }
        }
コード例 #2
0
        /// <summary>
        /// Function to get particular values from PDCReceivableMaster Table based on the parameter
        /// </summary>
        /// <param name="pdcReceivableMasterId"></param>
        /// <returns></returns>
        public PDCReceivableMasterInfo PDCReceivableMasterView(decimal pdcReceivableMasterId)
        {
            PDCReceivableMasterInfo pdcreceivablemasterinfo = new PDCReceivableMasterInfo();
            SqlDataReader           sdrreader = null;

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