/// <summary>
        ///
        /// </summary>
        /// <param name="userType">1:企业管理员或者老板 2:普通用户</param>
        /// <param name="IsVisit"></param>
        /// <param name="sId">如果是企业管理员或者老板就是企业ID,不然就是普通用户ID</param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public PageEntity <MarketingChance> Search(UserType userType, int IsVisit, Int32 sId, int pageIndex, int pageSize)
        {
            PageEntity <MarketingChance> returnValue = new PageEntity <MarketingChance>();
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdLoadMarketingChance     = cmdLoadMarketingChance.Clone() as MySqlCommand;
            MySqlCommand    _cmdGetMarketingChanceCount = cmdGetMarketingChanceCount.Clone() as MySqlCommand;

            _cmdLoadMarketingChance.Connection     = oc;
            _cmdGetMarketingChanceCount.Connection = oc;

            try
            {
                _cmdLoadMarketingChance.Parameters["@PageIndex"].Value = pageIndex;
                _cmdLoadMarketingChance.Parameters["@PageSize"].Value  = pageSize;
                _cmdLoadMarketingChance.Parameters["@IsVisit"].Value   = IsVisit;

                if (userType == UserType.User)
                {
                    _cmdLoadMarketingChance.CommandText     = string.Format(_cmdLoadMarketingChance.CommandText, " user_id =  " + sId);
                    _cmdGetMarketingChanceCount.CommandText = string.Format(_cmdGetMarketingChanceCount.CommandText, " user_id =  " + sId);
                }
                else
                {
                    _cmdLoadMarketingChance.CommandText     = string.Format(_cmdLoadMarketingChance.CommandText, " ent_id = " + sId);
                    _cmdGetMarketingChanceCount.CommandText = string.Format(_cmdGetMarketingChanceCount.CommandText, " ent_id = " + sId);
                }
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }

                MySqlDataReader reader = _cmdLoadMarketingChance.ExecuteReader();
                _cmdGetMarketingChanceCount.Parameters["@IsVisit"].Value = IsVisit;
                while (reader.Read())
                {
                    returnValue.Items.Add(new MarketingChance().BuildSampleEntity(reader));
                }
                reader.Close();
                returnValue.RecordsCount = Convert.ToInt32(_cmdGetMarketingChanceCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadMarketingChance.Dispose();
                _cmdLoadMarketingChance = null;
                _cmdGetMarketingChanceCount.Dispose();
                _cmdGetMarketingChanceCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemple #2
0
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>
        public PageEntity <CustomerPrivate> Search(Int32 CustomerPrivateId, String Name, Int32 Sex, DateTime Birthday, String Industy, String Mobile, String Email, String Qq, String Phone, String Address, String Detail, Int32 EntId, Int32 OwnerId, int pageIndex, int pageSize)
        {
            PageEntity <CustomerPrivate> returnValue = new PageEntity <CustomerPrivate>();
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdLoadCustomerPrivate     = cmdLoadCustomerPrivate.Clone() as MySqlCommand;
            MySqlCommand    _cmdGetCustomerPrivateCount = cmdGetCustomerPrivateCount.Clone() as MySqlCommand;

            _cmdLoadCustomerPrivate.Connection     = oc;
            _cmdGetCustomerPrivateCount.Connection = oc;

            try
            {
                _cmdLoadCustomerPrivate.Parameters["@PageIndex"].Value         = pageIndex;
                _cmdLoadCustomerPrivate.Parameters["@PageSize"].Value          = pageSize;
                _cmdLoadCustomerPrivate.Parameters["@CustomerPrivateId"].Value = CustomerPrivateId;
                _cmdLoadCustomerPrivate.Parameters["@Name"].Value     = Name;
                _cmdLoadCustomerPrivate.Parameters["@Sex"].Value      = Sex;
                _cmdLoadCustomerPrivate.Parameters["@Birthday"].Value = Birthday;
                _cmdLoadCustomerPrivate.Parameters["@Industy"].Value  = Industy;
                _cmdLoadCustomerPrivate.Parameters["@Mobile"].Value   = Mobile;
                _cmdLoadCustomerPrivate.Parameters["@Email"].Value    = Email;
                _cmdLoadCustomerPrivate.Parameters["@Qq"].Value       = Qq;
                _cmdLoadCustomerPrivate.Parameters["@Phone"].Value    = Phone;
                _cmdLoadCustomerPrivate.Parameters["@Address"].Value  = Address;
                _cmdLoadCustomerPrivate.Parameters["@Detail"].Value   = Detail;
                _cmdLoadCustomerPrivate.Parameters["@EntId"].Value    = EntId;
                _cmdLoadCustomerPrivate.Parameters["@OwnerId"].Value  = OwnerId;

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

                MySqlDataReader reader = _cmdLoadCustomerPrivate.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new CustomerPrivate().BuildSampleEntity(reader));
                }
                returnValue.RecordsCount = Convert.ToInt32(_cmdGetCustomerPrivateCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadCustomerPrivate.Dispose();
                _cmdLoadCustomerPrivate = null;
                _cmdGetCustomerPrivateCount.Dispose();
                _cmdGetCustomerPrivateCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>
        public PageEntity <SysUser> Search(string entCode, Int32 UserId, String UserName, String UserAccount, String Pwd, String Mobile, String Email, DateTime CreateTime, DateTime EndTime, Int32 EntAdminId, Int32 IsEnable, Int32 Type, Int32 EntId, int pageIndex, int pageSize)
        {
            PageEntity <SysUser> returnValue         = new PageEntity <SysUser>();
            MySqlConnection      oc                  = ConnectManager.Create();
            MySqlCommand         _cmdLoadSysUser     = cmdLoadSysUser.Clone() as MySqlCommand;
            MySqlCommand         _cmdGetSysUserCount = cmdGetSysUserCount.Clone() as MySqlCommand;

            _cmdLoadSysUser.Connection     = oc;
            _cmdGetSysUserCount.Connection = oc;

            try
            {
                _cmdLoadSysUser.Parameters["@PageIndex"].Value   = pageIndex;
                _cmdLoadSysUser.Parameters["@PageSize"].Value    = pageSize;
                _cmdLoadSysUser.Parameters["@UserId"].Value      = UserId;
                _cmdLoadSysUser.Parameters["@UserName"].Value    = UserName;
                _cmdLoadSysUser.Parameters["@UserAccount"].Value = UserAccount;
                _cmdLoadSysUser.Parameters["@Pwd"].Value         = Pwd;
                _cmdLoadSysUser.Parameters["@Mobile"].Value      = Mobile;
                _cmdLoadSysUser.Parameters["@Email"].Value       = Email;
                _cmdLoadSysUser.Parameters["@CreateTime"].Value  = CreateTime;
                _cmdLoadSysUser.Parameters["@EndTime"].Value     = EndTime;
                _cmdLoadSysUser.Parameters["@EntAdminId"].Value  = EntAdminId;
                _cmdLoadSysUser.Parameters["@IsEnable"].Value    = IsEnable;
                _cmdLoadSysUser.Parameters["@Type"].Value        = Type;
                _cmdLoadSysUser.Parameters["@EntId"].Value       = EntId;
                _cmdLoadSysUser.Parameters["@EntCode"].Value     = entCode;

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

                MySqlDataReader reader = _cmdLoadSysUser.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new SysUser().BuildSampleEntity(reader));
                }
                returnValue.RecordsCount = Convert.ToInt32(_cmdGetSysUserCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadSysUser.Dispose();
                _cmdLoadSysUser = null;
                _cmdGetSysUserCount.Dispose();
                _cmdGetSysUserCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemple #4
0
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>
        public PageEntity <ProProductonDetail> Search(Int32 UserId, Int32 PId, Int32 EntId, int pageIndex, int pageSize, int type)
        {
            PageEntity <ProProductonDetail> returnValue = new PageEntity <ProProductonDetail>();
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdLoadProProductonDetail     = cmdLoadProProductonDetail.Clone() as MySqlCommand;
            MySqlCommand    _cmdGetProProductonDetailCount = cmdGetProProductonDetailCount.Clone() as MySqlCommand;

            _cmdLoadProProductonDetail.Connection     = oc;
            _cmdGetProProductonDetailCount.Connection = oc;

            try
            {
                _cmdLoadProProductonDetail.Parameters["@PageIndex"].Value = pageIndex;
                _cmdLoadProProductonDetail.Parameters["@PageSize"].Value  = pageSize;
                _cmdLoadProProductonDetail.Parameters["@UserId"].Value    = UserId;
                _cmdLoadProProductonDetail.Parameters["@PId"].Value       = PId;
                _cmdLoadProProductonDetail.Parameters["@EntId"].Value     = EntId;

                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }
                string sqlText = string.Empty;
                if (type == 1)//库存
                {
                    sqlText = "and is_pay=2 ";
                }
                _cmdLoadProProductonDetail.CommandText     = string.Format(_cmdLoadProProductonDetail.CommandText, sqlText);
                _cmdGetProProductonDetailCount.CommandText = string.Format(_cmdGetProProductonDetailCount.CommandText, sqlText);
                MySqlDataReader reader = _cmdLoadProProductonDetail.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new ProProductonDetail().BuildSampleEntity(reader));
                }
                reader.Close();
                _cmdGetProProductonDetailCount.Parameters["@UserId"].Value = UserId;
                _cmdGetProProductonDetailCount.Parameters["@PId"].Value    = PId;
                _cmdGetProProductonDetailCount.Parameters["@EntId"].Value  = EntId;
                returnValue.RecordsCount = Convert.ToInt32(_cmdGetProProductonDetailCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadProProductonDetail.Dispose();
                _cmdLoadProProductonDetail = null;
                _cmdGetProProductonDetailCount.Dispose();
                _cmdGetProProductonDetailCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemple #5
0
        public PageEntity <CustomerPrivate> SearchCustomerPrivByOwnerId(int ownerid, int pageIndex, int pageSize)
        {
            MySqlConnection oc  = ConnectManager.Create();
            MySqlConnection oc1 = ConnectManager.Create();
            MySqlCommand    _cmdSearchCustomerPrivByOwnerId = cmdSearchCustomerPrivByOwnerId.Clone() as MySqlCommand;

            _cmdSearchCustomerPrivByOwnerId.Connection = oc;
            MySqlCommand _cmdSearchCustomerPrivByOwnerIdCount = cmdSearchCustomerPrivByOwnerIdCount.Clone() as MySqlCommand;

            _cmdSearchCustomerPrivByOwnerIdCount.Connection = oc1;
            PageEntity <CustomerPrivate> returnValue = new PageEntity <CustomerPrivate>();

            try
            {
                _cmdSearchCustomerPrivByOwnerId.Parameters["@PageIndex"].Value = pageIndex;
                _cmdSearchCustomerPrivByOwnerId.Parameters["@PageSize"].Value  = pageSize;
                _cmdSearchCustomerPrivByOwnerId.Parameters["@OwnerId"].Value   = ownerid;

                _cmdSearchCustomerPrivByOwnerIdCount.Parameters["@OwnerId"].Value = ownerid;

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

                MySqlDataReader reader = _cmdSearchCustomerPrivByOwnerId.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new CustomerPrivate().BuildSampleEntity(reader));
                }
                returnValue.RecordsCount = Convert.ToInt32(_cmdSearchCustomerPrivByOwnerIdCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                oc1.Clone();
                oc1.Dispose();
                oc1 = null;
                _cmdSearchCustomerPrivByOwnerId.Dispose();
                _cmdSearchCustomerPrivByOwnerId = null;
                _cmdSearchCustomerPrivByOwnerIdCount.Dispose();
                _cmdSearchCustomerPrivByOwnerIdCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>
        public PageEntity <ResPic> Search(Int32 PicId, String PicDescription, Int32 ObjId, Int32 ObjType, String PicUrl, Int32 PicHeight, Int32 PicWidth, Int32 State, int pageIndex, int pageSize)
        {
            PageEntity <ResPic> returnValue        = new PageEntity <ResPic>();
            MySqlConnection     oc                 = ConnectManager.Create();
            MySqlCommand        _cmdLoadResPic     = cmdLoadResPic.Clone() as MySqlCommand;
            MySqlCommand        _cmdGetResPicCount = cmdGetResPicCount.Clone() as MySqlCommand;

            _cmdLoadResPic.Connection     = oc;
            _cmdGetResPicCount.Connection = oc;

            try
            {
                _cmdLoadResPic.Parameters["@PageIndex"].Value      = pageIndex * pageSize;;
                _cmdLoadResPic.Parameters["@PageSize"].Value       = (pageIndex + 1) * pageSize;;
                _cmdLoadResPic.Parameters["@PicId"].Value          = PicId;
                _cmdLoadResPic.Parameters["@PicDescription"].Value = PicDescription;
                _cmdLoadResPic.Parameters["@ObjId"].Value          = ObjId;
                _cmdLoadResPic.Parameters["@ObjType"].Value        = ObjType;
                _cmdLoadResPic.Parameters["@PicUrl"].Value         = PicUrl;
                _cmdLoadResPic.Parameters["@PicHeight"].Value      = PicHeight;
                _cmdLoadResPic.Parameters["@PicWidth"].Value       = PicWidth;
                _cmdLoadResPic.Parameters["@State"].Value          = State;

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

                MySqlDataReader reader = _cmdLoadResPic.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new ResPic().BuildSampleEntity(reader));
                }
                reader.Close();
                returnValue.PageIndex    = pageIndex;
                returnValue.PageSize     = pageSize;
                returnValue.RecordsCount = Convert.ToInt32(_cmdGetResPicCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadResPic.Dispose();
                _cmdLoadResPic = null;
                _cmdGetResPicCount.Dispose();
                _cmdGetResPicCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemple #7
0
        /// <summary>
        /// 获取老板模式 vcountType 1:获取多次拜访数量,2:获取初次拜访数量 3: 获取有报价的机会数
        /// </summary>
        /// <param name="entId"></param>
        /// <param name="vcountType">1:获取多次拜访数量,2:获取初次拜访数量 3: 获取有报价的机会数</param>
        /// <returns></returns>
        public int GetFirstAndMoreVisitCount(Int32 entId, int vcountType, DateTime startTime, DateTime endTime)
        {
            int             returnValue = 0;
            MySqlConnection oc          = ConnectManager.Create();
            MySqlCommand    _cmdGetFirstAndMoreVisitCount = cmdGetFirstAndMoreVisitCount.Clone() as MySqlCommand;

            _cmdGetFirstAndMoreVisitCount.Connection = oc;

            try
            {
                string strsql = string.Empty;
                switch (vcountType)
                {
                case 1:
                    strsql = " where a.num > 1 ";
                    break;

                case 2:
                    strsql = " where a.num = 1 ";
                    break;

                case 3:
                    strsql = " where a.amount > 0 ";
                    break;

                default:
                    strsql = string.Empty;
                    break;
                }
                _cmdGetFirstAndMoreVisitCount.CommandText = string.Format(_cmdGetFirstAndMoreVisitCount.CommandText, strsql);

                _cmdGetFirstAndMoreVisitCount.Parameters["@EntId"].Value     = entId;
                _cmdGetFirstAndMoreVisitCount.Parameters["@StartTime"].Value = startTime;
                _cmdGetFirstAndMoreVisitCount.Parameters["@EndTime"].Value   = endTime;
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }
                returnValue = Convert.ToInt32(_cmdGetFirstAndMoreVisitCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdGetFirstAndMoreVisitCount.Dispose();
                _cmdGetFirstAndMoreVisitCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemple #8
0
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>
        public PageEntity <ProProductionType> Search(Int32 PTypeId, String PTypeName, Int32 EntId, Int32 FatherId, int pageIndex, int pageSize)
        {
            PageEntity <ProProductionType> returnValue = new PageEntity <ProProductionType>();
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdLoadProProductionType      = cmdLoadProProductionType.Clone() as MySqlCommand;
            MySqlCommand    _cmdLoadProProductionTypeCount = cmdLoadProProductionTypeCount.Clone() as MySqlCommand;

            _cmdLoadProProductionType.Connection      = oc;
            _cmdLoadProProductionTypeCount.Connection = oc;
            try
            {
                _cmdLoadProProductionType.Parameters["@PageIndex"].Value = pageIndex;
                _cmdLoadProProductionType.Parameters["@PageSize"].Value  = pageSize;
                _cmdLoadProProductionType.Parameters["@ptypeid"].Value   = PTypeId;
                _cmdLoadProProductionType.Parameters["@ptypename"].Value = PTypeName;
                _cmdLoadProProductionType.Parameters["@entid"].Value     = EntId;
                _cmdLoadProProductionType.Parameters["@fatherid"].Value  = FatherId;

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

                MySqlDataReader reader = _cmdLoadProProductionType.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new ProProductionType().BuildSampleEntity(reader));
                }
                reader.Close();
                _cmdLoadProProductionTypeCount.Parameters["@ptypeid"].Value   = PTypeId;
                _cmdLoadProProductionTypeCount.Parameters["@ptypename"].Value = PTypeName;
                _cmdLoadProProductionTypeCount.Parameters["@entid"].Value     = EntId;
                _cmdLoadProProductionTypeCount.Parameters["@fatherid"].Value  = FatherId;

                returnValue.RecordsCount = Convert.ToInt32(_cmdLoadProProductionTypeCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadProProductionType.Dispose();
                _cmdLoadProProductionType = null;
                _cmdLoadProProductionTypeCount.Dispose();
                _cmdLoadProProductionTypeCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemple #9
0
        /// <summary>
        /// 删除数据
        /// <param name="es">数据实体对象数组</param>
        /// <returns></returns>
        /// </summary>
        public bool DeleteAllData()
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdDeleteAllData = new MySqlCommand();
            bool            returnValue       = false;

            _cmdDeleteAllData.Connection = oc;
            try
            {
                List <string> sqllist = new List <string>();
                sqllist.Add(@" delete from contract_info where contract_info.ent_id = 14 ");
                sqllist.Add(@" delete from  contract_howtopay where contract_howtopay.ent_id = 14 ");
                sqllist.Add(@" delete from marketing_visit where marketing_visit.ent_id = 14 ");
                sqllist.Add(@" delete from marketing_chance where marketing_chance.ent_id = 14 ");
                sqllist.Add(@" delete from customer_ent where customer_ent.ent_id = 14");
                sqllist.Add(@" delete from customer_private where customer_private.ent_id = 14 ");
                sqllist.Add(@" delete from  pro_production where pro_production.ent_id = 14 ");
                sqllist.Add(@" delete from pro_production_type where pro_production_type.ent_id = 14 ");
                sqllist.Add(@" delete from pro_producton_detail where pro_producton_detail.ent_id = 14 ");
                sqllist.Add(@" delete from res_pic where res_pic.ent_id = 14 ");
//                sqllist.Add(@" delete from sys_role_user where sys_role_user.ent_id = 14 ");
//                sqllist.Add(@" delete from
//    sys_user
//where
//    sys_user.ent_id=14
//    and sys_user.type = 1 ");
//                sqllist.Add(@" delete from sys_user_timemachine where sys_user_timemachine.ent_id = 14 ");
                for (int i = 0; i < sqllist.Count; i++)
                {
                    if (oc.State == ConnectionState.Closed)
                    {
                        oc.Open();
                    }
                    _cmdDeleteAllData.CommandText = sqllist[0];
                    //returnValue = Convert.ToInt32(_cmdDeleteAllData.ExecuteNonQuery()) > 0 ? true : false;
                    //if (!returnValue)
                    //    return returnValue;
                }
                return(returnValue);
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdDeleteAllData.Dispose();
                _cmdDeleteAllData = null;
            }
        }
        /// <summary>
        /// 获取全部数据
        /// </summary>
        public List <SysUser> LoadSysUserByRoleId(int entId, int roleId)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdLoadSysUserByRoleId = cmdLoadSysUserByRoleId.Clone() as MySqlCommand;

            _cmdLoadSysUserByRoleId.Connection = oc; List <SysUser> returnValue = new List <SysUser>();
            try
            {
                string strsql = string.Empty;
                switch (roleId)
                {
                case 0:
                    strsql = string.Empty;
                    break;

                case -1:
                    strsql = " where role_id is null ";
                    break;

                default:
                    strsql = " where role_id = " + roleId;
                    break;
                }
                _cmdLoadSysUserByRoleId.CommandText = string.Format(_cmdLoadSysUserByRoleId.CommandText, strsql);
                _cmdLoadSysUserByRoleId.Parameters["@EntId"].Value = entId;
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }

                MySqlDataReader reader = _cmdLoadSysUserByRoleId.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Add(new SysUser().BuildUserRoleEntity(reader));
                }
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadSysUserByRoleId.Dispose();
                _cmdLoadSysUserByRoleId = null;
                GC.Collect();
            }
            return(returnValue);
        }
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>
        public PageEntity <SysFunction> Search(Int32 IdsysFunction, String FunctionName, Int32 FatherId, String Mark, String FunctionUrl, String FunctionCode, Int32 Level, int pageIndex, int pageSize)
        {
            PageEntity <SysFunction> returnValue             = new PageEntity <SysFunction>();
            MySqlConnection          oc                      = ConnectManager.Create();
            MySqlCommand             _cmdLoadSysFunction     = cmdLoadSysFunction.Clone() as MySqlCommand;
            MySqlCommand             _cmdGetSysFunctionCount = cmdGetSysFunctionCount.Clone() as MySqlCommand;

            _cmdLoadSysFunction.Connection     = oc;
            _cmdGetSysFunctionCount.Connection = oc;

            try
            {
                _cmdLoadSysFunction.Parameters["@PageIndex"].Value     = pageIndex;
                _cmdLoadSysFunction.Parameters["@PageSize"].Value      = pageSize;
                _cmdLoadSysFunction.Parameters["@IdsysFunction"].Value = IdsysFunction;
                _cmdLoadSysFunction.Parameters["@FunctionName"].Value  = FunctionName;
                _cmdLoadSysFunction.Parameters["@FatherId"].Value      = FatherId;
                _cmdLoadSysFunction.Parameters["@Mark"].Value          = Mark;
                _cmdLoadSysFunction.Parameters["@FunctionUrl"].Value   = FunctionUrl;
                _cmdLoadSysFunction.Parameters["@FunctionCode"].Value  = FunctionCode;
                _cmdLoadSysFunction.Parameters["@Level"].Value         = Level;

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

                MySqlDataReader reader = _cmdLoadSysFunction.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new SysFunction().BuildSampleEntity(reader));
                }
                returnValue.RecordsCount = (int)_cmdGetSysFunctionCount.ExecuteScalar();
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadSysFunction.Dispose();
                _cmdLoadSysFunction = null;
                _cmdGetSysFunctionCount.Dispose();
                _cmdGetSysFunctionCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>
        public PageEntity <SysLog> Search(Int32 IdsysLog, Int32 UserId, DateTime AddTime, String Action, String Parameter, String Result, int pageIndex, int pageSize)
        {
            PageEntity <SysLog> returnValue        = new PageEntity <SysLog>();
            MySqlConnection     oc                 = ConnectManager.Create();
            MySqlCommand        _cmdLoadSysLog     = cmdLoadSysLog.Clone() as MySqlCommand;
            MySqlCommand        _cmdGetSysLogCount = cmdGetSysLogCount.Clone() as MySqlCommand;

            _cmdLoadSysLog.Connection     = oc;
            _cmdGetSysLogCount.Connection = oc;

            try
            {
                _cmdLoadSysLog.Parameters["@PageIndex"].Value = pageIndex;
                _cmdLoadSysLog.Parameters["@PageSize"].Value  = pageSize;
                _cmdLoadSysLog.Parameters["@IdsysLog"].Value  = IdsysLog;
                _cmdLoadSysLog.Parameters["@UserId"].Value    = UserId;
                _cmdLoadSysLog.Parameters["@AddTime"].Value   = AddTime;
                _cmdLoadSysLog.Parameters["@Action"].Value    = Action;
                _cmdLoadSysLog.Parameters["@Parameter"].Value = Parameter;
                _cmdLoadSysLog.Parameters["@Result"].Value    = Result;

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

                MySqlDataReader reader = _cmdLoadSysLog.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new SysLog().BuildSampleEntity(reader));
                }
                returnValue.RecordsCount = Convert.ToInt32(_cmdGetSysLogCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadSysLog.Dispose();
                _cmdLoadSysLog = null;
                _cmdGetSysLogCount.Dispose();
                _cmdGetSysLogCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemple #13
0
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>
        public PageEntity <SysRoleUser> Search(Int32 SysRoleUserId, Int32 RoleId, Int32 UserId, Int32 EntId, int pageIndex, int pageSize)
        {
            PageEntity <SysRoleUser> returnValue             = new PageEntity <SysRoleUser>();
            MySqlConnection          oc                      = ConnectManager.Create();
            MySqlCommand             _cmdLoadSysRoleUser     = cmdLoadSysRoleUser.Clone() as MySqlCommand;
            MySqlCommand             _cmdGetSysRoleUserCount = cmdGetSysRoleUserCount.Clone() as MySqlCommand;

            _cmdLoadSysRoleUser.Connection     = oc;
            _cmdGetSysRoleUserCount.Connection = oc;

            try
            {
                _cmdLoadSysRoleUser.Parameters["@PageIndex"].Value     = pageIndex;
                _cmdLoadSysRoleUser.Parameters["@PageSize"].Value      = pageSize;
                _cmdLoadSysRoleUser.Parameters["@SysRoleUserId"].Value = SysRoleUserId;
                _cmdLoadSysRoleUser.Parameters["@RoleId"].Value        = RoleId;
                _cmdLoadSysRoleUser.Parameters["@UserId"].Value        = UserId;
                _cmdLoadSysRoleUser.Parameters["@EntId"].Value         = EntId;

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

                MySqlDataReader reader = _cmdLoadSysRoleUser.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new SysRoleUser().BuildSampleEntity(reader));
                }
                returnValue.RecordsCount = Convert.ToInt32(_cmdGetSysRoleUserCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadSysRoleUser.Dispose();
                _cmdLoadSysRoleUser = null;
                _cmdGetSysRoleUserCount.Dispose();
                _cmdGetSysRoleUserCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemple #14
0
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>
        public PageEntity <MarketingVisit> Search(Int32 ChanceId, int pageIndex, int pageSize)
        {
            PageEntity <MarketingVisit> returnValue = new PageEntity <MarketingVisit>();
            MySqlConnection             oc          = ConnectManager.Create();
            MySqlCommand _cmdLoadMarketingVisit     = cmdLoadMarketingVisit.Clone() as MySqlCommand;
            MySqlCommand _cmdGetMarketingVisitCount = cmdGetMarketingVisitCount.Clone() as MySqlCommand;

            _cmdLoadMarketingVisit.Connection     = oc;
            _cmdGetMarketingVisitCount.Connection = oc;

            try
            {
                _cmdLoadMarketingVisit.Parameters["@PageIndex"].Value = pageIndex;
                _cmdLoadMarketingVisit.Parameters["@PageSize"].Value  = pageSize;
                _cmdLoadMarketingVisit.Parameters["@ChanceId"].Value  = ChanceId;

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

                MySqlDataReader reader = _cmdLoadMarketingVisit.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new MarketingVisit().BuildSampleEntity(reader));
                }
                reader.Close();
                _cmdGetMarketingVisitCount.Parameters["@ChanceId"].Value = ChanceId;
                returnValue.RecordsCount = Convert.ToInt32(_cmdGetMarketingVisitCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadMarketingVisit.Dispose();
                _cmdLoadMarketingVisit = null;
                _cmdGetMarketingVisitCount.Dispose();
                _cmdGetMarketingVisitCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
        /// <summary>
        /// 修改指定的数据
        /// <param name="e">修改后的数据实体对象</param>
        /// <para>数据对应的主键必须在实例中设置</para>
        /// </summary>
        public void Update(SysUser e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdUpdateSysUser = cmdUpdateSysUser.Clone() as MySqlCommand;

            _cmdUpdateSysUser.Connection = oc;

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

                _cmdUpdateSysUser.Parameters["@UserId"].Value      = e.UserId;
                _cmdUpdateSysUser.Parameters["@UserName"].Value    = e.UserName;
                _cmdUpdateSysUser.Parameters["@UserAccount"].Value = e.UserAccount;
                _cmdUpdateSysUser.Parameters["@Pwd"].Value         = e.Pwd;
                _cmdUpdateSysUser.Parameters["@Mobile"].Value      = e.Mobile;
                _cmdUpdateSysUser.Parameters["@Email"].Value       = e.Email;
                _cmdUpdateSysUser.Parameters["@CreateTime"].Value  = e.CreateTime;
                _cmdUpdateSysUser.Parameters["@EndTime"].Value     = e.EndTime;
                _cmdUpdateSysUser.Parameters["@EntAdminId"].Value  = e.EntAdminId;
                _cmdUpdateSysUser.Parameters["@IsEnable"].Value    = e.IsEnable;
                _cmdUpdateSysUser.Parameters["@Type"].Value        = e.Type;
                _cmdUpdateSysUser.Parameters["@EntId"].Value       = e.EntId;
                _cmdUpdateSysUser.Parameters["@Sex"].Value         = e.Sex;
                _cmdUpdateSysUser.Parameters["@Birthday"].Value    = e.Birthday;
                _cmdUpdateSysUser.Parameters["@PicId"].Value       = e.PicId;
                _cmdUpdateSysUser.Parameters["@EntCode"].Value     = e.EntCode;

                _cmdUpdateSysUser.ExecuteNonQuery();
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdUpdateSysUser.Dispose();
                _cmdUpdateSysUser = null;
                GC.Collect();
            }
        }
        /// <summary>
        /// 添加数据
        /// <param name="es">数据实体对象数组</param>
        /// <returns></returns>
        /// </summary>
        public int Insert(SysUser e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdInsertSysUser = cmdInsertSysUser.Clone() as MySqlCommand;
            int             returnValue       = 0;

            _cmdInsertSysUser.Connection = oc;
            try
            {
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }
                _cmdInsertSysUser.Parameters["@UserName"].Value    = e.UserName;
                _cmdInsertSysUser.Parameters["@UserAccount"].Value = e.UserAccount;
                _cmdInsertSysUser.Parameters["@Pwd"].Value         = e.Pwd;
                _cmdInsertSysUser.Parameters["@Mobile"].Value      = e.Mobile;
                _cmdInsertSysUser.Parameters["@Email"].Value       = e.Email;
                _cmdInsertSysUser.Parameters["@CreateTime"].Value  = e.CreateTime;
                _cmdInsertSysUser.Parameters["@EndTime"].Value     = e.EndTime;
                _cmdInsertSysUser.Parameters["@EntAdminId"].Value  = e.EntAdminId;
                _cmdInsertSysUser.Parameters["@IsEnable"].Value    = e.IsEnable;
                _cmdInsertSysUser.Parameters["@Type"].Value        = e.Type;
                _cmdInsertSysUser.Parameters["@EntId"].Value       = e.EntId;
                _cmdInsertSysUser.Parameters["@Birthday"].Value    = e.Birthday;
                _cmdInsertSysUser.Parameters["@Sex"].Value         = e.Sex;
                _cmdInsertSysUser.Parameters["@PicId"].Value       = e.PicId;
                _cmdInsertSysUser.Parameters["@EntCode"].Value     = e.EntCode;

                _cmdInsertSysUser.ExecuteNonQuery();
                returnValue = Convert.ToInt32(_cmdInsertSysUser.LastInsertedId);
                return(returnValue);
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdInsertSysUser.Dispose();
                _cmdInsertSysUser = null;
            }
        }
Exemple #17
0
        /// <summary>
        /// 添加数据
        /// <param name="es">数据实体对象数组</param>
        /// <returns></returns>
        /// </summary>
        public int Insert(CustomerPrivate e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdInsertCustomerPrivate = cmdInsertCustomerPrivate.Clone() as MySqlCommand;
            int             returnValue = 0;

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

                _cmdInsertCustomerPrivate.Parameters["@Name"].Value     = e.Name;
                _cmdInsertCustomerPrivate.Parameters["@Sex"].Value      = e.Sex;
                _cmdInsertCustomerPrivate.Parameters["@Birthday"].Value = e.Birthday;
                _cmdInsertCustomerPrivate.Parameters["@Industy"].Value  = e.Industy;
                _cmdInsertCustomerPrivate.Parameters["@Mobile"].Value   = e.Mobile;
                _cmdInsertCustomerPrivate.Parameters["@Email"].Value    = e.Email;
                _cmdInsertCustomerPrivate.Parameters["@Qq"].Value       = e.Qq;
                _cmdInsertCustomerPrivate.Parameters["@Phone"].Value    = e.Phone;
                _cmdInsertCustomerPrivate.Parameters["@Address"].Value  = e.Address;
                _cmdInsertCustomerPrivate.Parameters["@Detail"].Value   = e.Detail;
                _cmdInsertCustomerPrivate.Parameters["@EntId"].Value    = e.EntId;
                _cmdInsertCustomerPrivate.Parameters["@OwnerId"].Value  = e.OwnerId;

                _cmdInsertCustomerPrivate.ExecuteNonQuery();
                returnValue = Convert.ToInt32(_cmdInsertCustomerPrivate.LastInsertedId);
                return(returnValue);
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdInsertCustomerPrivate.Dispose();
                _cmdInsertCustomerPrivate = null;
            }
        }
        /// <summary>
        /// 修改指定的数据
        /// <param name="e">修改后的数据实体对象</param>
        /// <para>数据对应的主键必须在实例中设置</para>
        /// </summary>
        public void Update(MarketingChance e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdUpdateMarketingChance = cmdUpdateMarketingChance.Clone() as MySqlCommand;

            _cmdUpdateMarketingChance.Connection = oc;

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

                _cmdUpdateMarketingChance.Parameters["@IdmarketingChance"].Value = e.IdmarketingChance;
                _cmdUpdateMarketingChance.Parameters["@ChanceType"].Value        = e.ChanceType;
                _cmdUpdateMarketingChance.Parameters["@CustomerType"].Value      = e.CustomerType;
                _cmdUpdateMarketingChance.Parameters["@ContactName"].Value       = e.ContactName;
                _cmdUpdateMarketingChance.Parameters["@Remark"].Value            = e.Remark;
                _cmdUpdateMarketingChance.Parameters["@AddTime"].Value           = e.AddTime;
                _cmdUpdateMarketingChance.Parameters["@Qq"].Value     = e.Qq;
                _cmdUpdateMarketingChance.Parameters["@Email"].Value  = e.Email;
                _cmdUpdateMarketingChance.Parameters["@Tel"].Value    = e.Tel;
                _cmdUpdateMarketingChance.Parameters["@Phone"].Value  = e.Phone;
                _cmdUpdateMarketingChance.Parameters["@Rate"].Value   = e.Rate;
                _cmdUpdateMarketingChance.Parameters["@EntId"].Value  = e.EntId;
                _cmdUpdateMarketingChance.Parameters["@UserId"].Value = e.UserId;

                _cmdUpdateMarketingChance.ExecuteNonQuery();
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdUpdateMarketingChance.Dispose();
                _cmdUpdateMarketingChance = null;
                GC.Collect();
            }
        }
Exemple #19
0
        /// <summary>
        /// 修改指定的数据
        /// <param name="e">修改后的数据实体对象</param>
        /// <para>数据对应的主键必须在实例中设置</para>
        /// </summary>
        public void Update(CustomerPrivate e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdUpdateCustomerPrivate = cmdUpdateCustomerPrivate.Clone() as MySqlCommand;

            _cmdUpdateCustomerPrivate.Connection = oc;

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

                _cmdUpdateCustomerPrivate.Parameters["@CustomerPrivateId"].Value = e.CustomerPrivateId;
                _cmdUpdateCustomerPrivate.Parameters["@Name"].Value     = e.Name;
                _cmdUpdateCustomerPrivate.Parameters["@Sex"].Value      = e.Sex;
                _cmdUpdateCustomerPrivate.Parameters["@Birthday"].Value = e.Birthday;
                _cmdUpdateCustomerPrivate.Parameters["@Industy"].Value  = e.Industy;
                _cmdUpdateCustomerPrivate.Parameters["@Mobile"].Value   = e.Mobile;
                _cmdUpdateCustomerPrivate.Parameters["@Email"].Value    = e.Email;
                _cmdUpdateCustomerPrivate.Parameters["@Qq"].Value       = e.Qq;
                _cmdUpdateCustomerPrivate.Parameters["@Phone"].Value    = e.Phone;
                _cmdUpdateCustomerPrivate.Parameters["@Address"].Value  = e.Address;
                _cmdUpdateCustomerPrivate.Parameters["@Detail"].Value   = e.Detail;
                _cmdUpdateCustomerPrivate.Parameters["@EntId"].Value    = e.EntId;
                _cmdUpdateCustomerPrivate.Parameters["@OwnerId"].Value  = e.OwnerId;

                _cmdUpdateCustomerPrivate.ExecuteNonQuery();
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdUpdateCustomerPrivate.Dispose();
                _cmdUpdateCustomerPrivate = null;
                GC.Collect();
            }
        }
        /// <summary>
        /// 修改指定的数据
        /// <param name="e">修改后的数据实体对象</param>
        /// <para>数据对应的主键必须在实例中设置</para>
        /// </summary>
        public void Update(ContractInfo e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdUpdateContractInfo = cmdUpdateContractInfo.Clone() as MySqlCommand;

            _cmdUpdateContractInfo.Connection = oc;

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

                _cmdUpdateContractInfo.Parameters["@ContractInfoId"].Value = e.ContractInfoId;
                _cmdUpdateContractInfo.Parameters["@ContractNo"].Value     = e.ContractNo;
                _cmdUpdateContractInfo.Parameters["@CName"].Value          = e.CName;
                _cmdUpdateContractInfo.Parameters["@CustomerName"].Value   = e.CustomerName;
                _cmdUpdateContractInfo.Parameters["@StartTime"].Value      = e.StartTime;
                _cmdUpdateContractInfo.Parameters["@EndTime"].Value        = e.EndTime;
                _cmdUpdateContractInfo.Parameters["@OwnerId"].Value        = e.OwnerId;
                _cmdUpdateContractInfo.Parameters["@ContractTime"].Value   = e.ContractTime;
                _cmdUpdateContractInfo.Parameters["@Amount"].Value         = e.Amount;
                _cmdUpdateContractInfo.Parameters["@Howtopay"].Value       = e.Howtopay;
                _cmdUpdateContractInfo.Parameters["@EntId"].Value          = e.EntId;
                _cmdUpdateContractInfo.Parameters["@ChanceId"].Value       = e.ChanceId;

                _cmdUpdateContractInfo.ExecuteNonQuery();
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdUpdateContractInfo.Dispose();
                _cmdUpdateContractInfo = null;
                GC.Collect();
            }
        }
        /// <summary>
        /// 添加数据
        /// <param name="es">数据实体对象数组</param>
        /// <returns></returns>
        /// </summary>
        public int Insert(MarketingChance e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdInsertMarketingChance = cmdInsertMarketingChance.Clone() as MySqlCommand;
            int             returnValue = 0;

            _cmdInsertMarketingChance.Connection = oc;
            try
            {
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }
                _cmdInsertMarketingChance.Parameters["@ChanceType"].Value   = e.ChanceType;
                _cmdInsertMarketingChance.Parameters["@CustomerType"].Value = e.CustomerType;
                _cmdInsertMarketingChance.Parameters["@ContactName"].Value  = e.ContactName;
                _cmdInsertMarketingChance.Parameters["@Remark"].Value       = e.Remark;
                _cmdInsertMarketingChance.Parameters["@AddTime"].Value      = e.AddTime;
                _cmdInsertMarketingChance.Parameters["@Qq"].Value           = e.Qq;
                _cmdInsertMarketingChance.Parameters["@Email"].Value        = e.Email;
                _cmdInsertMarketingChance.Parameters["@Tel"].Value          = e.Tel;
                _cmdInsertMarketingChance.Parameters["@Phone"].Value        = e.Phone;
                _cmdInsertMarketingChance.Parameters["@Rate"].Value         = e.Rate;
                _cmdInsertMarketingChance.Parameters["@EntId"].Value        = e.EntId;
                _cmdInsertMarketingChance.Parameters["@UserId"].Value       = e.UserId;

                _cmdInsertMarketingChance.ExecuteNonQuery();
                returnValue = Convert.ToInt32(_cmdInsertMarketingChance.LastInsertedId);
                return(returnValue);
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdInsertMarketingChance.Dispose();
                _cmdInsertMarketingChance = null;
            }
        }
Exemple #22
0
        /// <summary>
        /// 修改指定的数据
        /// <param name="e">修改后的数据实体对象</param>
        /// <para>数据对应的主键必须在实例中设置</para>
        /// </summary>
        public void Update(CustomerEnt e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdUpdateCustomerEnt = cmdUpdateCustomerEnt.Clone() as MySqlCommand;

            _cmdUpdateCustomerEnt.Connection = oc;

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

                _cmdUpdateCustomerEnt.Parameters["@CustomerEntId"].Value   = e.CustomerEntId;
                _cmdUpdateCustomerEnt.Parameters["@EntName"].Value         = e.EntName;
                _cmdUpdateCustomerEnt.Parameters["@Industy"].Value         = e.Industy;
                _cmdUpdateCustomerEnt.Parameters["@ContactUsername"].Value = e.ContactUsername;
                _cmdUpdateCustomerEnt.Parameters["@ContactMobile"].Value   = e.ContactMobile;
                _cmdUpdateCustomerEnt.Parameters["@ContactPhone"].Value    = e.ContactPhone;
                _cmdUpdateCustomerEnt.Parameters["@ContactEmail"].Value    = e.ContactEmail;
                _cmdUpdateCustomerEnt.Parameters["@ContactQq"].Value       = e.ContactQq;
                _cmdUpdateCustomerEnt.Parameters["@Address"].Value         = e.Address;
                _cmdUpdateCustomerEnt.Parameters["@Detail"].Value          = e.Detail;
                _cmdUpdateCustomerEnt.Parameters["@EntId"].Value           = e.EntId;
                _cmdUpdateCustomerEnt.Parameters["@OwnerId"].Value         = e.OwnerId;

                _cmdUpdateCustomerEnt.ExecuteNonQuery();
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdUpdateCustomerEnt.Dispose();
                _cmdUpdateCustomerEnt = null;
                GC.Collect();
            }
        }
