コード例 #1
0
        internal int UpdateRecievedStock(StockBO stockBO)
        {
            DataAccessSqlHelper sqlHelper = new DataAccessSqlHelper(stockBO.ConString);
            SqlCommand          command   = sqlHelper.CreateCommand(CommandType.StoredProcedure);

            command.CommandText = "UpdateReceivedQuantityPharma";
            sqlHelper.AddParameter(command, "@UserId", stockBO.UserId, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@ShopID", stockBO.ShopId, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@ProductData", stockBO.ProductData, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@quantitydata", stockBO.StockData, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@UnitData", stockBO.UnitData, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@latitude", stockBO.Latitude, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@longitude", stockBO.Longitude, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@processName", stockBO.ProcessName, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@mobileTransactionDate", stockBO.mobileTransactionDate, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@SyncDate", stockBO.SyncDate, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@GpsSource", stockBO.GpsSource, ParameterDirection.Input);
            if (stockBO.MobileReferenceNo != string.Empty)
            {
                sqlHelper.AddParameter(command, "@mobileReferenceNo", stockBO.MobileReferenceNo, ParameterDirection.Input);
            }
            if (stockBO.mobileDate != null && stockBO.mobileDate != string.Empty && stockBO.mobileDate != "")
            {
                sqlHelper.AddParameter(command, "@mobileSyncDate", stockBO.mobileDate, ParameterDirection.Input);
            }
            return(Convert.ToInt32(sqlHelper.ExecuteNonQuery(command)));
        }
