コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //txtFront.Attributes["onkeyup"] =
        //    "javascript:" +
        //    "var entry = document.getElementById('" + txtFront.ClientID + "'); " +
        //    "var accents = document.getElementById('" + txtAccents.ClientID + "'); " +
        //    "accents.value = entry.value; ";

        //txtBack.Attributes["onkeyup"] =
        //    "javascript:" +
        //    "var entry = document.getElementById('" + txtBack.ClientID + "'); " +
        //    "var accents = document.getElementById('" + txtAccentsBack.ClientID + "'); " +
        //    "accents.value = entry.value; ";

        // Get the cookie
        HttpCookie cookie = Request.Cookies[Constants.CookieKeys.UserId];

        // Get the user id from the cookie
        if (cookie == null || cookie.Value == null || cookie.Value == "")
        {
            Response.Redirect("login.aspx");
        }

        int userId = -1;

        try
        {
            userId = Utilities.GetUserId(cookie.Value);
        }
        catch (Exception)
        {
            Response.Redirect("login.aspx");
        }

        Dao         dao      = new Dao(ConfigurationManager.AppSettings["Conn"]);
        DataTable   dtStatus = dao.GetUsageStatus(userId);
        UsageStatus us       = UsageStatus.MapUsageStatus(dtStatus.Rows[0]);

        int lessonId   = int.Parse(Request.QueryString["LessonId"]);
        int numEntries = dao.GetNumEntries(lessonId);

        // If adding an entry would put the user over the max entry
        // count for their usage status
        if (numEntries + 1 > us.MaxEntries)
        {
            // If they don't have a subscription, only registered
            // mler = max lesson entries registered
            if (us.Code == "R")
            {
                Response.Redirect("subscribe.aspx?cd=mler");
            }
            // If they have a subscription
            // mles = max lesson entries subscription
            else
            {
                Response.Redirect("subscribe.aspx?cd=mles");
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get the cookie
        HttpCookie cookie = Request.Cookies[Constants.CookieKeys.UserId];

        // Get the user id from the cookie
        // We handle the login logic here instead of letting the master page take care of it
        // because this way we can add the redirect key and value to the session.
        if (cookie == null || cookie.Value == null || cookie.Value == "")
        {
            Session["Redirect"] = "createlessongroup.aspx";
            Response.Redirect("login.aspx");
        }

        int userId = -1;

        try
        {
            userId = Utilities.GetUserId(cookie.Value);
        }
        catch (Exception)
        {
            Response.Redirect("login.aspx");
        }

        // Create the dao
        Dao dao = new Dao(ConfigurationManager.AppSettings["Conn"]);

        // Get the usage status of the user from the db
        DataTable dtStatus = dao.GetUsageStatus(userId);

        // Create the usage status object
        UsageStatus us = UsageStatus.MapUsageStatus(dtStatus.Rows[0]);

        // Determine if they can make another lesson group
        if (us.CurrentNumLessonGroups + 1 > us.MaxLessonGroups)
        {
            // If they haven't subscribed
            // mlgns = max lesson group registered
            if (us.Code == "R")
            {
                Response.Redirect("subscribe.aspx?cd=mlgr");
            }

            // If they have subscribed
            // mlgs = max lesson group subscription
            else
            {
                Response.Redirect("subscribe.aspx?cd=mlgs");
            }
        }
    }
コード例 #3
0
        public MobileCodeAggregateRoot Rebuild(long mobile, UsageType usageType, UsageStatus usageStatus = UsageStatus.未使用)
        {
            if (mobile <= 0)
            {
                return(default(MobileCodeAggregateRoot));
            }

            var para = new
            {
                Mobile      = mobile,
                UsageType   = usageType,
                UsageStatus = usageStatus,
            };

            return(this.daoBuilder.Build().ToEasyXmlDao(para).QueryForObject <MobileCodeAggregateRoot>("qryMobileCodeRoot"));
        }
コード例 #4
0
        public EmailCodeAggregateRoot Rebuild(string email, UsageType usageType, UsageStatus usageStatus = UsageStatus.未使用)
        {
            if (email.IsNullOrEmpty())
            {
                return(default(EmailCodeAggregateRoot));
            }

            var para = new
            {
                Email       = email,
                UsageType   = usageType,
                UsageStatus = usageStatus,
            };

            return(this.daoBuilder.Build().ToEasyXmlDao(para).QueryForObject <EmailCodeAggregateRoot>("qryEmailCodeRoot"));
        }
コード例 #5
0
    public static UsageStatus MapUsageStatus(DataRow dr)
    {
        UsageStatus us = new UsageStatus();

        us.Code = dr["Code"].ToString();
        us.CurrentNumLessonGroups   = (int)dr["CurrentNumLessonGroups"];
        us.CurrentNumLessons        = (int)dr["CurrentNumLessons"];
        us.CurrentNumPrivateLessons = (int)dr["CurrentNumPrivateLessons"];
        us.Description       = dr["Description"].ToString();
        us.EndDate           = (DateTime)dr["EndDate"];
        us.MaxEntries        = (int)dr["MaxEntries"];
        us.MaxLessonGroups   = (int)dr["MaxLessonGroups"];
        us.MaxLessons        = (int)dr["MaxLessons"];
        us.MaxPrivateLessons = (int)dr["MaxPrivateLessons"];
        us.Name              = dr["Name"].ToString();
        us.Price             = (double)dr["Price"];
        us.ViewPublicLessons = (bool)dr["ViewPublicLessons"];
        return(us);
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get the cookie
        HttpCookie cookie = Request.Cookies[Constants.CookieKeys.UserId];

        // Get the user id from the cookie
        // We handle the login logic here instead of letting the master page take care of it
        // because this way we can add the redirect key and value to the session.
        if (cookie == null || cookie.Value == null || cookie.Value == "")
        {
            Session["Redirect"] = "createlesson.aspx";
            Response.Redirect("login.aspx");
        }

        int userId = -1;

        try
        {
            userId = Utilities.GetUserId(cookie.Value);
        }
        catch (Exception)
        {
            Response.Redirect("login.aspx");
        }

        Dao         dao      = new Dao(ConfigurationManager.AppSettings["Conn"]);
        DataTable   dtStatus = dao.GetUsageStatus(userId);
        UsageStatus us       = UsageStatus.MapUsageStatus(dtStatus.Rows[0]);

        if (us.CurrentNumLessons + 1 > us.MaxLessons)
        {
            if (us.Code == "R")
            {
                Response.Redirect("subscribe.aspx?cd=mlr");
            }
            else
            {
                Response.Redirect("subscribe.aspx?cd=mls");
            }
        }
    }
コード例 #7
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as DeviceUseStatement;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (BasedOn != null)
            {
                dest.BasedOn = new List <Hl7.Fhir.Model.ResourceReference>(BasedOn.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus>)StatusElement.DeepCopy();
            }
            if (Category != null)
            {
                dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy());
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (DerivedFrom != null)
            {
                dest.DerivedFrom = new List <Hl7.Fhir.Model.ResourceReference>(DerivedFrom.DeepCopy());
            }
            if (Context != null)
            {
                dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopy();
            }
            if (Timing != null)
            {
                dest.Timing = (Hl7.Fhir.Model.Element)Timing.DeepCopy();
            }
            if (DateAssertedElement != null)
            {
                dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopy();
            }
            if (UsageStatus != null)
            {
                dest.UsageStatus = (Hl7.Fhir.Model.CodeableConcept)UsageStatus.DeepCopy();
            }
            if (UsageReason != null)
            {
                dest.UsageReason = new List <Hl7.Fhir.Model.CodeableConcept>(UsageReason.DeepCopy());
            }
            if (InformationSource != null)
            {
                dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopy();
            }
            if (Device != null)
            {
                dest.Device = (Hl7.Fhir.Model.CodeableReference)Device.DeepCopy();
            }
            if (Reason != null)
            {
                dest.Reason = new List <Hl7.Fhir.Model.CodeableReference>(Reason.DeepCopy());
            }
            if (BodySite != null)
            {
                dest.BodySite = (Hl7.Fhir.Model.CodeableReference)BodySite.DeepCopy();
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            return(dest);
        }
コード例 #8
0
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        string fronts = txtFront.Text.Trim();
        string backs  = txtBack.Text.Trim();

        string[] F = fronts.Split('\n');
        string[] B = backs.Split('\n');

        if (F.Length != B.Length)
        {
            lblError.Text = "You don't have the same number of rows in each box.";
            return;
        }

        Dao dao = new Dao(ConfigurationManager.AppSettings["Conn"]);

        int lessonId = int.Parse(Request.QueryString["lessonid"]);

        // Get the cookie
        HttpCookie cookie = Request.Cookies[Constants.CookieKeys.UserId];

        // Get the user id from the cookie
        if (cookie == null || cookie.Value == null || cookie.Value == "")
        {
            Response.Redirect("login.aspx");
        }

        int userId = -1;

        try
        {
            userId = Utilities.GetUserId(cookie.Value);
        }
        catch (Exception)
        {
            Response.Redirect("login.aspx");
        }

        DataTable   dtStatus   = dao.GetUsageStatus(userId);
        UsageStatus us         = UsageStatus.MapUsageStatus(dtStatus.Rows[0]);
        int         numEntries = dao.GetNumEntries(lessonId);

        for (int i = 0; i < F.Length; i++)
        {
            if (numEntries + 1 > us.MaxEntries)
            {
                if (us.Code == "R")
                {
                    Response.Redirect("subscribe.aspx?cd=mer");
                }
                else
                {
                    Response.Redirect("subscribe.aspx?cd=mes");
                }
            }

            string front        = F[i].Trim();
            string back         = B[i].Trim();
            string accentsFront = null;
            string accentsBack  = null;

            if (front.Contains("^"))
            {
                front        = Regex.Replace(front, @"\^+", "^");
                accentsFront = Regex.Replace(front, @".\^", "^");
                front        = front.Replace("^", "");

                if (accentsFront.Length != front.Length)
                {
                    throw new Exception("Accent pattern on front not same length as front of card.");
                }
            }
            if (back.Contains("^"))
            {
                back        = Regex.Replace(back, @"\^+", "^");
                accentsBack = Regex.Replace(back, @".\^", "^");
                back        = back.Replace("^", "");

                if (accentsBack.Length != back.Length)
                {
                    throw new Exception("Accent pattern on back not same length as back of card.");
                }
            }

            dao.InsertLessonEntry(lessonId, front, back, accentsFront, accentsBack);
            numEntries++;
        }

        Response.Redirect("lessonentries.aspx?lessonid=" + lessonId);
    }