Exemple #23
0
        /// <summary>
        /// 添加数据
        /// <param name="es">数据实体对象数组</param>
        /// <returns></returns>
        /// </summary>
        public int Insert(CustomerEnt e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdInsertCustomerEnt = cmdInsertCustomerEnt.Clone() as MySqlCommand;
            int             returnValue           = 0;

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

                _cmdInsertCustomerEnt.Parameters["@EntName"].Value         = e.EntName;
                _cmdInsertCustomerEnt.Parameters["@Industy"].Value         = e.Industy;
                _cmdInsertCustomerEnt.Parameters["@ContactUsername"].Value = e.ContactUsername;
                _cmdInsertCustomerEnt.Parameters["@ContactMobile"].Value   = e.ContactMobile;
                _cmdInsertCustomerEnt.Parameters["@ContactPhone"].Value    = e.ContactPhone;
                _cmdInsertCustomerEnt.Parameters["@ContactEmail"].Value    = e.ContactEmail;
                _cmdInsertCustomerEnt.Parameters["@ContactQq"].Value       = e.ContactQq;
                _cmdInsertCustomerEnt.Parameters["@Address"].Value         = e.Address;
                _cmdInsertCustomerEnt.Parameters["@Detail"].Value          = e.Detail;
                _cmdInsertCustomerEnt.Parameters["@EntId"].Value           = e.EntId;
                _cmdInsertCustomerEnt.Parameters["@OwnerId"].Value         = e.OwnerId;

                _cmdInsertCustomerEnt.ExecuteNonQuery();
                returnValue = Convert.ToInt32(_cmdInsertCustomerEnt.LastInsertedId);
                return(returnValue);
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdInsertCustomerEnt.Dispose();
                _cmdInsertCustomerEnt = null;
            }
        }
        /// <summary>
        /// 获取指定记录
        /// <param name="id">Id值</param>
        /// </summary>
        public ProProduction Get(int PId)
        {
            ProProduction   returnValue          = null;
            MySqlConnection oc                   = ConnectManager.Create();
            MySqlCommand    _cmdGetProProduction = cmdGetProProduction.Clone() as MySqlCommand;

            _cmdGetProProduction.Connection = oc;
            try
            {
                _cmdGetProProduction.Parameters["@PId"].Value = PId;

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

                MySqlDataReader reader = _cmdGetProProduction.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    returnValue = new ProProduction().BuildSampleEntity(reader);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdGetProProduction.Dispose();
                _cmdGetProProduction = null;
                GC.Collect();
            }
            return(returnValue);
        }
        /// <summary>
        /// 添加数据
        /// <param name="es">数据实体对象数组</param>
        /// <returns></returns>
        /// </summary>
        public int Insert(ContractInfo e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdInsertContractInfo = cmdInsertContractInfo.Clone() as MySqlCommand;
            int             returnValue            = 0;

            _cmdInsertContractInfo.Connection = oc;
            try
            {
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }
                _cmdInsertContractInfo.Parameters["@ContractNo"].Value   = e.ContractNo;
                _cmdInsertContractInfo.Parameters["@CName"].Value        = e.CName;
                _cmdInsertContractInfo.Parameters["@CustomerName"].Value = e.CustomerName;
                _cmdInsertContractInfo.Parameters["@StartTime"].Value    = e.StartTime;
                _cmdInsertContractInfo.Parameters["@EndTime"].Value      = e.EndTime;
                _cmdInsertContractInfo.Parameters["@OwnerId"].Value      = e.OwnerId;
                _cmdInsertContractInfo.Parameters["@ContractTime"].Value = e.ContractTime;
                _cmdInsertContractInfo.Parameters["@Amount"].Value       = e.Amount;
                _cmdInsertContractInfo.Parameters["@Howtopay"].Value     = e.Howtopay;
                _cmdInsertContractInfo.Parameters["@EntId"].Value        = e.EntId;
                _cmdInsertContractInfo.Parameters["@ChanceId"].Value     = e.ChanceId;

                _cmdInsertContractInfo.ExecuteNonQuery();
                returnValue = Convert.ToInt32(_cmdInsertContractInfo.LastInsertedId);
                return(returnValue);
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdInsertContractInfo.Dispose();
                _cmdInsertContractInfo = null;
            }
        }
