/// <summary> /// 修改应收款状态 /// </summary> /// <param name="contractNo">合同编号</param> /// <param name="rNum">收款序号</param> /// <param name="isReceived">1:没确认收款 2:已收款</param> public void UpdateIsReceived(string contractNo, int rNum, int isReceived) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdUpdateIsreceived = cmdUpdateIsreceived.Clone() as MySqlCommand; _cmdUpdateIsreceived.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdUpdateIsreceived.Parameters["@InstalmentsNo"].Value = rNum; _cmdUpdateIsreceived.Parameters["@Isreceived"].Value = isReceived; _cmdUpdateIsreceived.Parameters["@ContractNo"].Value = contractNo; _cmdUpdateIsreceived.Parameters["@ReceivedTime"].Value = DateTime.Now; int i = _cmdUpdateIsreceived.ExecuteNonQuery(); } catch (Exception e) { } finally { oc.Close(); oc.Dispose(); oc = null; _cmdUpdateIsreceived.Dispose(); _cmdUpdateIsreceived = null; GC.Collect(); } }
/// <summary> /// 删除数据 /// <param name="es">数据实体对象数组</param> /// <returns></returns> /// </summary> public bool Delete(int IdmarketingVisit) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdDeleteMarketingVisit = cmdDeleteMarketingVisit.Clone() as MySqlCommand; bool returnValue = false; _cmdDeleteMarketingVisit.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdDeleteMarketingVisit.Parameters["@IdmarketingVisit"].Value = IdmarketingVisit; _cmdDeleteMarketingVisit.ExecuteNonQuery(); return(returnValue); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdDeleteMarketingVisit.Dispose(); _cmdDeleteMarketingVisit = null; } }
/// <summary> /// 获取全部数据 /// </summary> public List <MarketingVisit> Search() { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdLoadAllMarketingVisit = cmdLoadAllMarketingVisit.Clone() as MySqlCommand; _cmdLoadAllMarketingVisit.Connection = oc; List <MarketingVisit> returnValue = new List <MarketingVisit>(); try { _cmdLoadAllMarketingVisit.CommandText = string.Format(_cmdLoadAllMarketingVisit.CommandText, string.Empty); if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdLoadAllMarketingVisit.ExecuteReader(); while (reader.Read()) { returnValue.Add(new MarketingVisit().BuildSampleEntity(reader)); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdLoadAllMarketingVisit.Dispose(); _cmdLoadAllMarketingVisit = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 修改指定的数据 /// <param name="e">修改后的数据实体对象</param> /// <para>数据对应的主键必须在实例中设置</para> /// </summary> public void Update(SysFunction e) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdUpdateSysFunction = cmdUpdateSysFunction.Clone() as MySqlCommand; _cmdUpdateSysFunction.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdUpdateSysFunction.Parameters["@IdsysFunction"].Value = e.IdsysFunction; _cmdUpdateSysFunction.Parameters["@FunctionName"].Value = e.FunctionName; _cmdUpdateSysFunction.Parameters["@FatherId"].Value = e.FatherId; _cmdUpdateSysFunction.Parameters["@Mark"].Value = e.Mark; _cmdUpdateSysFunction.Parameters["@FunctionUrl"].Value = e.FunctionUrl; _cmdUpdateSysFunction.Parameters["@FunctionCode"].Value = e.FunctionCode; _cmdUpdateSysFunction.Parameters["@Level"].Value = e.Level; _cmdUpdateSysFunction.ExecuteNonQuery(); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdUpdateSysFunction.Dispose(); _cmdUpdateSysFunction = null; GC.Collect(); } }
/// <summary> /// 加载某个用户所有权限列表(包括所有级) /// </summary> /// <param name="userId"></param> /// <returns></returns> public List <SysFunction> SearchSysUserRolePermisson(int userId) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetSysUserRolePermisson = cmdGetSysUserRolePermisson.Clone() as MySqlCommand; _cmdGetSysUserRolePermisson.Connection = oc; List <SysFunction> returnValue = new List <SysFunction>(); try { if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdGetSysUserRolePermisson.ExecuteReader(); while (reader.Read()) { returnValue.Add(new SysFunction().BuildSampleEntity(reader)); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetSysUserRolePermisson.Dispose(); _cmdGetSysUserRolePermisson = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 获取指定记录 /// <param name="id">Id值</param> /// </summary> public ProProductionType Get(int PTypeId) { ProProductionType returnValue = null; MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetProProductionType = cmdGetProProductionType.Clone() as MySqlCommand; _cmdGetProProductionType.Connection = oc; try { _cmdGetProProductionType.Parameters["@PTypeId"].Value = PTypeId; if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdGetProProductionType.ExecuteReader(); if (reader.HasRows) { reader.Read(); returnValue = new ProProductionType().BuildSampleEntity(reader); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetProProductionType.Dispose(); _cmdGetProProductionType = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 添加数据 /// <param name="es">数据实体对象数组</param> /// <returns></returns> /// </summary> public bool Insert(SysFunction e) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdInsertSysFunction = cmdInsertSysFunction.Clone() as MySqlCommand; bool returnValue = false; _cmdInsertSysFunction.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdInsertSysFunction.Parameters["@IdsysFunction"].Value = e.IdsysFunction; _cmdInsertSysFunction.Parameters["@FunctionName"].Value = e.FunctionName; _cmdInsertSysFunction.Parameters["@FatherId"].Value = e.FatherId; _cmdInsertSysFunction.Parameters["@Mark"].Value = e.Mark; _cmdInsertSysFunction.Parameters["@FunctionUrl"].Value = e.FunctionUrl; _cmdInsertSysFunction.Parameters["@FunctionCode"].Value = e.FunctionCode; _cmdInsertSysFunction.Parameters["@Level"].Value = e.Level; _cmdInsertSysFunction.ExecuteNonQuery(); return(returnValue); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdInsertSysFunction.Dispose(); _cmdInsertSysFunction = null; } }
/// <summary> /// 获取全部数据 /// </summary> public List <SysRole> LoadEntRole(int entId) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdLoadEntRole = cmdLoadEntRole.Clone() as MySqlCommand; _cmdLoadEntRole.Connection = oc; List <SysRole> returnValue = new List <SysRole>(); try { _cmdLoadEntRole.Parameters["@EntId"].Value = entId; if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdLoadEntRole.ExecuteReader(); while (reader.Read()) { returnValue.Add(new SysRole().BuildCountEntity(reader)); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdLoadEntRole.Dispose(); _cmdLoadEntRole = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 加载某个用户所有权限列表(包括所有级) /// </summary> /// <param name="userId"></param> /// <returns></returns> public List <SysRole> SearchSysRolesByUserId(int userId) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetSysRoleByUserId = cmdGetSysRoleByUserId.Clone() as MySqlCommand; _cmdGetSysRoleByUserId.Connection = oc; List <SysRole> returnValue = new List <SysRole>(); try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdGetSysRoleByUserId.Parameters["@UserId"].Value = userId; MySqlDataReader reader = _cmdGetSysRoleByUserId.ExecuteReader(); while (reader.Read()) { returnValue.Add(new SysRole().BuildSampleEntity(reader)); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetSysRoleByUserId.Dispose(); _cmdGetSysRoleByUserId = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 通过企业名称获取企业客户 /// </summary> public List <CustomerEnt> SearchCustomerEntByName(string name) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdSearchCustomerEntByName = cmdSearchCustomerEntByName.Clone() as MySqlCommand; _cmdSearchCustomerEntByName.Connection = oc; List <CustomerEnt> returnValue = new List <CustomerEnt>(); try { _cmdSearchCustomerEntByName.CommandText = string.Format(_cmdSearchCustomerEntByName.CommandText, " ent_name like \"%" + name + "%\" "); if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdSearchCustomerEntByName.ExecuteReader(); while (reader.Read()) { returnValue.Add(new CustomerEnt().BuildSampleEntity(reader)); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdSearchCustomerEntByName.Dispose(); _cmdSearchCustomerEntByName = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 删除数据 /// <param name="es">数据实体对象数组</param> /// <returns></returns> /// </summary> public bool DeleteByUserId(int userId) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdDeleteByUserId = cmdDeleteByUserId.Clone() as MySqlCommand; bool returnValue = false; _cmdDeleteByUserId.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdDeleteByUserId.Parameters["@UserId"].Value = userId; _cmdDeleteByUserId.ExecuteNonQuery(); return(returnValue); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdDeleteByUserId.Dispose(); _cmdDeleteByUserId = null; } }
/// <summary> /// 获取指定记录 /// <param name="id">Id值</param> /// </summary> public CustomerEnt Get(int CustomerEntId) { CustomerEnt returnValue = null; MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetCustomerEnt = cmdGetCustomerEnt.Clone() as MySqlCommand; _cmdGetCustomerEnt.Connection = oc; try { _cmdGetCustomerEnt.Parameters["@CustomerEntId"].Value = CustomerEntId; if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdGetCustomerEnt.ExecuteReader(); if (reader.HasRows) { reader.Read(); returnValue = new CustomerEnt().BuildSampleEntity(reader); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetCustomerEnt.Dispose(); _cmdGetCustomerEnt = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 获取指定记录 /// <param name="ContractNo">合同编号</param> /// </summary> public ContractInfo Get(string ContractNo) { ContractInfo returnValue = null; MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetContractInfo = cmdGetContractInfo.Clone() as MySqlCommand; _cmdGetContractInfo.Connection = oc; try { _cmdGetContractInfo.Parameters["@ContractNo"].Value = ContractNo; if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdGetContractInfo.ExecuteReader(); if (reader.HasRows) { reader.Read(); returnValue = new ContractInfo().BuildSampleEntity(reader); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetContractInfo.Dispose(); _cmdGetContractInfo = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 获取企业合同数 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public int GetContractInfoCount(UserType userType, Int32 sId) { int returnValue = 0; MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetContractInfoCount = cmdGetContractInfoCount.Clone() as MySqlCommand; _cmdGetContractInfoCount.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } if (userType == UserType.User) { _cmdGetContractInfoCount.CommandText = string.Format(_cmdGetContractInfoCount.CommandText, " owner_id = " + sId); } else { _cmdGetContractInfoCount.CommandText = string.Format(_cmdGetContractInfoCount.CommandText, " ent_id = " + sId); } returnValue = Convert.ToInt32(_cmdGetContractInfoCount.ExecuteScalar()); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetContractInfoCount.Dispose(); _cmdGetContractInfoCount = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 删除数据 /// <param name="es">数据实体对象数组</param> /// <returns></returns> /// </summary> public bool Delete(int PTypeId) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdDeleteProProductionType = cmdDeleteProProductionType.Clone() as MySqlCommand; bool returnValue = false; _cmdDeleteProProductionType.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdDeleteProProductionType.Parameters["@PTypeId"].Value = PTypeId; _cmdDeleteProProductionType.ExecuteNonQuery(); return(returnValue); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdDeleteProProductionType.Dispose(); _cmdDeleteProProductionType = null; } }
/// <summary> /// 添加数据 /// <param name="es">数据实体对象数组</param> /// <returns></returns> /// </summary> public bool Insert(ProProduction e) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdInsertProProduction = cmdInsertProProduction.Clone() as MySqlCommand; bool returnValue = false; _cmdInsertProProduction.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdInsertProProduction.Parameters["@PName"].Value = e.PName; _cmdInsertProProduction.Parameters["@PInfo"].Value = e.PInfo; _cmdInsertProProduction.Parameters["@Unit"].Value = e.Unit; _cmdInsertProProduction.Parameters["@PTypeId"].Value = e.PTypeId; _cmdInsertProProduction.Parameters["@LowestPrice"].Value = e.LowestPrice; _cmdInsertProProduction.Parameters["@MarketPrice"].Value = e.MarketPrice; _cmdInsertProProduction.Parameters["@UserId"].Value = e.UserId; returnValue = _cmdInsertProProduction.ExecuteNonQuery() > 0 ? true : returnValue; return(returnValue); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdInsertProProduction.Dispose(); _cmdInsertProProduction = null; } }
/// <summary> /// 修改指定的数据 /// <param name="e">修改后的数据实体对象</param> /// <para>数据对应的主键必须在实例中设置</para> /// </summary> public void Update(ProProductionType e) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdUpdateProProductionType = cmdUpdateProProductionType.Clone() as MySqlCommand; _cmdUpdateProProductionType.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdUpdateProProductionType.Parameters["@PTypeId"].Value = e.PTypeId; _cmdUpdateProProductionType.Parameters["@PTypeName"].Value = e.PTypeName; _cmdUpdateProProductionType.Parameters["@EntId"].Value = e.EntId; _cmdUpdateProProductionType.Parameters["@FatherId"].Value = e.FatherId; _cmdUpdateProProductionType.Parameters["@PicId"].Value = e.PicId; _cmdUpdateProProductionType.ExecuteNonQuery(); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdUpdateProProductionType.Dispose(); _cmdUpdateProProductionType = null; GC.Collect(); } }
/// <summary> /// 修改指定的数据 /// <param name="e">修改后的数据实体对象</param> /// <para>数据对应的主键必须在实例中设置</para> /// </summary> public void Update(ProProduction e) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdUpdateProProduction = cmdUpdateProProduction.Clone() as MySqlCommand; _cmdUpdateProProduction.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdUpdateProProduction.Parameters["@PId"].Value = e.PId; _cmdUpdateProProduction.Parameters["@PName"].Value = e.PName; _cmdUpdateProProduction.Parameters["@PInfo"].Value = e.PInfo; _cmdUpdateProProduction.Parameters["@Unit"].Value = e.Unit; _cmdUpdateProProduction.Parameters["@PTypeId"].Value = e.PTypeId; _cmdUpdateProProduction.Parameters["@LowestPrice"].Value = e.LowestPrice; _cmdUpdateProProduction.Parameters["@MarketPrice"].Value = e.MarketPrice; _cmdUpdateProProduction.Parameters["@UserId"].Value = e.UserId; _cmdUpdateProProduction.ExecuteNonQuery(); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdUpdateProProduction.Dispose(); _cmdUpdateProProduction = null; GC.Collect(); } }
/// <summary> /// 添加数据 /// <param name="es">数据实体对象数组</param> /// <returns></returns> /// </summary> public int Insert(ProProductionType e) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdInsertProProductionType = cmdInsertProProductionType.Clone() as MySqlCommand; int returnValue = 0; _cmdInsertProProductionType.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdInsertProProductionType.Parameters["@PTypeName"].Value = e.PTypeName; _cmdInsertProProductionType.Parameters["@EntId"].Value = e.EntId; _cmdInsertProProductionType.Parameters["@FatherId"].Value = e.FatherId; _cmdInsertProProductionType.Parameters["@PicId"].Value = e.PicId; _cmdInsertProProductionType.ExecuteNonQuery(); returnValue = Convert.ToInt32(_cmdInsertProProductionType.LastInsertedId); return(returnValue); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdInsertProProductionType.Dispose(); _cmdInsertProProductionType = null; } }
/// <summary> ///修改拜访记录状态 /// <param name="isVisit">1:未拜访 2:已拜访</param> /// <para>数据对应的主键必须在实例中设置</para> /// </summary> public void UpdateisVisit(int cid, int isVisit) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdUpdateIsVisit = cmdUpdateIsVisit.Clone() as MySqlCommand; _cmdUpdateIsVisit.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdUpdateIsVisit.Parameters["@IdmarketingChance"].Value = cid; _cmdUpdateIsVisit.Parameters["@isVisit"].Value = isVisit; _cmdUpdateIsVisit.ExecuteNonQuery(); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdUpdateIsVisit.Dispose(); _cmdUpdateIsVisit = null; GC.Collect(); } }
/// <summary> /// 删除数据 /// <param name="es">数据实体对象数组</param> /// <returns></returns> /// </summary> public bool Delete(int IdsysFunction) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdDeleteSysFunction = cmdDeleteSysFunction.Clone() as MySqlCommand; bool returnValue = false; _cmdDeleteSysFunction.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdDeleteSysFunction.Parameters["@IdsysFunction"].Value = IdsysFunction; _cmdDeleteSysFunction.ExecuteNonQuery(); return(returnValue); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdDeleteSysFunction.Dispose(); _cmdDeleteSysFunction = null; } }
/// <summary> /// 修改用户所属企业ID /// </summary> /// <param name="entid"></param> /// <param name="userid"></param> public void UpdateUserEntId(int entid, int userid) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdUpdateSysUserEntId = cmdUpdateSysUserEntId.Clone() as MySqlCommand; _cmdUpdateSysUserEntId.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdUpdateSysUserEntId.Parameters["@UserId"].Value = userid; _cmdUpdateSysUserEntId.Parameters["@EntId"].Value = entid; _cmdUpdateSysUserEntId.ExecuteNonQuery(); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdUpdateSysUserEntId.Dispose(); _cmdUpdateSysUserEntId = null; GC.Collect(); } }
/// <summary> /// 获取指定记录 /// <param name="id">Id值</param> /// </summary> public SysFunction Get(int IdsysFunction) { SysFunction returnValue = null; MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetSysFunction = cmdGetSysFunction.Clone() as MySqlCommand; _cmdGetSysFunction.Connection = oc; try { _cmdGetSysFunction.Parameters["@IdsysFunction"].Value = IdsysFunction; if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdGetSysFunction.ExecuteReader(); if (reader.HasRows) { reader.Read(); returnValue = new SysFunction().BuildSampleEntity(reader); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetSysFunction.Dispose(); _cmdGetSysFunction = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 通过账号密码获取用户 /// </summary> public SysUser GetSysUserByAcountAndPwd(string UserAccount, string Pwd) { SysUser returnValue = null; MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetSysUserByAcountAndPwd = cmdGetSysUserByAcountAndPwd.Clone() as MySqlCommand; _cmdGetSysUserByAcountAndPwd.Connection = oc; try { _cmdGetSysUserByAcountAndPwd.Parameters["@UserAccount"].Value = UserAccount; _cmdGetSysUserByAcountAndPwd.Parameters["@Pwd"].Value = Pwd; if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdGetSysUserByAcountAndPwd.ExecuteReader(); if (reader.HasRows) { reader.Read(); returnValue = new SysUser().BuildSampleEntity(reader); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetSysUserByAcountAndPwd.Dispose(); _cmdGetSysUserByAcountAndPwd = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 添加数据 /// <param name="es">数据实体对象数组</param> /// <returns></returns> /// </summary> public int Insert(MarketingVisit e) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdInsertMarketingVisit = cmdInsertMarketingVisit.Clone() as MySqlCommand; int returnValue = 0; _cmdInsertMarketingVisit.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdInsertMarketingVisit.Parameters["@VisitType"].Value = e.VisitType; _cmdInsertMarketingVisit.Parameters["@Amount"].Value = e.Amount; _cmdInsertMarketingVisit.Parameters["@Address"].Value = e.Address; _cmdInsertMarketingVisit.Parameters["@Remark"].Value = e.Remark; _cmdInsertMarketingVisit.Parameters["@VisitTime"].Value = e.VisitTime; _cmdInsertMarketingVisit.Parameters["@ChanceId"].Value = e.ChanceId; _cmdInsertMarketingVisit.Parameters["@EntId"].Value = e.EntId; _cmdInsertMarketingVisit.ExecuteNonQuery(); returnValue = Convert.ToInt32(_cmdInsertMarketingVisit.LastInsertedId); return(returnValue); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdInsertMarketingVisit.Dispose(); _cmdInsertMarketingVisit = null; } }
/// <summary> /// 按时间排序,获取最近注册企业用户 /// </summary> public SysUser GetLastSysUser() { SysUser returnValue = null; MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetLastSysUser = cmdGetLastSysUser.Clone() as MySqlCommand; _cmdGetLastSysUser.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdGetLastSysUser.ExecuteReader(); if (reader.HasRows) { reader.Read(); returnValue = new SysUser().BuildSampleEntity(reader); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetLastSysUser.Dispose(); _cmdGetLastSysUser = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 修改指定的数据 /// <param name="e">修改后的数据实体对象</param> /// <para>数据对应的主键必须在实例中设置</para> /// </summary> public void Update(MarketingVisit e) { MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdUpdateMarketingVisit = cmdUpdateMarketingVisit.Clone() as MySqlCommand; _cmdUpdateMarketingVisit.Connection = oc; try { if (oc.State == ConnectionState.Closed) { oc.Open(); } _cmdUpdateMarketingVisit.Parameters["@IdmarketingVisit"].Value = e.IdmarketingVisit; _cmdUpdateMarketingVisit.Parameters["@VisitType"].Value = e.VisitType; _cmdUpdateMarketingVisit.Parameters["@Amount"].Value = e.Amount; _cmdUpdateMarketingVisit.Parameters["@Address"].Value = e.Address; _cmdUpdateMarketingVisit.Parameters["@Remark"].Value = e.Remark; _cmdUpdateMarketingVisit.Parameters["@VisitTime"].Value = e.VisitTime; _cmdUpdateMarketingVisit.Parameters["@ChanceId"].Value = e.ChanceId; _cmdUpdateMarketingVisit.Parameters["@EntId"].Value = e.EntId; _cmdUpdateMarketingVisit.ExecuteNonQuery(); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdUpdateMarketingVisit.Dispose(); _cmdUpdateMarketingVisit = null; GC.Collect(); } }
/// <summary> /// 通过企业CODE获取企业基本信息 /// </summary> public SysUser GetEntUserByEntCode(string EntCode) { SysUser returnValue = null; MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetEntUserByEntCode = cmdGetEntUserByEntCode.Clone() as MySqlCommand; _cmdGetEntUserByEntCode.Connection = oc; try { _cmdGetEntUserByEntCode.Parameters["@EntCode"].Value = EntCode.ToUpper(); if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdGetEntUserByEntCode.ExecuteReader(); if (reader.HasRows) { reader.Read(); returnValue = new SysUser().BuildSampleEntity(reader); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetEntUserByEntCode.Dispose(); _cmdGetEntUserByEntCode = null; GC.Collect(); } return(returnValue); }
/// <summary> /// 获取指定记录 /// <param name="id">Id值</param> /// </summary> public MarketingVisit Get(int IdmarketingVisit) { MarketingVisit returnValue = null; MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdGetMarketingVisit = cmdGetMarketingVisit.Clone() as MySqlCommand; _cmdGetMarketingVisit.Connection = oc; try { _cmdGetMarketingVisit.Parameters["@IdmarketingVisit"].Value = IdmarketingVisit; if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdGetMarketingVisit.ExecuteReader(); if (reader.HasRows) { reader.Read(); returnValue = new MarketingVisit().BuildSampleEntity(reader); } } finally { oc.Close(); oc.Dispose(); oc = null; _cmdGetMarketingVisit.Dispose(); _cmdGetMarketingVisit = null; GC.Collect(); } return(returnValue); }
/// <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); }