Ejemplo n.º 1
0
        public void AddModifyRawMaterialDistributionItem(ItemQty itm)
        {
            ReturnValues rv = new ReturnValues();

            using (SqlConnection conn = connect.getConnection())
            {
                using (SqlCommand cmd = new SqlCommand("RawMaterialDistributionItemsLog", conn))//call Stored Procedure
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ItemId", itm.ItemId);
                    cmd.Parameters.AddWithValue("@RawMaterialDisID", itm.RawMaterialDisId);
                    cmd.Parameters.AddWithValue("@rawMaterialId", itm.RawMaterialId);
                    cmd.Parameters.AddWithValue("@Qty", itm.Qty);
                    cmd.Parameters.Add("@returnvalue", SqlDbType.Int);
                    cmd.Parameters["@returnvalue"].Direction = ParameterDirection.Output;
                    cmd.Parameters.Add("@returnvalueString", System.Data.SqlDbType.VarChar, 200);
                    cmd.Parameters["@returnvalueString"].Direction = ParameterDirection.Output;
                    try
                    {
                        cmd.ExecuteNonQuery();
                        rv.StatusCode    = Convert.ToInt32(cmd.Parameters["@returnvalue"].Value);
                        rv.StatusMessage = Convert.ToString(cmd.Parameters["@returnvalueString"].Value);
                    }
                    catch (Exception ex)
                    {
                        CommonUtilityClass.ExceptionLog(ex);
                        rv.StatusCode    = 2000;
                        rv.StatusMessage = "An Error Occured";
                    }
                }
            }
            //  return rv;
        }
Ejemplo n.º 2
0
        protected override void Execute(NativeActivityContext context)
        {
            List <ItemOrder> list = new List <ItemOrder>();

            list = CurrentList.Get(context);
            list.Add(new ItemOrder()
            {
                ItemId   = 1,
                ItemName = ItemName.Get(context),
                ItemQty  = ItemQty.Get(context),
                ItemUnit = ItemUnit.Get(context)
            });
            Result.Set(context, list);
        }
Ejemplo n.º 3
0
        public List <ItemQty> getRawMaterialDistributionTicketItems(int TicketID)
        {
            List <ItemQty> sm = new List <ItemQty>();

            using (SqlConnection conn = connect.getConnection())
            {
                using (SqlCommand cmd = new SqlCommand("getRawMaterialDistributionTicketItems", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ticketID", TicketID);
                    try
                    {
                        ItemQty       _sm    = new ItemQty();
                        SqlDataReader reader = cmd.ExecuteReader();
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                _sm = new ItemQty
                                {
                                    ItemId           = Convert.ToInt32(reader["ItemId"]),
                                    RawMaterialDisId = Convert.ToInt32(reader["RawMaterialDisID"]),
                                    RawMaterialId    = Convert.ToInt32(reader["RawMaterialId"]),
                                    MaterialName     = reader["MaterialName"] is DBNull ? null : (String)reader["MaterialName"],
                                    measurement      = reader["measurement"] is DBNull ? null : (String)reader["measurement"],
                                    Qty = Convert.ToInt32(reader["Qty"])
                                };

                                sm.Add(_sm);
                            }
                        }
                        else
                        {
                            sm = null;
                        }
                    }
                    catch (Exception ex)
                    {
                        CommonUtilityClass.ExceptionLog(ex);
                    }
                }
            }

            return(sm);
        }
