Beispiel #1
0
        protected void deletezlinkButton_Click(object sender, EventArgs e)
        {
            LinkButton button = sender as LinkButton;

            string[] p            = button.CommandArgument.Split(new char[] { '|' });
            string   partitionKey = p[0];
            string   rowKey       = p[1];

            zlnk z = new zlnk()
            {
                PartitionKey = partitionKey,
                RowKey       = rowKey
            };

            zlnkDC svc = new zlnkDC();

            svc.AttachTo("zlnks", z, "*");
            svc.DeleteObject(z);

            try
            {
                svc.SaveChanges();
            }
            catch (DataServiceRequestException e2)
            {
            }
        }
Beispiel #2
0
        protected void ActivateUserButton_Click(object sender, EventArgs e)
        {
            LinkButton button = sender as LinkButton;

            string[] p            = button.CommandArgument.Split(new char[] { '|' });
            string   partitionKey = p[0];
            string   rowKey       = p[1];

            zlnkDC svc = new zlnkDC();
            usr    us  = (from u in svc.usrs where u.PartitionKey == partitionKey && u.RowKey == rowKey select u).FirstOrDefault <usr>();

            us.IsActive = us.IsActive ? false : true;

            svc.UpdateObject(us);
            svc.SaveChanges();
        }
Beispiel #3
0
        public static string CreateShortLink(string sOUrl, string sUN)
        {
            zlnkDC svc = new zlnkDC();

            try
            {
                zlnk zl = (from z in svc.zlnks where z.oURL == sOUrl && z.IsActive.Equals(true) select z).FirstOrDefault <zlnk>();
                return(zl.sCd);
            }
            catch
            {
                zlnk z = new zlnk(sUN, helper.GetUnuiqeScd(), sOUrl);
                svc.AddObject("zlnks", z);
                svc.SaveChanges();
                return(z.sCd);
            }
        }
Beispiel #4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            zlnkDC svc = new zlnkDC();

            if (txtSDN.Text.EndsWith("/"))
            {
                txtSDN.Text = txtSDN.Text.Remove(txtSDN.Text.Length - 1);
            }

            if (txtODN.Text.EndsWith("/"))
            {
                txtODN.Text = txtODN.Text.Remove(txtODN.Text.Length - 1);
            }

            string PLID = "free";

            if (txtSDN.Text.Trim() != "http://zlnk.net")
            {
                PLID = "pro1";
            }


            try
            {
                usr us = (from u in svc.usrs where u.UN == txtUN.Text select u).First <usr>();
                lblMesssage.Text = "Username is already in use";
            }
            catch
            {
                usr user = new usr(txtUN.Text, CryptoHelper.Encrypt(txtPwd.Text), txtSDN.Text, txtODN.Text, txtEmail.Text, PLID);
                user.IsActive = true;

                svc.AddObject("usrs", user);
                svc.SaveChanges();

                lblMesssage.Text = "Your user account got created";
            }
        }