Пример #1
0
        public JsonResult RefreshLoginInfo()
        {
            ViewBag.UploadUrl = uploadUrl;
            MemberModels mem = MemberDAO.SysCurrent;

            string sql = "select * from Member where LoginID=@ID";

            SQLData.Database     db     = new SQLData.Database(WebInfo.Conn);
            SQLData.SelectObject selMem = db.GetSelectObject(sql, new SQLData.ParameterCollection("@ID", mem.LoginID));
            if (selMem != null)
            {
                MemberModels member = new MemberModels
                {
                    Id        = long.Parse(selMem["Id"].ToString()),
                    isSysOnly = bool.Parse(selMem["isSysOnly"].ToString()),
                    LoginID   = selMem["LoginID"].ToString(),
                    Name      = selMem["Name"].ToString(),
                    Img       = selMem["Img"].ToString(),
                    GroupId   = long.Parse(selMem["GroupId"].ToString()),
                    Email     = selMem["Email"].ToString()
                };
                string sessionID = Request.Cookies["sessionId"].Value;
                Session[sessionID] = member;
                return(Json("success"));
            }
            else
            {
                return(Json("fail"));
            }
        }
Пример #2
0
        public static decimal GetPointsTotal(long siteId, long membershipId)
        {
            decimal Total = 0;
            string  Sql   = $"Select SUM(Point) as Total from Points where SiteID = {siteId} and MemberShipID = {membershipId}";

            SQLData.Database     db  = new SQLData.Database(WebInfo.Conn);
            SQLData.SelectObject Obj = db.GetSelectObject(Sql);
            if (Obj["Total"] != null && !string.IsNullOrEmpty(Obj["Total"].ToString()))
            {
                Total = decimal.Parse(Obj["Total"].ToString());
            }
            return(Total);
        }
Пример #3
0
        public static void SetItem(FormItem item, bool hasCreateDate = false)
        {
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("FormItem");
            tableObj.GetDataFromObject(item);

            DateTime now = DateTime.Now;

            tableObj.Add("ModifyDate", now);

            string sql = "Select ID, CheckStatus From FormItem Where ID = " + item.ID;

            SQLData.SelectObject selectObj = db.GetSelectObject(sql);
            bool isNew = selectObj.Count == 0;

            if (isNew)
            {
                if (!hasCreateDate)
                {
                    tableObj["CreateDate"] = now;
                }

                if (item.CheckStatus != (byte)FormCheckStatus.待審核)
                {
                    tableObj["CheckDate"] = DateTime.Now;
                }

                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ID");
                tableObj.Remove("FormID");
                tableObj.Remove("CreateDate");
                tableObj.Remove("SN");
                tableObj.Remove("IsTemp");
                tableObj.Remove("IsBack");
                tableObj.Remove("CheckDate");
                tableObj.Remove("CheckInDate");

                if (item.CheckStatus != (byte)FormCheckStatus.待審核 && (byte)selectObj["CheckStatus"] != item.CheckStatus)
                {
                    tableObj.Add("CheckDate", DateTime.Now);
                }

                tableObj.Update(item.ID);
            }
        }