Exemple #1
0
        private void QuantityDialogBuilder(Sal1050EntityWebGoodSalPrice sal1050EntityWebGoodSalePrice)
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            View line_editor            = LayoutInflater.Inflate(Resource.Layout.sal1050_line_editor, null);

            builder.SetView(line_editor);
            AlertDialog ad = builder.Create();

            ad.SetTitle(sal1050EntityWebGoodSalePrice.FarsiDesc);
            ad.SetIcon(Android.Resource.Drawable.IcDialogAlert);
            //ad.SetMessage("Alert message...");
            EditText etQuantity          = (EditText)line_editor.FindViewById(Resource.Id.eTQuantity);
            TextView mTVUnitQuantityForm = ((TextView)line_editor.FindViewById(Resource.Id.tVUnitQuantityForm));

            mTVUnitQuantityForm.Text = sal1050EntityWebGoodSalePrice.Unit;
            double quantity = 1;

            ad.SetButton(GetString(Resource.String.OK), (s, e) =>
            {
                string str = etQuantity.Text.Trim();
                if (!string.IsNullOrWhiteSpace(str) && double.Parse(str) > 0)
                {
                    quantity = double.Parse(str);
                }
                sal1050EntityWebGoodSalePrice.Quantity = quantity;
                AddItem(sal1050EntityWebGoodSalePrice);
            });
            ad.Show();
        }
Exemple #2
0
 private void AddItem(Sal1050EntityWebGoodSalPrice sal1050EntityWebGoodSalePrice)
 {
     listItem.Add(sal1050EntityWebGoodSalePrice);
     //adapter.AddItem(sal1050EntityWebGoodSalePrice);
     adapter.NotifyDataSetChanged();
     //mTVLookUpCustomQuantityTotal.Text = (int.Parse(mTVLookUpCustomQuantityTotal.Text) + 1).ToString();
     mTVLookUpCustomPriceTotal.Text = (double.Parse(mTVLookUpCustomPriceTotal.Text) + sal1050EntityWebGoodSalePrice.Price * sal1050EntityWebGoodSalePrice.Quantity).ToString();
     ToDB(sal1050EntityWebGoodSalePrice);
 }
Exemple #3
0
        private StringBuilder WebGoodSalPriceDTSB(Sal1050EntityWebGoodSalPrice res)
        {
            int           formDate = int.Parse(tvCurrentDate.Text);
            StringBuilder sb       = new StringBuilder();

            sb.Append("Select Cast(");
            sb.Append(serialDprt); sb.Append(" As int) As SerialDprt, Cast(");
            sb.Append(int.Parse(tvSerial.Text)); sb.Append(" As int) As FormNo, Cast(");
            sb.Append(formDate); sb.Append(" As int) As FormDate, Cast(");
            sb.Append(++seq); sb.Append(" As int) As Seq, Cast(");
            sb.Append("0 As int) As PreviousSeq,'");
            sb.Append(res.ItemCode); sb.Append("' As ItemCode, Cast(");
            sb.Append("0 As int) As BatchNo, Cast(");
            sb.Append("0 As int) As ServiceCode, Cast(");
            sb.Append(tvPosCustNo.Text); sb.Append(" As int) As PersonNo, Cast(");
            sb.Append(res.PriceID); sb.Append(" As int) As PriceId, Cast(");
            sb.Append(res.PriceType); sb.Append(" As smallint) As PriceType, Cast(");
            sb.Append(res.Price); sb.Append(" As float) As Price, Cast(");
            sb.Append(res.Quantity); sb.Append(" As float) As Qty1, Cast(");
            sb.Append("1 As float) As Qty2, Cast(");
            sb.Append("0 As float) As UsedQty1, Cast(");
            sb.Append("0 As float) As UsedQty2, Cast(");
            sb.Append("0 As float) As IncrsDecrs1, Cast(");
            sb.Append("0 As float) As IncrsDecrs2, Cast(");
            sb.Append("0 As float) As IncrsDecrs3, Cast(");
            sb.Append("0 As float) As IncrsDecrs4, Cast(");
            sb.Append("0 As float) As UsedIncrsDecrs1, Cast(");
            sb.Append("0 As float) As UsedIncrsDecrs2, Cast(");
            sb.Append("0 As float) As UsedIncrsDecrs3, Cast(");
            sb.Append("0 As float) As UsedIncrsDecrs4, Cast(");
            sb.Append("0 As float) As HdrDiscount, Cast(");
            sb.Append("0 As float) As Discount, Cast(");
            sb.Append(res.Cost1); sb.Append(" As float) As Cost1, Cast(");
            sb.Append("0 As float) As Cost2, Cast(");
            sb.Append("0 As float) As Cost3, Cast(");
            sb.Append("0 As float) As Cost4, Cast(");
            sb.Append("0 As float) As Cost5, Cast(");
            sb.Append("0 As float) As Cost6, Cast(");
            sb.Append("0 As float) As Cost7, Cast(");
            sb.Append("0 As float) As Cost8, Cast(");
            sb.Append("0 As float) As Amount, Cast(");
            sb.Append("0 As float) As NetAmount, Cast(");
            sb.Append("0 As float) As CrdtAmount, Cast(");
            sb.Append("'' As varchar(250)) As Description, Cast(");
            sb.Append(formDate); sb.Append(" As int) As CreateDate, Cast(");
            sb.Append(((SharedEnviroment)ApplicationContext).UserCode); sb.Append(" As int) As CreateUser, Cast(");
            sb.Append(formDate); sb.Append(" As int) As ChangeDate, Cast(");
            sb.Append(((SharedEnviroment)ApplicationContext).UserCode); sb.Append(" As int) As ChangeUser, Cast(");
            sb.Append("1 As int) As TableDataVersion");

            return(sb);
        }
