Exemplo n.º 1
0
 public Cake_BatchWPF(Cake_Batch cake)
 {
     this.Id       = cake.ID;
     this.So_id    = cake.SO_ID;
     this.Cake     = new CakeWPF(cake.Cake);
     this.Flavor   = new FlavorWPF(cake.Flavor);
     this.Quantity = cake.Quantity;
 }
Exemplo n.º 2
0
        public Cake_Batch ToCake_Batch()
        {
            Cake_Batch bat = new Cake_Batch();

            bat.ID       = this.Id;
            bat.SO_ID    = this.So_id;
            bat.Cake     = this.Cake.ToCake();
            bat.Flavor   = this.Flavor.ToFlavor();
            bat.Quantity = this.Quantity;
            return(bat);
        }
Exemplo n.º 3
0
        public bool AddSO_Cake(int SO_ID, Cake_Batch batch)
        {
            try
            {
                Dictionary <string, string> data = new Dictionary <string, string>();
                data.Add("so_id", SO_ID.ToString());
                data.Add("cake_id", batch.Cake.ID.ToString());
                data.Add("flavor", batch.Flavor.ID.ToString());
                data.Add("qty", batch.Quantity.ToString());

                dbComm.Insert("Cake_Batch", data);
                return(true);
            }
            catch (Exception ex)
            {
                Log("AddSO_Cake(int,Cake_Batch) - Error msg:" + ex.Message);
                return(false);
            }
        }
Exemplo n.º 4
0
        public bool UpdateSpecialOrderCake(int SO_ID, Cake_Batch updateCake)
        {
            try
            {
                Dictionary <string, string> data = new Dictionary <string, string>();
                data.Add("so_id", SO_ID.ToString());
                data.Add("cake_id", updateCake.Cake.ID.ToString());
                data.Add("flavor", updateCake.Flavor.ID.ToString());
                data.Add("qty", updateCake.Quantity.ToString());

                dbComm.Update("Cake_Batch", data, String.Format("id = {0}", updateCake.ID));
                return(true);
            }
            catch (Exception ex)
            {
                Log("UpdateSpecialOrderBatch(int,SO_Batch) - Error msg:" + ex.Message);
                return(false);
            }
        }
Exemplo n.º 5
0
        public List <Cake_Batch> GetSOCakes(int SO_ID, bool closeDB = true)
        {
            List <Cake_Batch> cakes = new List <Cake_Batch>();

            try
            {
                using (SQLiteDataReader rdr = dbComm.ExecuteCommand(@"SELECT * FROM Cake_Batch WHERE so_id =" + SO_ID))
                {
                    while (rdr.Read())
                    {
                        Cake_Batch itm = new Cake_Batch();
                        itm.ID     = int.Parse(rdr["id"].ToString());
                        itm.SO_ID  = int.Parse(rdr["so_id"].ToString());
                        itm.Cake   = GetCake(int.Parse(rdr["cake_id"].ToString()), false);
                        itm.Flavor = GetFlavor(int.Parse(rdr["flavor"].ToString()), false);
                        // check to see if flavor is null, if so replace ID = 0 (not found) then re-call GetFlavor()
                        if (itm.Flavor == null)
                        {
                            itm.Flavor = GetFlavor(0, false);
                        }
                        itm.Quantity = int.Parse(rdr["qty"].ToString());
                        cakes.Add(itm);
                    }
                    if (closeDB)
                    {
                        dbComm.Close();
                    }
                }
                return(cakes);
            }
            catch (Exception ex)
            {
                Log("GetSOCakes(int) - Error msg:" + ex.Message);
                return(null);
            }
        }
 public bool AddSpecialOrderCakeBatch(int SO_ID, Cake_Batch cakeBatch)
 {
     return(lck.AddSO_Cake(SO_ID, cakeBatch));
 }