Exemple #26
0
        /// <summary>
        /// 添加数据
        /// <param name="es">数据实体对象数组</param>
        /// <returns></returns>
        /// </summary>
        public int Insert(ProProductonDetail e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdInsertProProductonDetail = cmdInsertProProductonDetail.Clone() as MySqlCommand;
            int             returnValue = 0;

            _cmdInsertProProductonDetail.Connection = oc;
            try
            {
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }
                _cmdInsertProProductonDetail.Parameters["@Price"].Value      = e.Price;
                _cmdInsertProProductonDetail.Parameters["@PNum"].Value       = e.PNum;
                _cmdInsertProProductonDetail.Parameters["@PCode"].Value      = e.PCode;
                _cmdInsertProProductonDetail.Parameters["@CreateTime"].Value = e.CreateTime;
                _cmdInsertProProductonDetail.Parameters["@UserId"].Value     = e.UserId;
                _cmdInsertProProductonDetail.Parameters["@PId"].Value        = e.PId;
                _cmdInsertProProductonDetail.Parameters["@EntId"].Value      = e.EntId;
                _cmdInsertProProductonDetail.Parameters["@IsPay"].Value      = e.IsPay;


                _cmdInsertProProductonDetail.ExecuteNonQuery();
                returnValue = Convert.ToInt32(_cmdInsertProProductonDetail.LastInsertedId);
                return(returnValue);
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdInsertProProductonDetail.Dispose();
                _cmdInsertProProductonDetail = null;
            }
        }
