public static Result GetInfoById(string userId)
    {
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        var        result     = new Result <Figure>();
        //此处需优化,参数化处理
        var sqltextFomat = "select * from [clothes].[dbo].[figure] where userId={0}";
        var dt           = dbhelperv2.ExecuteDataTable(string.Format(sqltextFomat, userId));

        if (dt == null || dt.Rows.Count == 0)
        {
            //Error todo
            result.Code = 403;
            //result.Message = "查无此人!";
            result.IsTrue = false;
            result.Data   = new Figure();
            return(result);
        }
        var figures = dt.ToFigures();

        result.Code    = 200;
        result.Message = "成功!";
        result.Data    = figures[0];
        result.IsTrue  = true;
        return(result);
    }
    public static Result GetInfo()
    {
        var        result     = new Result <List <Style> >();
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        //此处需优化,参数化处理
        var sqltextFomat = "select * from [clothes].[dbo].[style]";
        var dt           = dbhelperv2.ExecuteDataTable(sqltextFomat);

        if (dt == null || dt.Rows.Count == 0)
        {
            //Error todo
            result.Code    = 403;
            result.Message = "查无此人!";
            //result.Message = "查无此人!";
            result.IsTrue = false;
            result.Data   = new List <Style>();
            return(result);
        }
        var dts = dt.ToStyles();

        result.Code    = 200;
        result.Message = "成功!";
        result.Data    = dts;
        result.IsTrue  = true;
        return(result);
    }
