public static bool SetStatementItems(AgreeStatementSetModels item)
        {
            item.ModuleName = statementModuleName;
            SQLData.Database    db       = new SQLData.Database(WebInfo.Conn);
            SQLData.TableObject tableObj = db.GetTableObject("AgreeStatementSet");
            tableObj.GetDataFromObject(item);
            DateTime now   = DateTime.Now;
            string   sql   = $"SELECT * FROM AgreeStatementSet WHERE  ModuleName='{ statementModuleName.Replace("'", "")}' ";
            bool     isNew = db.GetFirstValue(sql) == null;

            if (isNew)
            {
                tableObj["Creator"]    = Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["CreateTime"] = now;
                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = now;
                tableObj.Insert();
            }
            else
            {
                tableObj.Remove("ModuleName");
                tableObj.Remove("Creator");
                tableObj.Remove("CreateTime");
                tableObj["Modifier"]   = WorkV3.Areas.Backend.Models.DataAccess.MemberDAO.SysCurrent.Id;
                tableObj["ModifyTime"] = now;
                tableObj.Update(item.ModuleName);
            }
            return(true);
        }
        public ActionResult GetAgreeStatement()
        {
            AgreeStatementSetModels model = MemberShipSettingDAO.GetStatementItems();

            // model.StatementContent = HttpUtility.UrlEncode(model.StatementContent);
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
        public ActionResult SetAgreeStatement(AgreeStatementSetModels model)
        {
            model.ModuleName       = "Member";
            model.StatementContent = HttpUtility.UrlDecode(model.StatementContent);
            bool Result       = MemberShipSettingDAO.SetStatementItems(model);
            bool colSetResult = MemberShipRegSetDAO.UpdateItemSet(PageCache.SiteID, "IsNeedAgreeMemberDesc", model.IsNeedAgree.ToString().ToLower());

            if (!colSetResult)
            {
                return(Json("fail"));
            }
            return(Json(Result ? "success" : "fail"));
        }
Beispiel #4
0
        public static bool UpdateItemSet(long SiteID, string columnName, string columnValue)
        {
            string sql = $"UPDATE MemberShipRegSet SET {columnName}='{columnValue.Replace("'","")}' WHERE  SiteID={SiteID} ";

            SQLData.Database db = new SQLData.Database(WebInfo.Conn);
            db.ExecuteNonQuery(sql);
            if (columnName == "IsNeedAgreeMemberDesc")
            {
                AgreeStatementSetModels agreeState = MemberShipSettingDAO.GetStatementItems();
                if (agreeState != null)
                {
                    agreeState.IsNeedAgree = Convert.ToBoolean(columnValue);
                    MemberShipSettingDAO.SetStatementItems(agreeState);
                }
            }
            return(true);
        }