Exemple #27
0
        /// <summary>
        /// 修改指定的数据
        /// <param name="e">修改后的数据实体对象</param>
        /// <para>数据对应的主键必须在实例中设置</para>
        /// </summary>
        public void Update(ProProductonDetail e)
        {
            MySqlConnection oc = ConnectManager.Create();
            MySqlCommand    _cmdUpdateProProductonDetail = cmdUpdateProProductonDetail.Clone() as MySqlCommand;

            _cmdUpdateProProductonDetail.Connection = oc;

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

                _cmdUpdateProProductonDetail.Parameters["@PDId"].Value       = e.PDId;
                _cmdUpdateProProductonDetail.Parameters["@Price"].Value      = e.Price;
                _cmdUpdateProProductonDetail.Parameters["@PNum"].Value       = e.PNum;
                _cmdUpdateProProductonDetail.Parameters["@PCode"].Value      = e.PCode;
                _cmdUpdateProProductonDetail.Parameters["@CreateTime"].Value = e.CreateTime;
                _cmdUpdateProProductonDetail.Parameters["@UserId"].Value     = e.UserId;
                _cmdUpdateProProductonDetail.Parameters["@PId"].Value        = e.PId;
                _cmdUpdateProProductonDetail.Parameters["@EntId"].Value      = e.EntId;
                _cmdUpdateProProductonDetail.Parameters["@IsPay"].Value      = e.IsPay;

                _cmdUpdateProProductonDetail.ExecuteNonQuery();
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdUpdateProProductonDetail.Dispose();
                _cmdUpdateProProductonDetail = null;
                GC.Collect();
            }
        }
        /// <summary>
        /// 获取销售机会数量
        /// </summary>
        /// <param name="IsVisit"></param>
        /// <returns></returns>
        public int GetMarketingChanceCount(UserType userType, int sId, int IsVisit)
        {
            int             returnValue = 0;
            MySqlConnection oc          = ConnectManager.Create();
            MySqlCommand    _cmdGetMarketingChanceCount = cmdGetMarketingChanceCount.Clone() as MySqlCommand;

            _cmdGetMarketingChanceCount.Connection = oc;

            try
            {
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }
                _cmdGetMarketingChanceCount.Parameters["@IsVisit"].Value = IsVisit;
                if (userType == UserType.User)
                {
                    _cmdGetMarketingChanceCount.CommandText = string.Format(_cmdGetMarketingChanceCount.CommandText, " user_id =  " + sId);
                }
                else
                {
                    _cmdGetMarketingChanceCount.CommandText = string.Format(_cmdGetMarketingChanceCount.CommandText, " ent_id = " + sId);
                }
                returnValue = Convert.ToInt32(_cmdGetMarketingChanceCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdGetMarketingChanceCount.Dispose();
                _cmdGetMarketingChanceCount = null;
                GC.Collect();
            }
            return(returnValue);
        }
