Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        public async Task <bool> InsertDataAbsen(AbsenData data)
        {
            try
            {
                if (data != null)
                {
                    TableOperation tableOperation = TableOperation.Insert(data);
                    await cloudTable.ExecuteAsync(tableOperation);

                    Console.WriteLine("Record inserted");
                }
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(false);
            }
        }