Exemplo n.º 1
0
 /// <summary>
 /// Function to Update values in MaterialReceiptDetails Table
 /// </summary>
 /// <param name="materialreceiptdetailsinfo"></param>
 public void MaterialReceiptDetailsEdit(MaterialReceiptDetailsInfo materialreceiptdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("MaterialReceiptDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@materialReceiptDetailsId", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.MaterialReceiptDetailsId;
         sprmparam       = sccmd.Parameters.Add("@materialReceiptMasterId", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.MaterialReceiptMasterId;
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@orderDetailsId", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.OrderDetailsId;
         sprmparam       = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.Qty;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.UnitId;
         sprmparam       = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.UnitConversionId;
         sprmparam       = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.BatchId;
         sprmparam       = sccmd.Parameters.Add("@godownId", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.GodownId;
         sprmparam       = sccmd.Parameters.Add("@rackId", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.RackId;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = materialreceiptdetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@slno", SqlDbType.Int);
         sprmparam.Value = materialreceiptdetailsinfo.Slno;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = materialreceiptdetailsinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = materialreceiptdetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@exta2", SqlDbType.VarChar);
         sprmparam.Value = materialreceiptdetailsinfo.Exta2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Function to get particular values from MaterialReceiptDetails Table based on the parameter
        /// </summary>
        /// <param name="materialReceiptDetailsId"></param>
        /// <returns></returns>
        public MaterialReceiptDetailsInfo MaterialReceiptDetailsView(decimal materialReceiptDetailsId)
        {
            MaterialReceiptDetailsInfo materialreceiptdetailsinfo = new MaterialReceiptDetailsInfo();
            SqlDataReader sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("MaterialReceiptDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@materialReceiptDetailsId", SqlDbType.Decimal);
                sprmparam.Value = materialReceiptDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    materialreceiptdetailsinfo.MaterialReceiptDetailsId = decimal.Parse(sdrreader[0].ToString());
                    materialreceiptdetailsinfo.MaterialReceiptMasterId  = decimal.Parse(sdrreader[1].ToString());
                    materialreceiptdetailsinfo.ProductId        = decimal.Parse(sdrreader[2].ToString());
                    materialreceiptdetailsinfo.OrderDetailsId   = decimal.Parse(sdrreader[3].ToString());
                    materialreceiptdetailsinfo.Qty              = decimal.Parse(sdrreader[4].ToString());
                    materialreceiptdetailsinfo.Rate             = decimal.Parse(sdrreader[5].ToString());
                    materialreceiptdetailsinfo.UnitId           = decimal.Parse(sdrreader[6].ToString());
                    materialreceiptdetailsinfo.UnitConversionId = decimal.Parse(sdrreader[7].ToString());
                    materialreceiptdetailsinfo.BatchId          = decimal.Parse(sdrreader[8].ToString());
                    materialreceiptdetailsinfo.GodownId         = decimal.Parse(sdrreader[9].ToString());
                    materialreceiptdetailsinfo.RackId           = decimal.Parse(sdrreader[10].ToString());
                    materialreceiptdetailsinfo.Amount           = decimal.Parse(sdrreader[11].ToString());
                    materialreceiptdetailsinfo.Slno             = int.Parse(sdrreader[12].ToString());
                    materialreceiptdetailsinfo.Extra1           = sdrreader[14].ToString();
                    materialreceiptdetailsinfo.Exta2            = sdrreader[15].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(materialreceiptdetailsinfo);
        }