Exemplo n.º 1
0
        /// <summary>
        /// 修改指定的数据
        /// <param name="e">修改后的数据实体对象</param>
        /// <para>数据对应的主键必须在实例中设置</para>
        /// </summary>
        public void Update(ContractHowtopay e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdUpdateContractHowtopay = cmdUpdateContractHowtopay.Clone() as MySqlCommand;

            _cmdUpdateContractHowtopay.Connection = oc;

            try
            {
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }

                _cmdUpdateContractHowtopay.Parameters["@HowtopayId"].Value    = e.HowtopayId;
                _cmdUpdateContractHowtopay.Parameters["@InstalmentsNo"].Value = e.InstalmentsNo;
                _cmdUpdateContractHowtopay.Parameters["@Amount"].Value        = e.Amount;
                _cmdUpdateContractHowtopay.Parameters["@PayTime"].Value       = e.PayTime;
                _cmdUpdateContractHowtopay.Parameters["@ReceivedTime"].Value  = e.ReceivedTime;
                _cmdUpdateContractHowtopay.Parameters["@Isreceived"].Value    = e.Isreceived;
                _cmdUpdateContractHowtopay.Parameters["@ContractNo"].Value    = e.ContractNo;
                _cmdUpdateContractHowtopay.Parameters["@EntId"].Value         = e.EntId;

                _cmdUpdateContractHowtopay.ExecuteNonQuery();
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdUpdateContractHowtopay.Dispose();
                _cmdUpdateContractHowtopay = null;
                GC.Collect();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取指定记录
        /// <param name="id">Id值</param>
        /// </summary>
        public ContractHowtopay Get(int HowtopayId)
        {
            ContractHowtopay returnValue             = null;
            MySqlConnection  oc                      = ConnectManager.Create();
            MySqlCommand     _cmdGetContractHowtopay = cmdGetContractHowtopay.Clone() as MySqlCommand;

            _cmdGetContractHowtopay.Connection = oc;
            try
            {
                _cmdGetContractHowtopay.Parameters["@HowtopayId"].Value = HowtopayId;

                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }

                MySqlDataReader reader = _cmdGetContractHowtopay.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    returnValue = new ContractHowtopay().BuildSampleEntity(reader);
                }
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdGetContractHowtopay.Dispose();
                _cmdGetContractHowtopay = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加数据
        /// <param name="es">数据实体对象数组</param>
        /// <returns></returns>
        /// </summary>
        public int Insert(ContractHowtopay e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdInsertContractHowtopay = cmdInsertContractHowtopay.Clone() as MySqlCommand;
            int             returnValue = 0;

            _cmdInsertContractHowtopay.Connection = oc;
            try
            {
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }
                _cmdInsertContractHowtopay.Parameters["@InstalmentsNo"].Value = e.InstalmentsNo;
                _cmdInsertContractHowtopay.Parameters["@Amount"].Value        = e.Amount;
                _cmdInsertContractHowtopay.Parameters["@PayTime"].Value       = e.PayTime;
                // _cmdInsertContractHowtopay.Parameters["@ReceivedTime"].Value = e.ReceivedTime;
                _cmdInsertContractHowtopay.Parameters["@Isreceived"].Value = e.Isreceived;
                _cmdInsertContractHowtopay.Parameters["@ContractNo"].Value = e.ContractNo;
                _cmdInsertContractHowtopay.Parameters["@EntId"].Value      = e.EntId;

                _cmdInsertContractHowtopay.ExecuteNonQuery();
                returnValue = Convert.ToInt32(_cmdInsertContractHowtopay.LastInsertedId);
                return(returnValue);
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdInsertContractHowtopay.Dispose();
                _cmdInsertContractHowtopay = null;
            }
        }