コード例 #2
0
 internal int UpdateVanStockRequest(StockBO stockBO)
 {
     try
     {
         DataAccessSqlHelper sqlHelper = new DataAccessSqlHelper(stockBO.ConString);
         SqlCommand          command   = sqlHelper.CreateCommand(CommandType.StoredProcedure);
         command.CommandText = "UpdateVanStockRequest";
         sqlHelper.AddParameter(command, "@UserId", stockBO.UserId, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@StoreId", stockBO.ShopId, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@StockStatus", 0, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@ProductData", stockBO.ProductData, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@StockData", stockBO.StockData, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@UnitData", stockBO.UnitData, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@Latitude", stockBO.Latitude, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@Longitude", stockBO.Longitude, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@ProcessName", stockBO.ProcessName, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@MobileTransactionDate", stockBO.mobileTransactionDate, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@SyncDate", stockBO.SyncDate, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@GpsSource", stockBO.GpsSource, ParameterDirection.Input);
         if (stockBO.MobileReferenceNo != string.Empty)
         {
             sqlHelper.AddParameter(command, "@MobileReferenceNo", stockBO.MobileReferenceNo, ParameterDirection.Input);
         }
         return(Convert.ToInt32(sqlHelper.ExecuteNonQuery(command)));
     }
     catch (Exception e)
     {
         string ex = e.Message;
     }
     return(0);
 }
コード例 #3
0
        public string OrderConsole(int id, OrderInputModel input)
        {
            input.GetRequestFromReST();

            StockBO stock = new StockBO(new Herds(HerdBO.GetXmlEntries()), id, input.Request.order.milk, input.Request.order.skins);

            Response.ContentType = "application/json";
            Response.StatusCode  = (int)stock.data[0];
            return((string)stock.data[1]);
        }
コード例 #4
0
        internal DataSet GetFinalSettlementDetails(StockBO stockBO)
        {
            DataAccessSqlHelper sqlHelper = new DataAccessSqlHelper(stockBO.ConString);
            SqlCommand          command   = sqlHelper.CreateCommand(CommandType.StoredProcedure);

            command.CommandText = "uspFinancialClosure";
            sqlHelper.AddParameter(command, "@Mode", stockBO.Mode, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@UserId", stockBO.UserId, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@StoreId", stockBO.StoreId, ParameterDirection.Input);

            return(sqlHelper.ExecuteDataSet(command));
        }
コード例 #5
0
 public string Herd(int?id)
 {
     if (id.HasValue)
     {
         StockBO stock = new StockBO(new Herds(HerdBO.GetXmlEntries()), id.Value);
         var     t     = stock.Herd.GetJSONStock(id.Value);
         return(t);
     }
     else
     {
         return("No day index");
     }
 }
コード例 #6
0
        public void AddStockRecord(StockBO objStockBO)
        {
            DbConnection  objDbConnection = DbConnection.GetInstance();
            SqlConnection con             = objDbConnection.GetConnection();

            con.Open();
            SqlCommand cmd = new SqlCommand("Insert Into dbo.Stock (StockName,StockType,StockCount,StockDate) Values (@StockName,@StockType,@StockCount,@StockDate)", con);

            cmd.Parameters.Add(new SqlParameter("@StockName", objStockBO.StockName));
            cmd.Parameters.Add(new SqlParameter("@StockType", objStockBO.StockType));
            cmd.Parameters.Add(new SqlParameter("@StockCount", objStockBO.StockCount));
            cmd.Parameters.Add(new SqlParameter("@StockDate", objStockBO.StockDate));
            cmd.ExecuteNonQuery();
        }
コード例 #7
0
        internal int GetUserStoreId(StockBO stockBO)
        {
            DataAccessSqlHelper sqlHelper = new DataAccessSqlHelper(stockBO.ConString);
            SqlCommand          command   = sqlHelper.CreateCommand(CommandType.Text);

            try
            {
                command.CommandText = "SELECT st.storeid from store st INNER JOIN Organization org ON org.organizationId = st.organizationId INNER JOIN UserOrganization uo ON uo.organizationid = org.organizationid and uo.userid = '" + stockBO.UserId + "'";
                return(Convert.ToInt32(sqlHelper.ExecuteScalar(command)));
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
コード例 #8
0
        internal int UpdateLoadedStock(StockBO stockBO)
        {
            DataAccessSqlHelper sqlHelper = new DataAccessSqlHelper(stockBO.ConString);
            SqlCommand          command   = sqlHelper.CreateCommand(CommandType.StoredProcedure);

            command.CommandText = "uspStock";
            sqlHelper.AddParameter(command, "@Mode", stockBO.Mode, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@UserId", stockBO.UserId, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@ProductData", stockBO.ProductData, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@StockData", stockBO.StockData, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@UnitData", stockBO.UnitData, ParameterDirection.Input);
            sqlHelper.AddParameter(command, "@StockHeaderId", stockBO.StockHeaderId, ParameterDirection.Input);

            return(Convert.ToInt32(sqlHelper.ExecuteNonQuery(command)));
        }
コード例 #9
0
        public ActionResult Stock(int?id)
        {
            if (id.HasValue)
            {
                StockBO stock         = new StockBO(new Herds(HerdBO.GetXmlEntries()), id.Value);
                string  t             = stock.GetJSONStock(id.Value);
                string  jsonFormatted = JValue.Parse(t).ToString(Newtonsoft.Json.Formatting.Indented);
                ViewBag.str = jsonFormatted;
            }
            else
            {
                ViewBag.str = "No day index";
            }

            return(View());
        }
コード例 #10
0
        public ActionResult Herd()
        {
            int id;

            if (int.TryParse(Request.QueryString.Get("id"), out id))
            {
                StockBO stock         = new StockBO(new Herds(HerdBO.GetXmlEntries()), id);
                var     t             = stock.Herd.GetJSONStock(id);
                string  jsonFormatted = JValue.Parse(t).ToString(Newtonsoft.Json.Formatting.Indented);
                ViewBag.str = jsonFormatted;
            }
            else
            {
                ViewBag.str = "No day index";
            }

            return(View());
        }
コード例 #11
0
        public void AddProductToStockBL(TypeBO objTypeBO)
        {
            StockBO   objStockBO   = new StockBO();
            StockDA   objStockDA   = new StockDA();
            TypeDA    objTypeDA    = new TypeDA();
            ProductDA objProductDA = new ProductDA();

            objStockBO.StockName  = objProductDA.GetProductName(objTypeBO.ProductID);
            objStockBO.StockType  = objTypeBO.TypeName;
            objStockBO.StockCount = objTypeBO.TypeCount;
            objStockBO.StockDate  = DateTime.Today;

            int oldCount = objTypeDA.GetOldTypeCount(objTypeBO.TypeName, objTypeBO.ProductID);

            objTypeBO.TypeCount = objTypeBO.TypeCount + oldCount;

            objTypeDA.AddProductToStockDA(objTypeBO);
            objStockDA.AddStockRecord(objStockBO);
        }
コード例 #12
0
 internal int UpdateStock(StockBO stockBO)
 {
     try
     {
         DataAccessSqlHelper sqlHelper = new DataAccessSqlHelper(stockBO.ConString);
         SqlCommand          command   = sqlHelper.CreateCommand(CommandType.StoredProcedure);
         command.CommandText = "StockCapture";
         sqlHelper.AddParameter(command, "@UserId", stockBO.UserId, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@ShopID", stockBO.ShopId, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@ProductData", stockBO.ProductData, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@quantitydata", stockBO.StockData, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@UnitData", stockBO.UnitData, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@latitude", stockBO.Latitude, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@longitude", stockBO.Longitude, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@processName", stockBO.ProcessName, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@mobileTransactionDate", stockBO.mobileTransactionDate, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@SyncDate", stockBO.SyncDate, ParameterDirection.Input);
         sqlHelper.AddParameter(command, "@GpsSource", stockBO.GpsSource, ParameterDirection.Input);
         if (stockBO.MobileReferenceNo != string.Empty)
         {
             sqlHelper.AddParameter(command, "@mobileReferenceNo", stockBO.MobileReferenceNo, ParameterDirection.Input);
         }
         if (stockBO.mobileDate != null && stockBO.mobileDate != string.Empty && stockBO.mobileDate != "")
         {
             sqlHelper.AddParameter(command, "@mobileSyncDate", stockBO.mobileDate, ParameterDirection.Input);
         }
         if (stockBO.signalStrength != null && stockBO.signalStrength != string.Empty && stockBO.signalStrength != "")
         {
             sqlHelper.AddParameter(command, "@signalStrength", stockBO.signalStrength, ParameterDirection.Input);
         }
         if (stockBO.networkProvider != null && stockBO.networkProvider != string.Empty && stockBO.networkProvider != "")
         {
             sqlHelper.AddParameter(command, "@networkProvider", stockBO.networkProvider, ParameterDirection.Input);
         }
         return(Convert.ToInt32(sqlHelper.ExecuteNonQuery(command)));
     }
     catch (Exception e)
     {
         string ex = e.Message;
     }
     return(0);
 }
コード例 #13
0
        static void TestJsonHerd()
        {
            int day;

            Console.WriteLine("Enter number of the day for JSON stock!!!");
            string input = Console.ReadLine();

            if (int.TryParse(input, out day))
            {
                StockBO stock = new StockBO(new Herds(HerdBO.GetXmlEntries()), day);
                Console.WriteLine(stock.Herd.GetJSONStock(day));
                Main();
            }
            else
            {
                Console.WriteLine("You entered a string!!! Try again");
                Console.WriteLine();
                TestJsonStock();
            }
        }
コード例 #14
0
        static void TestSheep()
        {
            int dayNum;

            Console.WriteLine("Enter number of the day!!!");

            var            dayNumString = Console.ReadLine();
            List <Animals> aList        = new List <Animals>();
            Herds          herd;
            StockBO        stock;
            var            context = new ABusiness.ABEntities();

            if (int.TryParse(dayNumString, out dayNum))
            {
                herd = new Herds(HerdBO.GetXmlEntries());

                stock = new StockBO(herd, dayNum);

                Console.WriteLine();
                Console.WriteLine("In Stock:");
                Console.WriteLine("   " + string.Format("{0:0.000}", stock.ReturnMilkStock()) + " liters of milk");
                Console.WriteLine("   " + stock.ReturnSkinStock().ToString() + " skins of wool");
                Console.WriteLine("Herd: ");

                foreach (string str in stock.GetHerdAges())
                {
                    Console.WriteLine(str);
                }

                Console.WriteLine();
                Main();
            }
            else
            {
                Console.WriteLine("You entered a string!!! Try again");
                Console.WriteLine();
                TestSheep();
            }
        }
コード例 #15
0
        public string Order(int?id, Decimal?milk, int?skins)
        {
            int     day;
            Decimal milkQ;
            int     skinsQ;

            if (!id.HasValue || !milk.HasValue || !skins.HasValue)
            {
                return("Missing data");
            }
            else
            {
                day    = id.Value;
                milkQ  = milk.Value;
                skinsQ = skins.Value;

                StockBO stock = new StockBO(new Herds(HerdBO.GetXmlEntries()), day, milkQ, skinsQ);

                Response.ContentType = "application/json";
                Response.StatusCode  = (int)stock.data[0];
                return((string)stock.data[1]);
            }
        }