Exemple #4
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            // A ViewHolder keeps references to children views to avoid unnecessary calls
            // to findViewById() on each row.
            ViewHolder holder;
            Sal1050EntityWebGoodSalPrice item = (Sal1050EntityWebGoodSalPrice)Items[position];

            if (convertView == null)
            {
                convertView = mInflater.Inflate(Resource.Layout.lookup_good_sal_price_custom_view, null);

                // Creates a ViewHolder and store references to children views
                // we want to bind data to.
                holder = new ViewHolder
                {
                    TVLookUpCustomCost1     = convertView.FindViewById <TextView>(Resource.Id.tVLookUpCustomCost1),
                    TVLookUpCustomFarsiDesc = convertView.FindViewById <TextView>(Resource.Id.tVLookUpCustomFarsiDesc),
                    TVLookUpCustomItemCode  = convertView.FindViewById <TextView>(Resource.Id.tVLookUpCustomItemCode),
                    TVLookUpCustomPrice     = convertView.FindViewById <TextView>(Resource.Id.tVLookUpCustomPrice),
                    TVLookUpCustomUnit      = convertView.FindViewById <TextView>(Resource.Id.tVLookUpCustomUnit),
                    TVLookUpCustomRowNo     = convertView.FindViewById <TextView>(Resource.Id.tVLookUpCustomRowNo),
                    TVLookUpCustomQuantity  = convertView.FindViewById <TextView>(Resource.Id.tVLookUpCustomQuantity)
                };

                convertView.Tag = holder;
            }
            else
            {
                // Get the ViewHolder back to get fast access to the TextView
                // and the ImageView.
                holder = (ViewHolder)convertView.Tag;
            }

            // Bind the data efficiently with the holder.
            holder.TVLookUpCustomItemCode.Text  = item.ItemCode;
            holder.TVLookUpCustomFarsiDesc.Text = item.FarsiDesc;
            holder.TVLookUpCustomPrice.Text     = item.Price.ToString();
            holder.TVLookUpCustomUnit.Text      = item.Unit;
            holder.TVLookUpCustomCost1.Text     = item.Cost1.ToString();
            holder.TVLookUpCustomRowNo.Text     = (position + 1).ToString();
            holder.TVLookUpCustomQuantity.Text  = item.Quantity.ToString();

            return(convertView);
        }
