Beispiel #1
0
        /// <summary>
        /// 用topfocrm数据库
        /// </summary>
        /// <param name="TableViewName">表名</param>
        /// <param name="Key">主键</param>
        /// <param name="SelectStr">查询字段</param>
        /// <param name="Criteria">条件</param>
        /// <param name="Sort">排序字段</param>
        /// <param name="CurrentPage">当前页</param>
        /// <param name="PageSize">页大小</param>
        /// <param name="TotalCount">总记录</param>
        /// <returns></returns>
        public DataTable GetListT(string TableViewName, string Key, string SelectStr, string Criteria, string Sort,
                                  ref long CurrentPage, long PageSize, ref long TotalCount)
        {
            DataTable dt = null;

            SqlParameter[] parameters =
            {
                new SqlParameter("@TableViewName",  SqlDbType.VarChar,  255),
                new SqlParameter("@Key",            SqlDbType.VarChar,   50),
                new SqlParameter("@SelectStr",      SqlDbType.VarChar,  500),
                new SqlParameter("@Criteria",       SqlDbType.VarChar, 8000),
                new SqlParameter("@Sort",           SqlDbType.VarChar,  255),
                new SqlParameter("@Page",           SqlDbType.BigInt),
                new SqlParameter("@CurrentPageRow", SqlDbType.BigInt),
                new SqlParameter("@TotalCount",     SqlDbType.BigInt)
            };

            parameters[0].Value     = TableViewName;
            parameters[1].Value     = Key;
            parameters[2].Value     = SelectStr;
            parameters[3].Value     = Criteria;
            parameters[4].Value     = Sort;
            parameters[5].Direction = ParameterDirection.InputOutput;
            parameters[5].Value     = CurrentPage;
            parameters[6].Value     = PageSize;
            parameters[7].Direction = ParameterDirection.InputOutput;
            //parameters[7].Value = 1;

            //DataSet ds = Tz888.DBUtility.DbHelperSQL.RunProcedure("GetDataList", parameters, "ds");
            DataSet ds = crm.RunProcedure("GetDataList", parameters, "ds");

            if (ds == null)
            {
                return(null);
            }
            dt = ds.Tables["ds"];
            if (dt != null)
            {
                if (PageSize > 0)
                {
                    TotalCount  = Convert.ToInt64(parameters[7].Value);
                    CurrentPage = Convert.ToInt64(parameters[5].Value);
                }
                else
                {
                    TotalCount = Convert.ToInt64(dt.Rows.Count);
                    if (TotalCount > 0)
                    {
                        CurrentPage = 1;
                    }
                    else
                    {
                        CurrentPage = 0;
                    }
                }
            }
            return(dt);
        }
Beispiel #2
0
        /// <summary>
        /// 品牌列表
        /// </summary>
        /// <param name="ObjectName">表/视图</param>
        /// <param name="Key">主键</param>
        /// <param name="ShowFiled">显示字段</param>
        /// <param name="Where">条件</param>
        /// <param name="OrderFiled">排序字段</param>
        /// <param name="PageCurrent">当前页</param>
        /// <param name="PageSize">页码大小</param>
        /// <param name="TotalCount">总条数</param>
        /// <returns></returns>
        public DataTable GetBrandList(string ObjectName, string Key, string ShowFiled, string Where, string OrderFiled, ref int PageCurrent, int PageSize, ref int TotalCount)
        {
            DataTable dt = null;

            SqlParameter[] parameters =
            {
                new SqlParameter("@TableViewName",  SqlDbType.VarChar,  255),
                new SqlParameter("@Key",            SqlDbType.VarChar,   50),
                new SqlParameter("@SelectStr",      SqlDbType.VarChar,  500),
                new SqlParameter("@Criteria",       SqlDbType.VarChar, 8000),
                new SqlParameter("@Sort",           SqlDbType.VarChar,  255),
                new SqlParameter("@Page",           SqlDbType.BigInt),
                new SqlParameter("@CurrentPageRow", SqlDbType.BigInt),
                new SqlParameter("@TotalCount",     SqlDbType.BigInt)
            };

            parameters[0].Value     = ObjectName;
            parameters[1].Value     = Key;
            parameters[2].Value     = ShowFiled;
            parameters[3].Value     = Where;
            parameters[4].Value     = OrderFiled;
            parameters[5].Direction = ParameterDirection.InputOutput;
            parameters[5].Value     = PageCurrent;
            parameters[6].Value     = PageSize;
            parameters[7].Direction = ParameterDirection.InputOutput;

            DataSet ds = crm.RunProcedure("GetDataList", parameters, "ds");

            if (ds == null)
            {
                return(null);
            }
            dt = ds.Tables["ds"];
            if (dt != null)
            {
                if (PageSize > 0)
                {
                    TotalCount  = Convert.ToInt32(parameters[7].Value);
                    PageCurrent = Convert.ToInt32(parameters[5].Value);
                }
                else
                {
                    TotalCount = Convert.ToInt32(dt.Rows.Count);
                    if (TotalCount > 0)
                    {
                        PageCurrent = 1;
                    }
                    else
                    {
                        PageCurrent = 0;
                    }
                }
            }
            return(dt);
        }
Beispiel #3
0
        /// <summary>
        /// 企业名片修改
        /// </summary>
        /// <param name="model"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public int Company_Update(CompanyModel model, int id)
        {
            int rowsAffected;
            int num = 0;

            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyID",      SqlDbType.Int,          4),
                new SqlParameter("@LoginName",      SqlDbType.VarChar,     50),
                new SqlParameter("@CompanyName",    SqlDbType.VarChar,    200),
                new SqlParameter("@IndustryID",     SqlDbType.Int,          4),
                new SqlParameter("@IndustryName",   SqlDbType.VarChar,     50),
                new SqlParameter("@RangeID",        SqlDbType.Int,          4),
                new SqlParameter("@RangeName",      SqlDbType.VarChar,     50),
                new SqlParameter("@NatureID",       SqlDbType.Int,          4),
                new SqlParameter("@NatureName",     SqlDbType.VarChar,     50),
                new SqlParameter("@CreateDate",     SqlDbType.DateTime),
                new SqlParameter("@Hit",            SqlDbType.Int,          4),
                new SqlParameter("@Integrity",      SqlDbType.Int,          4),
                new SqlParameter("@EstablishMent",  SqlDbType.VarChar,     50),
                new SqlParameter("@Employees",      SqlDbType.BigInt,       8),
                new SqlParameter("@Capital",        SqlDbType.BigInt,       8),
                new SqlParameter("@LinkName",       SqlDbType.VarChar,     50),
                new SqlParameter("@Email",          SqlDbType.VarChar,     50),
                new SqlParameter("@URL",            SqlDbType.VarChar,     50),
                new SqlParameter("@Address",        SqlDbType.VarChar,     50),
                new SqlParameter("@Logo",           SqlDbType.VarChar,   1000),
                new SqlParameter("@Introduction",   SqlDbType.NVarChar,  2000),
                new SqlParameter("@ServiceProce",   SqlDbType.NVarChar,  2000),
                new SqlParameter("@Title",          SqlDbType.VarChar,     50),
                new SqlParameter("@Keywords",       SqlDbType.VarChar,    100),
                new SqlParameter("@Description",    SqlDbType.VarChar,    300),
                new SqlParameter("@TelPhone",       SqlDbType.VarChar,     50),
                new SqlParameter("@Mobile",         SqlDbType.VarChar,     50),
                new SqlParameter("@AuditingStatus", SqlDbType.Int,          4),
                new SqlParameter("@HtmlFile",       SqlDbType.VarChar,    100),
                new SqlParameter("@Ismake",         SqlDbType.Int,          4),
                new SqlParameter("@IsDelete",       SqlDbType.Int,          4),
                new SqlParameter("@Provice",        SqlDbType.Int,          4),
                new SqlParameter("@City",           SqlDbType.Int, 4)
            };
            model.CompanyID      = id;
            parameters[0].Value  = model.CompanyID;
            parameters[1].Value  = model.LoginName;
            parameters[2].Value  = model.CompanyName;
            parameters[3].Value  = model.IndustryID;
            parameters[4].Value  = model.IndustryName;
            parameters[5].Value  = model.RangeID;
            parameters[6].Value  = model.RangeName;
            parameters[7].Value  = model.NatureID;
            parameters[8].Value  = model.NatureName;
            parameters[9].Value  = model.CreateDate;
            parameters[10].Value = model.Hit;
            parameters[11].Value = model.Integrity;
            parameters[12].Value = model.EstablishMent;
            parameters[13].Value = model.Employees;
            parameters[14].Value = model.Capital;
            parameters[15].Value = model.LinkName;
            parameters[16].Value = model.Email;
            parameters[17].Value = model.URL;
            parameters[18].Value = model.Address;
            parameters[19].Value = model.Logo;
            parameters[20].Value = model.Introduction;
            parameters[21].Value = model.ServiceProce;
            parameters[22].Value = model.Title;
            parameters[23].Value = model.Keywords;
            parameters[24].Value = model.Description;
            parameters[25].Value = model.Telphone;
            parameters[26].Value = model.Mobile;
            parameters[27].Value = model.Auditingstatus;
            parameters[28].Value = model.Htmlfile;
            parameters[29].Value = model.Ismake;
            parameters[30].Value = model.IsDelete;
            parameters[31].Value = model.Sheng;
            parameters[32].Value = model.City;
            num = crm.RunProcedure("Pro_Company_Update", parameters, out rowsAffected);
            return(num);
        }