Exemple #29
0
 protected MySqlConnection Create()
 {
     return(ConnectManager.Create());
 }
        /// <summary>
        /// 根据条件分页获取指定数据
        /// <param name="pageIndex">当前页</param>
        /// <para>索引从0开始</para>
        /// <param name="pageSize">每页记录条数</param>
        /// <para>记录数必须大于0</para>
        /// </summary>Int32 ContractInfoId, String ContractNo, String CName, Int32 CustomerName, DateTime StartTime, DateTime EndTime, Int32 OwnerId, DateTime ContractTime, Decimal Amount, Int32 Howtopay, Int32 HowtopayId,
        public PageEntity <ContractInfo> Search(UserType userType, Int32 sId, int pageIndex, int pageSize)
        {
            PageEntity <ContractInfo> returnValue = new PageEntity <ContractInfo>();
            MySqlConnection           oc          = ConnectManager.Create();
            MySqlCommand _cmdLoadContractInfo     = cmdLoadContractInfo.Clone() as MySqlCommand;
            MySqlCommand _cmdGetContractInfoCount = cmdGetContractInfoCount.Clone() as MySqlCommand;

            _cmdLoadContractInfo.Connection     = oc;
            _cmdGetContractInfoCount.Connection = oc;

            try
            {
                _cmdLoadContractInfo.Parameters["@PageIndex"].Value = pageIndex;
                _cmdLoadContractInfo.Parameters["@PageSize"].Value  = pageSize;
                //_cmdLoadContractInfo.Parameters["@ContractInfoId"].Value = ContractInfoId;
                //_cmdLoadContractInfo.Parameters["@ContractNo"].Value = ContractNo;
                //_cmdLoadContractInfo.Parameters["@CName"].Value = CName;
                //_cmdLoadContractInfo.Parameters["@CustomerName"].Value = CustomerName;
                //_cmdLoadContractInfo.Parameters["@StartTime"].Value = StartTime;
                //_cmdLoadContractInfo.Parameters["@EndTime"].Value = EndTime;
                //_cmdLoadContractInfo.Parameters["@OwnerId"].Value = OwnerId;
                //_cmdLoadContractInfo.Parameters["@ContractTime"].Value = ContractTime;
                //_cmdLoadContractInfo.Parameters["@Amount"].Value = Amount;
                //_cmdLoadContractInfo.Parameters["@Howtopay"].Value = Howtopay;
                //_cmdLoadContractInfo.Parameters["@HowtopayId"].Value = HowtopayId;
                // _cmdLoadContractInfo.Parameters["@EntId"].Value = EntId;
                if (userType == UserType.User)
                {
                    _cmdLoadContractInfo.CommandText     = string.Format(_cmdLoadContractInfo.CommandText, " owner_id =  " + sId);
                    _cmdGetContractInfoCount.CommandText = string.Format(_cmdGetContractInfoCount.CommandText, " owner_id =  " + sId);
                }
                else
                {
                    _cmdLoadContractInfo.CommandText     = string.Format(_cmdLoadContractInfo.CommandText, " ent_id = " + sId);
                    _cmdGetContractInfoCount.CommandText = string.Format(_cmdGetContractInfoCount.CommandText, " ent_id = " + sId);
                }
                if (oc.State == ConnectionState.Closed)
                {
                    oc.Open();
                }

                MySqlDataReader reader = _cmdLoadContractInfo.ExecuteReader();
                while (reader.Read())
                {
                    returnValue.Items.Add(new ContractInfo().BuildSampleEntity(reader));
                }
                reader.Close();
                // _cmdGetContractInfoCount.Parameters["@EntId"].Value = EntId;
                returnValue.RecordsCount = Convert.ToInt32(_cmdGetContractInfoCount.ExecuteScalar());
            }
            finally
            {
                oc.Close();
                oc.Dispose();
                oc = null;
                _cmdLoadContractInfo.Dispose();
                _cmdLoadContractInfo = null;
                _cmdGetContractInfoCount.Dispose();
                _cmdGetContractInfoCount = null;
                GC.Collect();
            }
            return(returnValue);
        }