protected void Page_Load(object sender, EventArgs e) { string action = string.Empty; string tod = string.Empty; string dow = string.Empty; string userId = string.Empty; string wallId = string.Empty; action = Request["action"]; tod = Request["tod"]; dow = Request["dow"]; userId = Request["user_id"]; wallId = Request["wall_id"]; Appt a = new Appt(); if (action == "s") // subscribe { a["dow"] = dow; a["tod"] = tod; a["user_id"] = userId; a["wall_id"] = wallId; a.doCommand("subscribe"); } else if (action == "u") // unsubscribe, then subscribe { Appt userAppt = new Appt(); userAppt["user_id"] = userId; DataSet userApptSet = userAppt.doQuery("get_user_time"); if (!DatabaseObject.isNullOrEmpty(userApptSet)) { DataRow apptRow = userApptSet.Tables[0].Rows[0]; Appt unsub = new Appt(); unsub["dow"] = apptRow["my_dow"]; unsub["tod"] = apptRow["my_tod"]; unsub["user_id"] = userId; unsub.doCommand("unsubscribe"); } Appt sub = new Appt(); sub["dow"] = dow; sub["tod"] = tod; sub["user_id"] = userId; sub["wall_id"] = wallId; sub.doCommand("subscribe"); } }
protected void Page_Load(object sender, EventArgs e) { string userId = string.Empty; userId = Request["user_id"]; Appt userAppt = new Appt(); userAppt["user_id"] = userId; DataSet userApptSet = userAppt.doQuery("get_user_time"); if (!DatabaseObject.isNullOrEmpty(userApptSet)) { DataRow apptRow = userApptSet.Tables[0].Rows[0]; Appt unsub = new Appt(); unsub["dow"] = apptRow["my_dow"]; unsub["tod"] = apptRow["my_tod"]; unsub["user_id"] = userId; unsub.doCommand("unsubscribe"); } }
protected void Page_Load(object sender, EventArgs e) { long wallsOpen = 0; long wallsNowOpen = 0; string dayName = string.Empty; string action = string.Empty; string result = string.Empty; string tod = string.Empty; string dow = string.Empty; string my_tod = string.Empty; string my_dow = string.Empty; string my_time = string.Empty; string my_dayname = string.Empty; string time = string.Empty; string alreadySubscribedMarkup = string.Empty; string subscribedMarkup = string.Empty; string unsubscribedMarkup = string.Empty; alreadySubscribedMarkup = "myModalError.start(\"<h3><%=wall.already_subscribed%></h3><p><%=wall.already_subscribed_text%></br><%=wall.unsubscribe_text%><p><a href='#' onclick=\\\"updateIncrement('cell_<%=dow%>_<%=tod%>','unsubscribe_subscribe_to_increment','<%=dow%>', '<%=tod%>')\\\" ><%=wall.yes%></a> <a href='javascript:myModalError.end();'><%=wall.no%></a>\");"; subscribedMarkup = "Element.update(\"cell_<%=dow%>_<%=tod%>\", \"<div class='slot-mine-no-move userSlot'><a href='javascript:void(0);' class='wall-remove-btn' title='<%=wall.unsubscribe_from_this_time%>' onclick=\\\"updateIncrement(this,'unsubscribe_from_increment','<%=dow%>', '<%=tod%>', '<%=my_dow%>', '<%=my_tod%>')\\\"></a><%=wall.my_time%><br /><span class='userTimeInfo'><%=dayName%> <%=time%></span></div>\");"; unsubscribedMarkup = "Element.update(\"cell_<%=my_dow%>_<%=my_tod%>\", \"<span class='partialInfo'> <%=wallsNowOpen%> <%=wall.walls_open%><br /><span class='openTimeInfo'> <%=myDayName%> <%=myTime%></span></span> <a class='addUser' title='<%=wall.subscribe_to_this_slot%>' onclick=\\\"updateIncrement(this,'subscribe_to_increment','<%=dow%>', '<%=tod%>')\\\" href='javascript:void(0);'></a>\");"; action = Request["action"]; tod = Request["tod"]; dow = Request["dow"]; Appt myTime = new Appt(); myTime = myTime.doSingleObjectQuery <Appt>("get_my_time"); if (myTime.Count > 0) { my_dow = myTime.getString("my_dow"); my_tod = myTime.getString("my_tod"); } else { my_dow = "-1"; my_tod = "-1"; } Appt a = new Appt(); if (action == "subscribe_to_increment") { if (my_tod != "-1") { markup = new StringBuilder(alreadySubscribedMarkup); } else { markup = new StringBuilder(subscribedMarkup); a["dow"] = dow; a["tod"] = tod; a["user_id"] = LiftDomain.User.Current.id.Value; wallsOpen = a.doCommand("subscribe"); dayName = Appt.getDay(dow); time = Appt.getTime(tod); } } else if (action == "unsubscribe_subscribe_to_increment") { Appt unsub = new Appt(); unsub["dow"] = my_dow; unsub["tod"] = my_tod; unsub["user_id"] = LiftDomain.User.Current.id.Value; markup = new StringBuilder(subscribedMarkup); markup.Append(unsubscribedMarkup); wallsNowOpen = unsub.doCommand("unsubscribe"); Appt sub = new Appt(); sub["dow"] = dow; sub["tod"] = tod; sub["user_id"] = LiftDomain.User.Current.id.Value; wallsOpen = sub.doCommand("subscribe"); dayName = Appt.getDay(dow); time = Appt.getTime(tod); my_time = Appt.getTime(my_tod); my_dayname = Appt.getDay(my_dow); } else if (action == "unsubscribe_from_increment") { markup = new StringBuilder(unsubscribedMarkup); Appt unsub = new Appt(); unsub["dow"] = my_dow; unsub["tod"] = my_tod; unsub["user_id"] = LiftDomain.User.Current.id.Value; wallsNowOpen = unsub.doCommand("unsubscribe"); my_time = Appt.getTime(my_tod); my_dayname = Appt.getDay(my_dow); } replace(markup, "tod", tod); replace(markup, "dow", dow); replace(markup, "my_tod", my_tod); replace(markup, "my_dow", my_dow); replace(markup, "myTime", my_time); replace(markup, "myDayName", my_dayname); replace(markup, "dayName", dayName); replace(markup, "wallsNowOpen", wallsNowOpen); replace(markup, "wallsOpen", wallsOpen); replace(markup, "time", time); replace(markup, "wall.my_time", Language.Current.WALL_MY_TIME); replace(markup, "wall.already_subscribed", Language.Current.WALL_ALREADY_SUBSCRIBED); replace(markup, "wall.already_subscribed_text", Language.Current.WALL_ALREADY_SUBSCRIBED_TEXT); replace(markup, "wall.unsubscribe_text", Language.Current.WALL_UNSUBSCRIBE_TEXT); replace(markup, "wall.yes", Language.Current.WALL_YES); replace(markup, "wall.no", Language.Current.WALL_NO); replace(markup, "wall.unsubscribe_from_this_time", Language.Current.WALL_UNSUBSCRIBE_FROM_THIS_TIME); replace(markup, "wall.walls_open", Language.Current.WALL_WALLS_OPEN); replace(markup, "wall.subscribe_to_this_slot", Language.Current.WALL_SUBSCRIBE_TO_THIS_SLOT); Response.ContentType = "text/javascript"; }
protected void Page_Load(object sender, EventArgs e) { string cell = string.Empty; string wallId = string.Empty; string dow = string.Empty; string tod = string.Empty; string login = string.Empty; string first_name = string.Empty; string last_name = string.Empty; string phone = string.Empty; string email = string.Empty; string password = string.Empty; LiftDomain.Organization.setCurrent(); cell = Request["cell"]; string[] parts = cell.Split(new char[] { '_' }); wallId = parts[0]; dow = parts[1]; tod = parts[2]; login = Request["login"]; first_name = Request["first_name"]; last_name = Request["last_name"]; phone = Request["phone"]; email = Request["email"]; password = Request["password"]; LiftDomain.User thisUser = new LiftDomain.User(); thisUser.password_hash_type.Value = "md5"; string saltValue = LiftDomain.User.generateRandomSalt(); thisUser.password_salt.Value = saltValue; thisUser.crypted_password.Value = LiftDomain.User.hash(password, saltValue); thisUser.last_password_changed_date.Value = LiftTime.CurrentTime; thisUser.state.Value = 1; thisUser.created_at.Value = LiftTime.CurrentTime; thisUser.last_logged_in_at.Value = new DateTime(2000, 1, 1, 0, 0, 0); //-- DateTime.MinValue; thisUser.login_failure_count.Value = 0; thisUser.login.Value = login; thisUser.email.Value = email; thisUser.first_name.Value = first_name; thisUser.last_name.Value = last_name; thisUser.address.Value = string.Empty; thisUser.city.Value = string.Empty; thisUser.state_province.Value = string.Empty; thisUser.postal_code.Value = string.Empty; thisUser.phone.Value = phone; thisUser.time_zone.Value = Organization.Current.time_zone.Value; thisUser.language_id.Value = Organization.Current.language_id.Value; thisUser.previous_increment_id.Value = 0; thisUser.updated_at.Value = LiftTime.CurrentTime; bool ok = true; if (LiftDomain.User.checkEmailExists(email)) { ok = false; } if (LiftDomain.User.checkUsernameExists(login)) { ok = false; } if (ok) { thisUser.id.Value = Convert.ToInt32(thisUser.doCommand("save")); Appt a = new Appt(); a["dow"] = dow; a["tod"] = tod; a["user_id"] = thisUser.id.Value; a["wall_id"] = wallId; a.doCommand("subscribe"); userId = thisUser.id.Value.ToString(); appt = first_name.Substring(0, 1); appt += ". "; appt += last_name; } }