Ejemplo n.º 4
0
        /*//
         *  // SUMMARY
         *  // Create a panel that represents 1 item on a Pedido with the data, total, qty, name of item and number of item
         *  // Return: Canvas element to add on a Dockpanel
         */
        public Canvas CreatePedidoPanels(Item data, int PedidoId, ItemQty qty)
        {
            var             element = (DockPanel) new UIHelper().FindChildByName(Application.Current.MainWindow, "dockpanel", "PanelPedidos");
            int             loop    = element.Children.Count;
            Color           color   = (Color)ColorConverter.ConvertFromString("#FFE84040");
            SolidColorBrush myBrush = new SolidColorBrush(color);

            if ((loop % 2).Equals(0))
            {
                color = (Color)ColorConverter.ConvertFromString("#E8E8E8");
            }
            else
            {
                color = (Color)ColorConverter.ConvertFromString("#C9C8C8");
            }
            myBrush = new SolidColorBrush(color);

            #region Creating Canvas
            Canvas Canv = new Canvas();
            Canv.Name       = "Item" + PedidoId;
            Canv.Height     = 100;
            Canv.Background = myBrush;
            Canv.Margin     = new Thickness(0, 0, 0, 0);
            DockPanel.SetDock(Canv, Dock.Top);
            #endregion

            #region Grid
            //Creating 1st Grid
            Grid Grid1 = new Grid();

            Grid1.RowDefinitions.Add(new RowDefinition
            {
                Height = new GridLength(100, GridUnitType.Star),
            });
            Grid1.RowDefinitions.Add(new RowDefinition
            {
                Height = new GridLength(100, GridUnitType.Star),
            });
            Grid1.RowDefinitions.Add(new RowDefinition
            {
                Height = new GridLength(100, GridUnitType.Auto),
            });

            #endregion

            #region Textboxes
            Grid Grid2 = new Grid();
            Grid2.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength()
            });
            Grid2.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(20, GridUnitType.Star)
            });
            Grid2.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(20, GridUnitType.Star)
            });

            color   = (Color)ColorConverter.ConvertFromString("#FFE84040");
            myBrush = new SolidColorBrush(color);
            Button btnReduce = new Button();
            btnReduce.Content             = " - ";
            btnReduce.Height              = 20;
            btnReduce.Width               = 20;
            btnReduce.FontFamily          = new FontFamily("Comic Sans MS");
            btnReduce.Foreground          = Brushes.Black;
            btnReduce.FontWeight          = FontWeights.Bold;
            btnReduce.FontSize            = 11;
            btnReduce.Background          = myBrush; //#FFE84040
            btnReduce.Margin              = new Thickness(5, 5, 5, 5);
            btnReduce.HorizontalAlignment = HorizontalAlignment.Right;
            btnReduce.VerticalAlignment   = VerticalAlignment.Center;
            btnReduce.Uid = data.id.ToString();

            btnReduce.Click += reduceItemQty;
            Grid.SetColumn(btnReduce, 1);

            color   = (Color)ColorConverter.ConvertFromString("#FF138F00");
            myBrush = new SolidColorBrush(color);
            Button btnAddition = new Button();
            btnAddition.Content             = " + ";
            btnAddition.Height              = 20;
            btnAddition.Width               = 20;
            btnAddition.FontFamily          = new FontFamily("Comic Sans MS");
            btnAddition.Foreground          = Brushes.Black;
            btnAddition.FontWeight          = FontWeights.Bold;
            btnAddition.FontSize            = 11;
            btnAddition.Background          = myBrush;
            btnAddition.Margin              = new Thickness(5, 5, 5, 5);
            btnAddition.HorizontalAlignment = HorizontalAlignment.Right;
            btnAddition.VerticalAlignment   = VerticalAlignment.Center;
            btnAddition.Click              += IncrementQty;
            btnAddition.Uid = data.id.ToString();

            Grid.SetColumn(btnAddition, 2);

            Grid.SetRow(Grid2, 0);

            TextBlock Texto2 = new TextBlock();
            Texto2.FontSize            = 12;
            Texto2.FontWeight          = FontWeights.Bold;
            Texto2.Padding             = new Thickness(3);
            Texto2.VerticalAlignment   = VerticalAlignment.Center;
            Texto2.HorizontalAlignment = HorizontalAlignment.Right;
            Texto2.Text = "Cantidad x " + qty.Qty;
            Texto2.Name = "Texto2id_" + data.id;
            //Grid.SetRow(Texto2, 0);
            Grid.SetColumn(Texto2, 0);
            DockPanel.SetDock(Texto2, Dock.Top);

            TextBlock Texto3 = new TextBlock();
            Texto3.FontSize            = 13;
            Texto3.Padding             = new Thickness(3);
            Texto3.HorizontalAlignment = HorizontalAlignment.Left;
            Texto3.Text         = data.Description;
            Texto3.Height       = 45;
            Texto3.Width        = 160;
            Texto3.TextWrapping = TextWrapping.WrapWithOverflow;
            Texto3.Text         = data.Name;
            Texto3.Name         = "Texto3id_" + data.id;
            Grid.SetRow(Texto3, 1);
            DockPanel.SetDock(Texto3, Dock.Top);

            color   = (Color)ColorConverter.ConvertFromString("#232D33");
            myBrush = new SolidColorBrush(color);
            TextBlock Texto4 = new TextBlock();
            Texto4.FontSize            = 12;
            Texto4.Padding             = new Thickness(2);
            Texto4.HorizontalAlignment = HorizontalAlignment.Right;
            Texto4.Text         = string.Format("Total: ${0} pesos", (qty.Qty * qty.Price));
            Texto4.TextWrapping = TextWrapping.WrapWithOverflow;
            Texto4.Text         = "Total: $" + qty.Price * qty.Qty;
            Texto4.Name         = "Texto4id_" + data.id;
            Texto4.Background   = myBrush;
            Texto4.Foreground   = Brushes.White;
            Texto4.FontWeight   = FontWeights.Bold;
            Texto4.Height       = 20;
            Grid.SetRow(Texto4, 2);
            DockPanel.SetDock(Texto4, Dock.Top);

            Button btnEliminar = new Button();
            btnEliminar.Content             = "Eliminar";
            btnEliminar.Height              = 20;
            btnEliminar.Width               = 50;
            btnEliminar.FontFamily          = new FontFamily("Comic Sans MS");
            btnEliminar.Foreground          = Brushes.White;
            btnEliminar.FontWeight          = FontWeights.Bold;
            btnEliminar.FontSize            = 11;
            btnEliminar.Background          = Brushes.Black;
            btnEliminar.Margin              = new Thickness(15, 5, 5, 5);
            btnEliminar.HorizontalAlignment = HorizontalAlignment.Left;
            btnEliminar.VerticalAlignment   = VerticalAlignment.Center;
            btnEliminar.Click              += deleteItemfromPedido;
            btnEliminar.Uid = data.id.ToString();
            Grid.SetRow(btnEliminar, 2);
            #endregion

            #region Adding elements to canvas

            //Grid1.Children.Add(Texto1);
            Grid2.Children.Add(btnReduce);
            Grid2.Children.Add(btnAddition);
            Grid2.Children.Add(Texto2);
            Grid1.Children.Add(Grid2);
            //Grid1.Children.Add(Texto2);
            Grid1.Children.Add(Texto3);
            Grid1.Children.Add(Texto4);
            Grid1.Children.Add(btnEliminar);
            Canv.Children.Add(Grid1);
            return(Canv);

            #endregion
        }