コード例 #1
0
        public string CheckItems(SellItems aSell)
        {
            Query   = "SELECT * FROM ItemCheckView Where SupplierId='" + aSell.SupplierId + "' AND ItemName=@itemName AND Status='true'";
            Command = new SqlCommand(Query, Connection);
            Command.Parameters.Clear();
            Command.Parameters.Add("itemName", SqlDbType.VarChar);
            Command.Parameters["itemName"].Value = aSell.ItemName;
            string msg = null;

            Connection.Open();
            Reader = Command.ExecuteReader();
            if (Reader.Read())
            {
                var qty = (int)Reader["RemainingQty"];
                if (aSell.Qty >= qty)
                {
                    msg = "no";
                }
                else
                {
                    msg = "yes";
                }
            }
            Reader.Close();
            Connection.Close();
            return(msg);
        }
コード例 #2
0
        public List <Sell> GetItemsByBillNo(string nestId)
        {
            List <Sell> aSell = new List <Sell>();

            Query   = "SELECT * FROM Sell WHERE BillNo='" + nestId + "' AND status='true' OR status='false'";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();

            if (Reader.Read())
            {
                Sell ap = new Sell();
                ap.Id       = (int)Reader["Id"];
                ap.Date     = (DateTime)Reader["Date"];
                ap.Name     = Reader["Name"].ToString();
                ap.MobileNo = Reader["MobileNo"].ToString();
                ap.Email    = Reader["Email"].ToString();

                decimal totalAmount = (decimal)Reader["TotalAmount"];

                ap.TotalAmount = (float)totalAmount;
                aSell.Add(ap);
            }
            Reader.Close();
            Connection.Close();
            Query   = "SELECT * FROM SellItems WHERE BillNo='" + aSell[0].Id + "' AND status='true' OR status='false'";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                SellItems aSellItem = new SellItems();
                aSellItem.ItemName = Reader["ItemName"].ToString();
                aSellItem.Qty      = (int)Reader["Qty"];

                decimal price = (decimal)Reader["Price"];
                aSellItem.Price = (float)price;

                decimal amount = (decimal)Reader["Amount"];
                aSellItem.Amount = (float)amount;
                aSell[0].SellItemses.Add(aSellItem);
            }
            Reader.Close();
            Connection.Close();
            return(aSell);
        }
コード例 #3
0
        public JsonResult CheckItem(SellItems aSell)
        {
            string status = null;
            //Global.Id = O.InvoiceNo;
            string message = aSellManager.CheckItems(aSell);

            if (message == "yes")
            {
                status = message;
                ModelState.Clear();
            }
            else if (message == "no")
            {
                status = message;
            }
            else
            {
                status = message;
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
コード例 #4
0
ファイル: ColonyManager.cs プロジェクト: bpgabin/red-rover
 public void SellItem(SellItems item)
 {
     m_money += m_sell[item];
 }
コード例 #5
0
 public string CheckItems(SellItems aSell)
 {
     return(aSellGateway.CheckItems(aSell));
 }