Exemplo n.º 1
0
 /// <summary>
 /// Function to Update values in PhysicalStockMaster Table
 /// </summary>
 /// <param name="physicalstockmasterinfo"></param>
 public void PhysicalStockMasterEdit(PhysicalStockMasterInfo physicalstockmasterinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("PhysicalStockMasterEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@physicalStockMasterId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.PhysicalStockMasterId;
         sprmparam       = sccmd.Parameters.Add("@voucherNo", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.VoucherNo;
         sprmparam       = sccmd.Parameters.Add("@invoiceNo", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.InvoiceNo;
         sprmparam       = sccmd.Parameters.Add("@suffixPrefixId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.SuffixPrefixId;
         sprmparam       = sccmd.Parameters.Add("@voucherTypeId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.VoucherTypeId;
         sprmparam       = sccmd.Parameters.Add("@date", SqlDbType.DateTime);
         sprmparam.Value = physicalstockmasterinfo.Date;
         sprmparam       = sccmd.Parameters.Add("@narration", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Narration;
         sprmparam       = sccmd.Parameters.Add("@totalAmount", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.TotalAmount;
         sprmparam       = sccmd.Parameters.Add("@financialYearId", SqlDbType.Decimal);
         sprmparam.Value = physicalstockmasterinfo.FinancialYearId;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = physicalstockmasterinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = physicalstockmasterinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Function to get particular values from PhysicalStockMaster table based on the parameter
        /// </summary>
        /// <param name="physicalStockMasterId"></param>
        /// <returns></returns>
        public PhysicalStockMasterInfo PhysicalStockMasterView(decimal physicalStockMasterId)
        {
            PhysicalStockMasterInfo physicalstockmasterinfo = new PhysicalStockMasterInfo();
            SqlDataReader           sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("PhysicalStockMasterView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@physicalStockMasterId", SqlDbType.Decimal);
                sprmparam.Value = physicalStockMasterId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    physicalstockmasterinfo.PhysicalStockMasterId = decimal.Parse(sdrreader[0].ToString());
                    physicalstockmasterinfo.VoucherNo             = sdrreader[1].ToString();
                    physicalstockmasterinfo.InvoiceNo             = sdrreader[2].ToString();
                    physicalstockmasterinfo.SuffixPrefixId        = decimal.Parse(sdrreader[3].ToString());
                    physicalstockmasterinfo.VoucherTypeId         = decimal.Parse(sdrreader[4].ToString());
                    physicalstockmasterinfo.Date            = DateTime.Parse(sdrreader[5].ToString());
                    physicalstockmasterinfo.Narration       = sdrreader[6].ToString();
                    physicalstockmasterinfo.TotalAmount     = decimal.Parse(sdrreader[7].ToString());
                    physicalstockmasterinfo.FinancialYearId = decimal.Parse(sdrreader[8].ToString());
                    physicalstockmasterinfo.ExtraDate       = DateTime.Parse(sdrreader[9].ToString());
                    physicalstockmasterinfo.Extra1          = sdrreader[10].ToString();
                    physicalstockmasterinfo.Extra2          = sdrreader[11].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(physicalstockmasterinfo);
        }