Пример #1
0
        private String BuildInsertCommand(InvDetails details)
        {
            String        command;
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Values({0}, '{1}' ,'{2}',{3})", details.CheckNumber, details.MaterialId, details.ProductionId, details.Amount);
            String prefix = "INSERT INTO GLN_ICheckDetailes  " + "(CheckNumber,NumMaterial,ProductionID, AmountCheck) ";

            command = prefix + sb.ToString();

            return(command);
        }
Пример #2
0
        public int InsertDetailsToDB(InvDetails details)
        {
            SqlConnection con;
            SqlCommand    cmd;

            try
            {
                con = Connect("DBConnectionString"); // create the connection
            }
            catch (Exception ex)
            {
                // write to log
                throw (ex);
            }

            String cStr        = "";
            int    numEffected = 0;

            try
            {
                cStr = BuildInsertCommand(details); // helper method to build the insert string
                cmd  = CreateCommand(cStr, con);    // create the command
                int numE = cmd.ExecuteNonQuery();   // execute the command
                //numEffected = Convert.ToInt32(cmd.ExecuteScalar());
                numEffected += cmd.ExecuteNonQuery();

                return(numEffected);
            }
            catch (Exception ex)
            {
                Console.WriteLine(cStr);
                return(0);

                // write to log
                throw (ex);
            }

            finally
            {
                if (con != null)
                {
                    // close the db connection
                    con.Close();
                }
            }
        }
Пример #3
0
        [Route("api/InventoryCheck/InsertCheckDetalis")] //הכנסת פרטי הוצאה לפי מספר הוצאה שקיבלנו מפוסט קודם
        // לפי - מספר ספירה, מקט, מחלקה וכמות
        public void postdetailsCheck([FromBody] InvDetails detailsC)
        {
            InvDetails c = new InvDetails();

            c.insert(detailsC);
        }