Exemplo n.º 1
0
 public DataTable GetProducts2()
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ProductDao productDao = new ProductDao();
         return productDao.FindProduct2();
     }
 }
Exemplo n.º 2
0
 //public void AddProduct(string productCode, string productName, string unitCode, string original, string years, string brand,
 //    string grade, string style, string type, string unit, string characteristics, string productNo)
 //{
 //    using (PersistentManager pm = new PersistentManager())
 //    {
 //        try
 //        {
 //            pm.BeginTransaction();
 //            ProductDao productDao = new ProductDao();
 //            if (productDao.Find(productCode) == 0)
 //                productDao.Insert(productCode, productName, unitCode, original, years, brand, grade, style, type, unit, characteristics, productNo);
 //            else
 //                throw new Exception("��Ʒ�Ѵ��ڣ����������롣");
 //            pm.Commit();
 //        }
 //        catch (Exception e)
 //        {
 //            pm.Rollback();
 //            throw new Exception(e.Message);
 //        }
 //    }
 //}
 //public void SaveProduct(string productCode, string productName, string unitCode, string original, string years, string brand,
 //    string grade, string style, string type, string unit, string characteristics, string productNo)
 //{
 //    using (PersistentManager pm = new PersistentManager())
 //    {
 //        ProductDao productDao = new ProductDao();
 //        productDao.Update(productCode, productName, unitCode, original, years, brand, grade, style, type, unit, characteristics, productNo);
 //    }
 //}
 public void DeleteProduct(string productCode)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ProductDao productDao = new ProductDao();
         productDao.Delete(productCode);
     }
 }
Exemplo n.º 3
0
 public DataTable GetProducts(string scheduleNo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ProductDao productDao = new ProductDao();
         return productDao.FindBySchedule(scheduleNo);
     }
 }
Exemplo n.º 4
0
 public void DeleteUnit(string unitCode)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ProductDao productDao = new ProductDao();
         UnitDao unitDao = new UnitDao();
         unitDao.DeleteUnit(unitCode);
         //if (productDao.FindUnit(unitCode) == 0)
         //    unitDao.DeleteUnit(unitCode);
         //else
         //    throw new Exception("������λ��ʹ�ã����ܽ���ɾ��������");
     }
 }
Exemplo n.º 5
0
        private void SaveFormula(bool isAdd, string formulaCode, string formulaName, string formulaDate, string cigaretteName, string quantity, string operater, string formulaNo, DataTable detailTable)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                FormulaDao formulaDao = new FormulaDao();
                ProductDao productDao = new ProductDao();
                try
                {
                    pm.BeginTransaction();

                    if (isAdd)
                        formulaDao.InserMaster(formulaCode, formulaName, formulaDate, cigaretteName, quantity, formulaNo, operater);
                    else
                        formulaDao.UpdateMaster(formulaCode, formulaName, formulaDate, cigaretteName, quantity, formulaNo, operater);

                    formulaDao.DeleteDetail(formulaCode);
                    for (int i = 0; i < detailTable.Rows.Count; i++)
                    {
                        DataRow row = detailTable.Rows[i];
                        string productCode = row["PRODUCTCODE"].ToString().ToUpper();

                        formulaDao.InsertDetail(formulaCode,
                                                productCode,
                                                i.ToString(),
                                                row["QUANTITY"].ToString(),
                                                row["OTHERCODE"].ToString());

                        if (productDao.Find(productCode) == 0)
                        {
                            productDao.Insert(productCode,
                                         row["ORIGINAL"].ToString(),
                                         row["YEARS"].ToString(),
                                         row["GRADE"].ToString(),
                                         row["STYLE"].ToString());
                        }
                        else
                        {
                            productDao.Update(productCode,
                                         row["ORIGINAL"].ToString(),
                                         row["YEARS"].ToString(),
                                         row["GRADE"].ToString(),
                                         row["STYLE"].ToString());
                        }
                    }
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }