Ejemplo n.º 1
0
        public void ValidateDialog()
        {
            Button   btnLoad;
            EditText edtemp_code;

            try
            {
                View view = LayoutInflater.Inflate(Resource.Layout.DialogPostValidation, null);
                Android.App.AlertDialog dialog = new Android.App.AlertDialog.Builder(this).Create();
                edtemp_code = view.FindViewById <EditText>(Resource.Id.edtEmp_Code);
                edtemp_code = view.FindViewById <EditText>(Resource.Id.edtEmp_Code);
                dialog.SetView(view);
                dialog.SetTitle("Employee Code");
                btnLoad = view.FindViewById <Button>(Resource.Id.btnLoadDialogPost);
                dialog.Show();
                btnLoad.Click += async delegate
                {
                    ReturnGenericPost returnGenericPost = new ReturnGenericPost();
                    string            CS  = PathLink.UserURI;
                    JObject           obj = await returnGenericPost.ReturnGeneralPosMeth(CS + edtemp_code.Text.ToUpper(), null);

                    GetResult getResult1 = obj.ToObject <GetResult>();
                    if (getResult1.Status == 1)
                    {
                        Bundle mybundle = new Bundle();
                        string emp_code = edtemp_code.Text.ToUpper();
                        //	Intent intent = new Intent(this, typeof(UIPostVendorFragment));
                        //intent.PutExtra("empcode", emp_code);
                        mybundle.PutString("employee", emp_code);

                        var fragmentTransaction           = FragmentManager.BeginTransaction();
                        UIPostVendorFragment uIPostVendor = new UIPostVendorFragment();
                        uIPostVendor.Arguments = mybundle;
                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, uIPostVendor).AddToBackStack(null).Commit();
                        dialog.Dismiss();
                    }
                };
                dialog.Show();
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        private async void BtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                // Emp_Code = view.FindViewById<EditText>(Resource.Id.txtempcode);
                Store           = view.FindViewById <EditText>(Resource.Id.txtStore);
                Code            = view.FindViewById <EditText>(Resource.Id.txtCode);
                Quantity        = view.FindViewById <EditText>(Resource.Id.txtQuantity);
                VendorName      = view.FindViewById <EditText>(Resource.Id.txtVendorName);
                VendorContact   = view.FindViewById <EditText>(Resource.Id.txtVendorContact);
                VendorAddress   = view.FindViewById <EditText>(Resource.Id.txtVendorAddress);
                VendorCost      = view.FindViewById <EditText>(Resource.Id.txtVendorCost);
                SellingCost     = view.FindViewById <EditText>(Resource.Id.txtSellingCost);
                CustomerName    = view.FindViewById <EditText>(Resource.Id.txtCustomerName);
                CustomerContact = view.FindViewById <EditText>(Resource.Id.txtCustomerContact);

                VendorModel vendorModel = new VendorModel()
                {
                    //emp_code = Emp_Code.Text,
                    store           = Store.Text,
                    code            = Code.Text,
                    quantity        = Quantity.Text,
                    vendorname      = VendorName.Text,
                    vendorcontact   = VendorContact.Text,
                    vendoraddress   = VendorAddress.Text,
                    vendorcost      = VendorCost.Text,
                    sellingcost     = SellingCost.Text,
                    customername    = CustomerName.Text,
                    customercontact = CustomerContact.Text,
                };
                ReturnValidation returnValidation = new ReturnValidation();


                if (returnValidation.DecimalValidation(Quantity.Text) && returnValidation.DecimalValidation(VendorCost.Text) && returnValidation.DecimalValidation(SellingCost.Text))
                {
                    string            Json              = JsonConvert.SerializeObject(vendorModel);
                    HttpContent       stringContent     = new StringContent(Json, encoding: Encoding.UTF8, mediaType: "application/json");
                    ReturnGenericPost returnGenericPost = new ReturnGenericPost();
                    string            CS = PathLink.VendorURI;

                    JObject obj = await returnGenericPost.ReturnGeneralPosMeth(CS, stringContent);

                    GetResult getResult1 = obj.ToObject <GetResult>();
                    if (getResult1.Status == 1)
                    {
                        View view = LayoutInflater.Inflate(Resource.Layout.UIVendorModel, null);
                        Android.Support.V7.App.AlertDialog alert = new Android.Support.V7.App.AlertDialog.Builder(Context).Create();

                        alert.SetTitle("Done");
                        alert.SetMessage("Data is Posted");
                        //	alert.Dismiss();
                        //	Toast.MakeText(Context, "Alert Dialog dismissed!!!", ToastLength.Short).Show();
                        alert.Show();
                    }
                }
                else
                {
                    Android.Support.V7.App.AlertDialog alert = new Android.Support.V7.App.AlertDialog.Builder(Context).Create();
                    alert.SetTitle("What the Hell !!!!");
                    alert.SetMessage("Please add genuine value in Quantity, VendorCost and Selling Textboxes");
                    //alert.Dismiss();
                    alert.Show();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        private async void Submit_Click(object sender, EventArgs e)
        {
            //Emp_Code = FindViewById<EditText>(Resource.Id.txtempcode);
            Store           = FindViewById <EditText>(Resource.Id.txtStore);
            Code            = FindViewById <EditText>(Resource.Id.txtCode);
            Quantity        = FindViewById <EditText>(Resource.Id.txtQuantity);
            VendorName      = FindViewById <EditText>(Resource.Id.txtVendorName);
            VendorContact   = FindViewById <EditText>(Resource.Id.txtVendorContact);
            VendorAddress   = FindViewById <EditText>(Resource.Id.txtVendorAddress);
            VendorCost      = FindViewById <EditText>(Resource.Id.txtVendorCost);
            SellingCost     = FindViewById <EditText>(Resource.Id.txtSellingCost);
            CustomerName    = FindViewById <EditText>(Resource.Id.txtCustomerName);
            CustomerContact = FindViewById <EditText>(Resource.Id.txtCustomerContact);

            VendorModel vendorModel = new VendorModel()
            {
                //emp_code = Emp_Code.Text,
                store           = Store.Text,
                code            = Code.Text,
                quantity        = Quantity.Text,
                vendorname      = VendorName.Text,
                vendorcontact   = VendorContact.Text,
                vendoraddress   = VendorAddress.Text,
                vendorcost      = VendorCost.Text,
                sellingcost     = SellingCost.Text,
                customername    = CustomerName.Text,
                customercontact = CustomerContact.Text,
            };
            ReturnValidation returnValidation = new ReturnValidation();

            if (returnValidation.DecimalValidation(Quantity.Text) && returnValidation.DecimalValidation(VendorCost.Text) && returnValidation.DecimalValidation(SellingCost.Text))
            {
                string            Json              = JsonConvert.SerializeObject(vendorModel);
                HttpContent       stringContent     = new StringContent(Json, encoding: Encoding.UTF8, mediaType: "application/json");
                ReturnGenericPost returnGenericPost = new ReturnGenericPost();
                string            CS = PathLink.VendorURI;

                JObject obj = await returnGenericPost.ReturnGeneralPosMeth(CS, stringContent);

                GetResult getResult1 = obj.ToObject <GetResult>();
                if (getResult1.Status == 1)
                {
                    Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                    AlertDialog alert = dialog.Create();
                    alert.SetTitle("Done");
                    alert.SetMessage("Data is Posted");
                    alert.SetButton("OK", (c, ev) =>
                    {
                        // Ok button click task
                    });
                    alert.Show();
                }
            }
            else
            {
                Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                AlertDialog alert = dialog.Create();
                alert.SetTitle("Validation Error");
                alert.SetMessage("Add genuine values in Quantity or VendorCost or SellingCost Textboxes!!!!");

                alert.SetButton("OK", (c, ev) =>
                {
                    // Ok button click task
                });
                alert.Show();
            }
        }