Example #1
0
        protected async void Page_Load(object sender, EventArgs e)
        {
            if (DB == null)
            {
                DB = new AzureTableHelper("Absen");
            }
            try
            {
                string strID = Request.QueryString["IDS"];

                //deserialize the object
                //Absen objAbsen = Newtonsoft.Json.JsonConvert.DeserializeObject<Absen>(strJson);
                if (strID != null)
                {
                    var item = new AbsenData()
                    {
                        IDS = strID
                    };
                    item.AssignKey();
                    await DB.InsertDataAbsen(item);

                    Lit1.Text = (string.Format("Data={0}", strID));
                }
                else
                {
                    Lit1.Text = ("No Data");
                }
            }
            catch (Exception ex)
            {
                Lit1.Text = ("Error :" + ex.Message);
            }
        }
Example #2
0
        private async void StartAsyncTask(Object workItemState)
        {
            _context.Response.ContentType = "text/plain";
            try
            {
                string strJson = new StreamReader(_context.Request.InputStream).ReadToEnd();

                //deserialize the object
                Absen objAbsen = Newtonsoft.Json.JsonConvert.DeserializeObject <Absen>(strJson);
                if (objAbsen != null)
                {
                    var item = new Models.AbsenData()
                    {
                        IDS = objAbsen.IDS
                    };
                    item.AssignKey();
                    await DB.InsertDataAbsen(item);

                    _context.Response.Write(string.Format("Data={0}", objAbsen.IDS));
                }
                else
                {
                    _context.Response.Write("No Data");
                }
            }
            catch (Exception ex)
            {
                _context.Response.Write("Error :" + ex.Message);
            }


            //_context.Response.Write("<p>Completion IsThreadPoolThread is " + Thread.CurrentThread.IsThreadPoolThread + "</p>\r\n");

            // _context.Response.Write("Hello World from Async Handler!");
            _completed = true;
            _callback(this);
        }