Example #1
0
        private async void SendRequest()
        {
            try
            {
                using (ISitecoreWebApiSession session = this.instanceSettings.GetSession())
                {
                    var builder = ItemWebApiRequestBuilder.ReadItemsRequestWithId(itemIdTextField.Text)
                                  .Payload(this.currentPayloadType)
                                  .AddFieldsToRead(this.fieldNameTextField.Text);

                    if (this.parentScopeButton.Selected)
                    {
                        builder = builder.AddScope(ScopeType.Parent);
                    }
                    if (this.selfScopeButton.Selected)
                    {
                        builder = builder.AddScope(ScopeType.Self);
                    }
                    if (this.childrenScopeButton.Selected)
                    {
                        builder = builder.AddScope(ScopeType.Children);
                    }

                    var request = builder.Build();

                    this.ShowLoader();

                    ScItemsResponse response = await session.ReadItemAsync(request);

                    if (response.Any())
                    {
                        this.ShowItemsList(response);

                        //items serialization test
                        ScItem item         = response[0] as ScItem;
                        string json         = JsonConvert.SerializeObject(item);
                        ScItem restoredItem = JsonConvert.DeserializeObject <ScItem>(json);
                        Console.WriteLine(restoredItem.DisplayName);
                    }
                    else
                    {
                        AlertHelper.ShowLocalizedAlertWithOkOption("Message", "Item is not exist");
                    }
                }
            }
            catch (Exception e)
            {
                this.CleanupTableViewBindings();
                AlertHelper.ShowLocalizedAlertWithOkOption("Error", e.Message);
            }
            finally
            {
                BeginInvokeOnMainThread(delegate
                {
                    this.HideLoader();
                    this.FieldsTableView.ReloadData();
                });
            }
        }
Example #2
0
 public void Clear()
 {
     Clear(panelcombo1);
     Clear(panelcombo2);
     txtArrivalDay1.Clear();
     txtArrivalDay2.Clear();
     txtDeliveryNote.Clear();
     txtPurchaseDate1.Clear();
     txtPurchaseDate2.Clear();
     txtProductName.Clear();
     txtStockDate1.Clear();
     txtStockDate2.Clear();
     ScSKUCD.Clear();
     ScItem.Clear();
     ScJanCD.Clear();
     ScSupplier.Clear();
 }
Example #3
0
        private bool ErrorCheck()
        {
            if (cboWarehouse.SelectedValue.ToString() == "-1")
            {
                nkskbl.ShowMessage("E102");
                cboWarehouse.Focus();
                return(false);
            }
            else
            {
                mse.DeleteFlg = "0";
                DataTable dtsouko = new DataTable();
                dtsouko = nkskbl.D_Souko_Select(mse);
                if (dtsouko.Rows.Count == 0)
                {
                    nkskbl.ShowMessage("E128");
                    cboWarehouse.Focus();
                    return(false);
                }
            }

            if (!string.IsNullOrWhiteSpace(txtArrivalDay2.Text))
            {
                int result = txtArrivalDay1.Text.CompareTo(txtArrivalDay2.Text);
                if (result > 0)
                {
                    nkskbl.ShowMessage("E104");
                    txtArrivalDay2.Focus();
                    return(false);
                }
            }

            if (!string.IsNullOrWhiteSpace(txtStockDate2.Text))
            {
                int stock = txtStockDate1.Text.CompareTo(txtStockDate2.Text);
                if (stock > 0)
                {
                    nkskbl.ShowMessage("E104");
                    txtArrivalDay2.Focus();
                    return(false);
                }
            }

            if (!statusChk1.Checked && !statusChk2.Checked)
            {
                nkskbl.ShowMessage("E111");
                statusChk1.Focus();
                return(false);
            }


            if (!string.IsNullOrWhiteSpace(txtPurchaseDate2.Text))
            {
                int purchase = txtPurchaseDate1.Text.CompareTo(txtPurchaseDate2.Text);
                if (purchase > 0)
                {
                    nkskbl.ShowMessage("E104");
                    txtPurchaseDate2.Focus();
                    return(false);
                }
            }

            if (string.IsNullOrWhiteSpace(txtArrivalDay1.Text) || (string.IsNullOrWhiteSpace(txtArrivalDay2.Text)))
            {
                if (string.IsNullOrWhiteSpace(txtStockDate1.Text) || (string.IsNullOrWhiteSpace(txtStockDate2.Text)))
                {
                    if (string.IsNullOrWhiteSpace(txtPurchaseDate1.Text) || (string.IsNullOrWhiteSpace(txtPurchaseDate2.Text)))
                    {
                        nkskbl.ShowMessage("E188");
                        txtPurchaseDate2.Focus();
                        return(false);
                    }
                }
            }

            if (!chkDelivery.Checked && !ChkArrival.Checked)
            {
                nkskbl.ShowMessage("E111");
                chkDelivery.Focus();
                return(false);
            }

            if (!string.IsNullOrEmpty(ScSupplier.TxtCode.Text))
            {
                mve.VendorCD = ScSupplier.TxtCode.Text;
                if (string.IsNullOrWhiteSpace(txtArrivalDay2.Text))
                {
                    mve.ChangeDate = DateTime.Today.ToShortDateString();
                }
                else
                {
                    mve.ChangeDate = txtArrivalDay2.Text;
                }
                DataTable dtsupplier = new DataTable();
                dtsupplier = nkskbl.M_Vendor_DataSelect(mve);
                if (dtsupplier.Rows.Count > 0)
                {
                    ScSupplier.LabelText = dtsupplier.Rows[0]["VendorName"].ToString();
                }
                else
                {
                    nkskbl.ShowMessage("E101");
                    ScSupplier.SetFocus(1);
                    return(false);
                }
            }

            if (!string.IsNullOrWhiteSpace(ScItem.TxtCode.Text))
            {
                if (ScItem.TxtCode.Text.Contains(","))
                {
                    string   a   = ScItem.TxtCode.Text;
                    string[] arr = a.Split(',');
                    for (int i = 1; i < arr.Length; i++)
                    {
                        if (i >= 7)
                        {
                            nkskbl.ShowMessage("E187");
                            ScItem.SetFocus(1);
                            return(false);
                        }
                    }
                }
            }

            if (!string.IsNullOrWhiteSpace(ScSKUCD.TxtCode.Text))
            {
                if (ScSKUCD.TxtCode.Text.Contains(","))
                {
                    string   a   = ScSKUCD.TxtCode.Text;
                    string[] arr = a.Split(',');
                    for (int i = 1; i < arr.Length; i++)
                    {
                        if (i >= 7)
                        {
                            nkskbl.ShowMessage("E187");
                            ScSKUCD.SetFocus(1);
                            return(false);
                        }
                        //else
                        //{
                        //    ScSKUCD.TxtCode.Text = "'";
                        //}
                    }
                }
            }

            if (!string.IsNullOrWhiteSpace(ScJanCD.TxtCode.Text))
            {
                if (ScJanCD.TxtCode.Text.Contains(","))
                {
                    string   a   = ScJanCD.TxtCode.Text;
                    string[] arr = a.Split(',');
                    for (int i = 1; i < arr.Length; i++)
                    {
                        if (i >= 13)
                        {
                            nkskbl.ShowMessage("E187");
                            ScJanCD.SetFocus(1);
                            return(false);
                        }
                    }
                }
            }

            //if(cboSourceWH.SelectedValue.ToString () == "-1")
            //{
            //    cboSourceWH.SelectedValue = string.Empty;
            //}

            return(true);
        }