private async Task NextCode() { try { var prd = await ProductBussines.NextCode(); txtCode.Text = prd; } catch (Exception ex) { WebErrorLog.ErrorInstence.StartErrorLog(ex); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ProductMainLayout); myToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.mainPrdToolbar); SetSupportActionBar(myToolbar); var guid = Intent.GetStringExtra("PrdGuid"); var prdGuid = Guid.Empty; if (!string.IsNullOrEmpty(guid)) { prdGuid = Guid.Parse(guid); } prd = ProductBussines.Get(prdGuid); txtName = FindViewById <EditText>(Resource.Id.txtPrdName); txtCode = FindViewById <EditText>(Resource.Id.txtPrdCode); txtPrice = FindViewById <EditText>(Resource.Id.txtPrdPrice); txtBackUp = FindViewById <EditText>(Resource.Id.txtPrdBackUp); SetFonts(); txtName.Text = prd?.Name; txtCode.Text = prd?.Code; txtPrice.Text = prd?.Price.ToString("N0"); txtBackUp.Text = prd?.BckUpPrice.ToString("N0"); if (prd == null || prd.Guid == Guid.Empty) { txtCode.Text = ProductBussines.NextCode(); } }