Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                String subKey = Request["subKey"];
                String email  = Request["email"];

                HashTableExp hash = new HashTableExp("Id", subKey);
                hash.Add("Email", email);
                TempData data = new BLTempData().Select(hash, String.Format(" and Expires>'{0}'", DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss"))).SingleOrDefault();
                //删除过期数据
                new BLTempData().Delete(null, String.Format(" and Expires<'{0}'", DateTime.Now.AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss")));

                if (data == null)
                {
                    Response.Redirect("error.htm");
                }
                else
                {
                    new BLTempData().Delete(subKey);
                    Users user = new BLUsers().Select(new HashTableExp("Mail", email)).SingleOrDefault();
                    if (user == null)
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), DateTime.Now.ToString(), "alert('邮件地址不存在');location.href='error.htm'", true);
                    }
                    else
                    {
                        this.LitUserName.Text = user.LoginId;
                        Session["TempUser"]   = user;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <returns></returns>
        public String SelectByPage(int limit, int start, String key, String startTime)
        {
            #region 封装查询方法
            String sqlWhere = string.Format(" and (Bank_Type_Name like '%{0}%' or Create_Name like '%{0}%' or Save_Name like '%{0}%' or Note like '%{0}%')", key);
            if (!String.IsNullOrEmpty(startTime))
            {
                sqlWhere += String.Format(" and time >='{0}'", startTime.GetDateTime().ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (!String.IsNullOrEmpty(Request["endTime"]))
            {
                sqlWhere += String.Format(" and time <= '{0}'", Request["endTime"].GetDateTime().ToString("yyyy-MM-dd HH:mm:ss"));
            }

            if (!String.IsNullOrEmpty(Request["BankType"]))
            {
                sqlWhere += String.Format(" and Bank_Type_Name='{0}'", Request["BankType"]);
            }

            if (!String.IsNullOrEmpty(Request["SaveType"]))
            {
                sqlWhere += String.Format(" and Save_Name='{0}'", Request["SaveType"]);
            }

            String       yearMonth = Request["yearMonth"];//年月,格式2013-1
            HashTableExp hash      = new HashTableExp();
            if (!String.IsNullOrEmpty(yearMonth))
            {
                hash.Add("YearMonth", yearMonth);
            }
            #endregion

            int total;
            List <VBankCard> bankCards = new BLBankCard().Select(limit, start, hash, out total, sqlWhere);
            return(JsonConvert.JavaScriptSerializer(new ExtGridRecord(bankCards, total)));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获得参数
        /// </summary>
        /// <returns></returns>
        public Tuple <HashTableExp, String> GetParam(Boolean?isMark, Boolean?family)
        {
            #region 封装查询方法
            String       sqlWhere = "";
            HashTableExp hash     = new HashTableExp();

            if (!String.IsNullOrEmpty(Request["key"]))
            {
                String.Format(" and (Note like '%{0}%')", Request["key"]);
            }

            String yearMonth = Request["yearMonth"];//年月,格式2013-01
            if (!String.IsNullOrEmpty(yearMonth))
            {
                String[] times = yearMonth.Split('-');
                hash.Add("YearMonth", yearMonth);
            }
            if (!String.IsNullOrEmpty(Request["startTime"]))
            {
                sqlWhere += String.Format(" and time >='{0}'", Request["startTime"].GetDateTime().ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (!String.IsNullOrEmpty(Request["endTime"]))
            {
                sqlWhere += String.Format(" and time <= '{0}'", Request["endTime"].GetDateTime().ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (!String.IsNullOrEmpty(Request["minPrice"]))
            {
                sqlWhere += String.Format(" and Price>='{0}'", Request["minPrice"]);
            }
            if (!String.IsNullOrEmpty(Request["maxPrice"]))
            {
                sqlWhere += String.Format(" and Price<='{0}'", Request["maxPrice"]);
            }

            if (!String.IsNullOrEmpty(Request["CusGroup"]))
            {
                hash.Add("CusGroupMore", Request["CusGroup"]);
            }
            if (!String.IsNullOrEmpty(Request["CusGroupNo"]))
            {
                hash.Add("CusGroupNo", Request["CusGroupNo"]);
            }

            if (CurrentUser.Id != "-1")
            {
                hash.Add("CreateBy", CurrentUser.Id);
            }

            if (isMark == false)
            {
                sqlWhere += String.Format(" and IsMark ='{0}'", 0);
            }
            if (family == false)
            {
                sqlWhere += String.Format(" and FamilyIncome ='{0}'", 0);
            }

            if (!String.IsNullOrEmpty(Request["searchMark"]))
            {
                hash.Add("IsMark", Request["searchMark"]);
            }
            if (!String.IsNullOrEmpty(Request["searchFamily"]))
            {
                hash.Add("FamilyIncome", Request["searchFamily"]);
            }
            #endregion

            Tuple <HashTableExp, String> result = new Tuple <HashTableExp, string>(hash, sqlWhere);
            return(result);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 将dataTable保存到数据库
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public String SaveData(DataTable dt, String userId)
        {
            List <BankCard> list = new List <BankCard>();
            String          msg  = "";

            foreach (DataRow row in dt.Rows)
            {
                BankCard index = new BankCard();
                String   type  = row["操作类型"].ToString();
                //判断操作类型是否存在
                HashTableExp hash = new HashTableExp("Name", type);
                hash.Add("ParentId", "1000200000");
                List <Diction> dictions = new BLDiction().Select(hash);
                if (dictions.Count <= 0)
                {
                    msg += "<br/>" + type + "不存在";
                    continue;
                }
                else
                {
                    index.SaveType = dictions[0].Id;
                }

                //判断银行卡是否正确
                type = row["银行卡名称"].ToString();
                hash.Clear();
                hash.Add("Name", type);
                hash.Add("ParentId", "1000100000");
                dictions = new BLDiction().Select(hash);
                if (dictions.Count <= 0)
                {
                    msg += "<br/>" + type + "不存在";
                    continue;
                }
                else
                {
                    index.BankType = dictions[0].Id;
                }

                DateTime time;
                //判断时间是否正确
                if (!DateTime.TryParse(row["时间"].ToString(), out time))
                {
                    msg += "<br/>" + row["时间"] + "不是时间类型";
                    continue;
                }
                else
                {
                    index.Time = time;
                }

                double price;

                //判断金额是否正确
                if (!double.TryParse(row["金额"].ToString(), out price))
                {
                    msg += "<br/>" + row["金额"] + "不是数字类型";
                    continue;
                }
                else
                {
                    index.Price = price;
                }

                index.Id         = Guid.NewGuid().ToString();
                index.Note       = row["备注"].ToString();
                index.CreateBy   = index.UpdateBy = userId;
                index.CreateTime = index.UpdateTime = DateTime.Now;
                list.Add(index);
            }

            int result = dLBankCard.Add(list);

            if (result > 0)
            {
                return("成功保存" + result + "条数据." + msg);
            }
            else
            {
                return(msg);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 将dataTable保存到数据库
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public String SaveData(DataTable dt, String userId)
        {
            List <LifingCost> list = new List <LifingCost>();
            String            msg  = "";

            foreach (DataRow row in dt.Rows)
            {
                LifingCost index = new LifingCost();
                String     type  = row["消费类型"].ToString();
                //判断类型是否存在
                HashTableExp hash = new HashTableExp("Name", type);
                hash.Add("ParentId", "1000300000");
                List <Diction> dictions = new BLDiction().Select(hash);
                if (dictions.Count <= 0)
                {
                    msg += "<br/>" + type + "不存在";
                    continue;
                }

                DateTime time;
                //判断时间是否正确
                if (!DateTime.TryParse(row["消费时间"].ToString(), out time))
                {
                    msg += "<br/>" + row["消费时间"] + "不是时间类型";
                    continue;
                }
                else
                {
                    index.Time = time;
                }

                double price;

                //判断金额是否正确
                if (!double.TryParse(row["消费金额"].ToString(), out price))
                {
                    msg += "<br/>" + row["消费金额"] + "不是数字类型";
                    continue;
                }
                else
                {
                    index.Price = price;
                }

                index.Id         = Guid.NewGuid().ToString();
                index.Reason     = row["消费名称"].ToString();
                index.CostTypeId = dictions[0].Id;
                index.Notes      = row["备注"].ToString();
                index.CreateBy   = userId;
                index.CreateTime = DateTime.Now;
                list.Add(index);
            }

            int result = dLLifingCost.Add(list);

            if (result > 0)
            {
                return("成功保存" + result + "条数据." + msg);
            }
            else
            {
                return(msg);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获得参数
        /// </summary>
        /// <returns></returns>
        public Tuple <HashTableExp, String> GetParam(String startTime, String endTime, String key, String CostTypeId, Boolean?isMark, Boolean?family)
        {
            #region 封装查询方法
            String sqlWhere = String.Format(" and (Reason like '%{0}%' or Create_Name like '%{0}%' or Notes like '%{0}%')", key);
            if (!String.IsNullOrEmpty(startTime))
            {
                sqlWhere += String.Format(" and time >='{0}'", startTime.GetDateTime().ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (!String.IsNullOrEmpty(endTime))
            {
                sqlWhere += String.Format(" and time <= '{0}'", endTime.GetDateTime().ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (!String.IsNullOrEmpty(CostTypeId))
            {
                sqlWhere += String.Format(" and Cost_Type_Id in({0})", CostTypeId.GetIds());
            }

            HashTableExp hash      = new HashTableExp();
            String       yearMonth = Request["yearMonth"];//年月,格式2013-1
            if (!String.IsNullOrEmpty(yearMonth))
            {
                hash.Add("YearMonth", yearMonth.GetIds());
            }

            String costTypeName = Request["CostTypeName"];//消费类型
            if (!String.IsNullOrEmpty(costTypeName))
            {
                sqlWhere += String.Format(" and Cost_Type_Name ='{0}'", costTypeName);
            }

            if (!String.IsNullOrEmpty(Request["minPrice"]))
            {
                sqlWhere += String.Format(" and Price>='{0}'", Request["minPrice"]);
            }
            if (!String.IsNullOrEmpty(Request["maxPrice"]))
            {
                sqlWhere += String.Format(" and Price<='{0}'", Request["maxPrice"]);
            }

            if (isMark == false)
            {
                sqlWhere += String.Format(" and IsMark ='{0}'", 0);
            }
            if (family == false)
            {
                sqlWhere += String.Format(" and FamilyPay ='{0}'", 0);
            }

            if (!String.IsNullOrEmpty(Request["CusGroup"]))
            {
                hash.Add("CusGroupMore", Request["CusGroup"]);
            }
            if (!String.IsNullOrEmpty(Request["CusGroupNo"]))
            {
                hash.Add("CusGroupNo", Request["CusGroupNo"]);
            }
            if (!String.IsNullOrEmpty(Request["searchMark"]))
            {
                hash.Add("IsMark", Request["searchMark"]);
            }
            if (!String.IsNullOrEmpty(Request["searchFamily"]))
            {
                hash.Add("FamilyPay", Request["searchFamily"]);
            }
            //查询当前用户信息
            if (CurrentUser.Id != "-1")
            {
                hash.Add("CreateBy", CurrentUser.Id);
            }
            #endregion

            Tuple <HashTableExp, String> result = new Tuple <HashTableExp, string>(hash, sqlWhere);
            return(result);
        }