Exemple #5
0
 private void ToDB(Sal1050EntityWebGoodSalPrice res)
 {
     try
     {
         using (dbHelper = new NmdMobileDBAdapter(this))
         {
             dbHelper.OpenOrCreateDatabase(((SharedEnviroment)ApplicationContext).ActionArgument);
             using (DataTable dt = dbHelper.ExecuteSQL(WebGoodSalPriceDTSB(res).ToString()))
             {
                 dbHelper.CopyToDB(dt, "WebSalPerformaDtl", null, null);
             }
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.toastMsg(this, e.Message);
         ExceptionHandler.logDActivity(e.ToString(), ((SharedEnviroment)ApplicationContext).Logging, ((SharedEnviroment)ApplicationContext).TAG);
     }
 }
Exemple #6
0
        private Sal1050EntityWebGoodSalPrice WebGoodSalPriceBuilder(IParcelable[] tblFieldArr)
        {
            Sal1050EntityWebGoodSalPrice sal1050EntityWebGoodSalePrice = new Sal1050EntityWebGoodSalPrice();

            foreach (TableField field in tblFieldArr)
            {
                switch (field.getName())
                {
                case "Cost1":
                    sal1050EntityWebGoodSalePrice.Cost1 = double.Parse(field.getValue());
                    break;

                case "FarsiDesc":
                    sal1050EntityWebGoodSalePrice.FarsiDesc = field.getValue();
                    break;

                case "ItemCode":
                    sal1050EntityWebGoodSalePrice.ItemCode = field.getValue();
                    break;

                case "Price":
                    sal1050EntityWebGoodSalePrice.Price = double.Parse(field.getValue());
                    break;

                case "PriceID":
                    sal1050EntityWebGoodSalePrice.PriceID = int.Parse(field.getValue());
                    break;

                case "PriceType":
                    sal1050EntityWebGoodSalePrice.PriceType = int.Parse(field.getValue());
                    break;

                case "Unit":
                    sal1050EntityWebGoodSalePrice.Unit = field.getValue();
                    break;
                }
            }
            return(sal1050EntityWebGoodSalePrice);
        }
Exemple #7
0
 private void DeleteItem(IMenuItem item)
 {
     AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)item.MenuInfo;
     try
     {
         Sal1050EntityWebGoodSalPrice element = (Sal1050EntityWebGoodSalPrice)listItem.ElementAt(info.Position);
         mTVLookUpCustomPriceTotal.Text = (double.Parse(mTVLookUpCustomPriceTotal.Text) - element.Price * element.Quantity).ToString();
         listItem.RemoveAt(info.Position);
         using (dbHelper = new NmdMobileDBAdapter(this))
         {
             dbHelper.OpenOrCreateDatabase(((SharedEnviroment)ApplicationContext).ActionArgument);
             dbHelper.ExecuteNonQuery("Delete From WebSalPerformaDtl Where FormNo=" + tvSerial.Text + " And Seq =" + (info.Position + 1) + " And SerialDprt=" + serialDprt + " And FormDate=" + tvCurrentDate.Text);
         }
         //adapter.RemoveItem(element);
         //dBHelper.ExecuteNonQuery("Update WebSalPerformaDtl Set Seq=" + --seq + " Where FormNo=" + mTV_Serial_FactorForooshGah.Text + " And Seq =" + (info.Position + 2) + " And SerialDprt=" + serialDprt + " And FormDate=" + mTVCurrentDate_FactorForooshGah.Text);
     }
     catch (Exception e)
     {
         ExceptionHandler.toastMsg(this, e.Message);
         ExceptionHandler.logDActivity(e.ToString(), ((SharedEnviroment)ApplicationContext).Logging, ((SharedEnviroment)ApplicationContext).TAG);
     }
     adapter.NotifyDataSetChanged();
 }
Exemple #8
0
 /// <summary>
 /// Removes the item.
 /// Note:is not tested yet.
 /// </summary>
 /// <param name="res">The resource.</param>
 public void RemoveItem(Sal1050EntityWebGoodSalPrice res)
 {
     Orig_items.Remove(res);
     Items.Remove(res);
     NotifyDataSetChanged();
 }
Exemple #9
0
 /// <summary>
 /// Adds the item.
 /// Note:is not tested yet.
 /// </summary>
 /// <param name="res">The resource.</param>
 public void AddItem(Sal1050EntityWebGoodSalPrice res)
 {
     Orig_items.Add(res);
     Items.Add(res);
     NotifyDataSetChanged();
 }