Beispiel #1
0
 /// <summary>
 /// 存储过程 登录
 /// </summary>
 /// <param name="phone">电话号码</param>
 /// <param name="pwd">密码</param>
 /// <returns>0-账号不存在 1-密码错误 2-登录成功</returns>
 public static int LoginUserInfo(string phone, string pwd, string work)
 {
     SqlParameter[] paras = new SqlParameter[] {
         new SqlParameter("@phone", phone),
         new SqlParameter("@password", pwd),
         new SqlParameter("@num", SqlDbType.Int),
         new SqlParameter("@work", work)
     };
     paras[2].Direction = ParameterDirection.Output;
     DBHelper.GetDataTableByProcedure("LoginSales", paras);
     return((int)paras[2].Value);
 }
Beispiel #2
0
        /// <summary>
        /// 获取商品列表的分页数据
        /// </summary>
        /// <param name="pageSize">每页行数</param>
        /// <param name="pageIndex">第几页</param>
        /// <param name="ClassID">商品分类</param>
        /// <returns>商品数据集</returns>
        public static List <DatailsMode1> SelectProductByPaging(int pageSize, int pageIndex)
        {
            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@pagesize", pageSize),
                new SqlParameter("@pageindex", pageIndex),
            };


            DataTable           dt   = DBHelper.GetDataTableByProcedure("chaxun", paras);
            List <DatailsMode1> list = new List <DatailsMode1>();

            if (dt != null && dt.Rows.Count >= 1)
            {
                foreach (DataRow item in dt.Rows)
                {
                    DatailsMode1 DM = new DatailsMode1();
                    //点赞数
                    DM.Like_number = int.Parse(item["Like_number"].ToString());
                    //封面路径
                    DM.Project_cover = item["Project_cover"].ToString();
                    //项目名称
                    DM.Project_Name = item["Project_Name"].ToString();
                    //目标筹集天数
                    DM.Raise_day = int.Parse(item["Raise_day"].ToString());
                    //预计筹集金额
                    DM.Project_Money = double.Parse(item["Project_Money"].ToString());
                    //筹集进度
                    DM.Financing_state = item["Financing_state"].ToString();
                    //已获得经资
                    DM.Raised_amount = double.Parse(item["Raised_amount"].ToString());
                    //项目ID
                    DM.ProjectID = int.Parse(item["ProjectID"].ToString());
                    //筹集百分比
                    double nu = DM.Raised_amount / DM.Project_Money * 100;
                    DM.chouji = double.Parse(nu.ToString("F2"));
                    //DM.chouji = (int)DM.Raised_amount / (int)DM.Project_Money * 100;
                    //结束日期
                    DM.Closing_date = DateTime.Parse(item["Closing_date"].ToString());
                    //DM.Release_date = DateTime.Parse(item["Release_date"].ToString());
                    //剩余天数
                    DM.shengyutime = DM.Closing_date.DayOfYear - DateTime.Now.DayOfYear;
                    if (DM.Closing_date <= DateTime.Now)
                    {
                        DM.shengyutime = 0;
                        if (DM.Project_Money == DM.Raised_amount)
                        {
                            DM.Financing_state = "已完成";
                        }
                        else
                        {
                            DM.Financing_state = "已结束";
                        }
                    }
                    list.Add(DM);
                }
                return(list);
            }
            else
            {
                return(null);
            }
        }