Пример #3
0
    public static Result getClothByIds(string ids)
    {
        var result = new Result <List <Cloth> >();
        //此处需优化,参数化处理
        var        sqltextFomat = "SELECT a.*, b.type from [clothes].[dbo].[cloth] as a, [clothes].[dbo].[clothType] as b where a.id in ({0}) and a.clothTypeId = b.id";
        DbHelperV2 dbhelperv2   = new DbHelperV2();
        var        dt           = dbhelperv2.ExecuteDataTable(string.Format(sqltextFomat, ids));
        var        dts          = dt.ToCloths();

        result.Code    = 200;
        result.Message = "成功!";
        result.Data    = dts;
        result.IsTrue  = true;
        return(result);
    }
    public static Result AddStyleType(string sName, string describe)
    {
        var result = new Result();
        //此处需优化,参数化处理
        var        sqltextFomat = "insert into [clothes].[dbo].[style] (sName,describe) values ('{0}','{1}') ";
        var        sqlText      = string.Format(sqltextFomat, sName, describe);
        DbHelperV2 dbhelperv2   = new DbHelperV2();

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
Пример #5
0
    public static Result EditClothType(string type, int id)
    {
        var        result     = new Result();
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        //此处需优化,参数化处理
        var sqltextFomat = "update [clothes].[dbo].[ClothType] set type='{0}' where id={1} ";
        var sqlText      = string.Format(sqltextFomat, type, id);

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
    public static Result EditFigure(int userId, string weight, string stature, string chestSize, string waistSize, string hiplineSize, int id)
    {
        var        result     = new Result();
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        //此处需优化,参数化处理
        var sqltextFomat = "update [clothes].[dbo].[figure] set userId='{0}',weight='{1}',stature='{2}',chestSize='{3}',waistSize='{4}',hiplineSize='{5}' where id={6} ";
        var sqlText      = string.Format(sqltextFomat, userId, weight, stature, chestSize, waistSize, hiplineSize, id);

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
    public static Result AddFigure(string userId, string weight, string stature, string chestSize, string waistSize, string hiplineSize)
    {
        var        result     = new Result();
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        //此处需优化,参数化处理
        var sqltextFomat = "insert into [clothes].[dbo].[figure] (userId,weight,stature,chestSize,waistSize,hiplineSize) values ('{0}','{1}','{2}','{3}','{4}','{5}') ";
        var sqlText      = string.Format(sqltextFomat, userId, weight, stature, chestSize, waistSize, hiplineSize);

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
    public static Result EditStyleType(int id, string sName, string describe)
    {
        var result = new Result();
        //此处需优化,参数化处理
        var        sqltextFomat = "update [clothes].[dbo].[style] set sName='{0}',describe='{1}' where id={2} ";
        var        sqlText      = string.Format(sqltextFomat, sName, describe, id);
        DbHelperV2 dbhelperv2   = new DbHelperV2();

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
    public static Result AddChuanDa(string userId, string name, string styleId, string clothIds, string describe, string createTime, string endTime)
    {
        var        result     = new Result();
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        //此处需优化,参数化处理
        var sqltextFomat = "insert into [clothes].[dbo].[chuanda] (userId,name,styleId,clothIds,describe,createTime,endTime) values ('{0}','{1}','{2}','{3}','{4}','{5}', '{6}') ";
        var sqlText      = string.Format(sqltextFomat, userId, name, styleId, clothIds, describe, createTime, endTime);

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
Пример #10
0
    public static Result DeleteClothById(int id)
    {
        var        result     = new Result();
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        //此处需优化,参数化处理
        var sqltextFomat = "delete from [clothes].[dbo].[cloth] where id={0} ";
        var sqlText      = string.Format(sqltextFomat, id);

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
Пример #11
0
    public static Result EditCloth(Cloth model, int id)
    {
        var        result     = new Result();
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        //此处需优化,参数化处理
        var sqltextFomat = "update [clothes].[dbo].[cloth]  set  userId='{0}',clothTypeId='{1}',clothName='{2}',price='{3}',brand='{4}',fabric='{5}',season='{6}',size='{7}',color='{8}',imgUrl='{9}',createTime='{10}',endTime='{11}' where id={12}  ";
        var sqlText      = string.Format(sqltextFomat, model.userId, model.clothTypeId, model.clothName, model.price, model.brand, model.fabric, model.season, model.size, model.color, model.imgUrl, model.createTime, model.endTime, id);

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
Пример #12
0
    public static Result AddCloth(Cloth model)
    {
        var        result     = new Result();
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        //此处需优化,参数化处理
        var sqltextFomat = "insert into [clothes].[dbo].[cloth] (userId,clothTypeId,clothName,price,brand,fabric,season,size,color,imgUrl,createTime,endTime) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}') ";
        var sqlText      = string.Format(sqltextFomat, model.userId, model.clothTypeId, model.clothName, model.price, model.brand, model.fabric, model.season, model.size, model.color, model.imgUrl, model.createTime, model.endTime);

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
Пример #13
0
    public static Result GetInfoByTypeOrName(string typeid, string name, string userId, string id)
    {
        var result   = new Result <List <Cloth> >();
        var whereexp = "a.clothTypeId = b.id";

        if (!string.IsNullOrEmpty(userId))
        {
            whereexp = whereexp + " and a.userId=" + userId;
        }

        if (!string.IsNullOrEmpty(id))
        {
            whereexp = whereexp + " and a.id=" + id;
        }

        if (typeid != "")
        {
            whereexp = whereexp + " and clothTypeId=" + typeid;
        }
        if (!string.IsNullOrEmpty(name))
        {
            whereexp = whereexp + " and clothName LIKE '%" + name + "%'";
        }

        //此处需优化,参数化处理
        var        sqltextFomat = "select a.*, b.type from [clothes].[dbo].[cloth] as a, [clothes].[dbo].[clothType] as b where {0}";
        DbHelperV2 dbhelperv2   = new DbHelperV2();
        var        dt           = dbhelperv2.ExecuteDataTable(string.Format(sqltextFomat, whereexp));

        if (dt == null || dt.Rows.Count == 0)
        {
            //Error todo
            result.Code    = 200;
            result.Message = "查无此人!";
            result.IsTrue  = false;
            result.Data    = new List <Cloth>();
            return(result);
        }
        var dts = dt.ToCloths();

        result.Code    = 200;
        result.Message = "成功!";
        result.Data    = dts;
        result.IsTrue  = true;
        return(result);
    }
    public static Result EditChuanDa(string id, string userId, string name, string styleId, string clothIds, string describe, string createTime, string endTime)
    {
        var        intid      = Convert.ToInt32(id);
        var        result     = new Result();
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        //此处需优化,参数化处理
        var sqltextFomat = "update [clothes].[dbo].[chuanda] set name='{0}',styleId='{1}',clothIds='{2}',describe='{3}',createTime='{4}',endTime='{5}', userId='{6}' where id={7}  ";
        var sqlText      = string.Format(sqltextFomat, name, styleId, clothIds, describe, createTime, endTime, userId, intid);

        dbhelperv2.ExecuteNonQuery(new List <string> {
            sqlText
        });
        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
Пример #15
0
    public Result Thumb_up_delete(int id)
    {
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        var        result     = new Result <List <Link> >();
        //此处需优化,参数化处理
        var sqltextFomat = "delete from [clothes].[dbo].[link] where id='{0}'";
        var dt           = dbhelperv2.ExecuteDataTable(string.Format(sqltextFomat, id));

        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
Пример #16
0
    public Result Thumb_insert(int userId, int clothId)
    {
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        var        result     = new Result <List <Link> >();
        //此处需优化,参数化处理
        var sqltextFomat = "insert into [clothes].[dbo].[link] (userId, clothId) values ('{0}', '{1}') ";

        dbhelperv2.ExecuteDataTable(string.Format(sqltextFomat, userId, clothId));

        result.Code    = 200;
        result.Message = "成功!";
        result.IsTrue  = true;
        return(result);
    }
    public static Result GetInfoByTypeOrName(string styeid, string name, string userId)
    {
        DbHelperV2 dbhelperv2 = new DbHelperV2();
        var        result     = new Result <List <Chuanda> >();
        var        whereexp   = " userId=" + userId;

        if (!string.IsNullOrEmpty(styeid))
        {
            whereexp = whereexp + " and styleId=" + styeid;
        }
        if (!string.IsNullOrEmpty(name))
        {
            whereexp = whereexp + " and name LIKE '%" + name + "%'";
        }

        //此处需优化,参数化处理
        var sqltextFomat = @"SELECT TOP 1000 cd.[id]
                                ,[styleId]
                                ,[clothIds]
                                ,cd.[describe]
                                ,[userId]
                                ,[createTime]
                                ,[endTime]
                                ,cd.[name]
	                            ,sl.sName
	                            ,sl.describe as styledescribe
                    FROM [clothes].[dbo].[chuanda] cd inner join [clothes].[dbo].[style] sl  on {0} and cd.styleId= sl.id";
        var dt           = dbhelperv2.ExecuteDataTable(string.Format(sqltextFomat, whereexp));

        var dts = dt.ToChuanDa();

        //result.Code = 200;
        //result.Message = "成功!";
        //result.Data = dts;
        //result.IsTrue = true;
        //return result;
        return(new Result <List <Chuanda> > {
            Code = 200, IsTrue = true, Message = "成功", Data = dts
        });
    }