Example #1
0
        public static Department Get(long deptId)
        {
            Department _currentDepartment = null;
            /*if (_currentDepartment == null)
            {*/
            IApplicationContext ctx = ContextRegistry.GetContext();
            var departmentLogic = ctx.GetObject("AppFrame.Service.IDepartmentLogic") as IDepartmentLogic;
            var criteria = new ObjectCriteria();
            criteria.AddEqCriteria("Active", 1);
            criteria.AddEqCriteria("DelFlg", (long)0);
            criteria.AddEqCriteria("DepartmentId", deptId);
            if (departmentLogic != null)
            {
                IList deptList = departmentLogic.FindAll(criteria);
                if (deptList != null && deptList.Count > 0)
                {
                    _currentDepartment = deptList[0] as Department;
                }
            }
            if (_currentDepartment == null)
            {
                return null;
            }
            // detach object to session

            return _currentDepartment;
            /*}
            else
            {
                return _currentDepartment;
            }*/
        }
 public override object Working()
 {
     IList productMasters = (IList)MainStockLogic.FetchAll(new LinqCriteria<MainStock>());
     //IList productMasters = ProductMasterLogic.LoadAllProductMasterWithType("%%");
     Flow.Session.Put(FlowConstants.PRODUCT_NAMES_LIST, productMasters);
     ObjectCriteria<Department> objectCriteria = new ObjectCriteria<Department>();
     objectCriteria.Add(x => x.DepartmentId > 0); // we don't get department 0 because department 0 is MAIN STOCK.
     IList<Department> departments = DepartmentLogic.FindAll(objectCriteria);
     Flow.Session.Put(FlowConstants.DEPARTMENTS, departments);
     return null;
 }
Example #3
0
        public void AddSubStock(Department department)
        {
            // lower range
            long subStockMin = Int64.Parse(department.DepartmentId.ToString().PadRight(4,'0').PadRight(5,'0'));
            // higher range
            long subStockMax = Int64.Parse(department.DepartmentId.ToString().PadRight(4, '0').PadRight(5,'9'));
            ObjectCriteria objectCriteria = new ObjectCriteria();
            objectCriteria.AddBetweenCriteria("DepartmentId",subStockMin,subStockMax );
            var maxId = DepartmentDAO.SelectSpecificType(objectCriteria, Projections.Max("DepartmentId"));
            var departmentId = maxId == null ?  Int64.Parse(department.DepartmentId.ToString().PadRight(4,'0').PadRight(5,'0')) + 1 : (Int64.Parse(maxId.ToString()) + 1);

            department.DepartmentId = departmentId;
            DepartmentDAO.Add(department);
        }
        public override object Working()
        {
            var stockOutCriteria = new ObjectCriteria<CoralPOS.Models.StockOut>();
            stockOutCriteria.Add(x => x.ConfirmFlg == 1);
            var confirmingStockOuts = (IList) StockOutLogic.FindAll(stockOutCriteria);
            IList<CoralPOS.Models.StockOut> fetchedStockOuts = new List<CoralPOS.Models.StockOut>();
            foreach (CoralPOS.Models.StockOut confirmingStockOut in confirmingStockOuts)
            {
                CoralPOS.Models.StockOut fetchedStockOut = StockOutLogic.Fetch(confirmingStockOut);
                MainStockLogic.UpdateStockQuantity(fetchedStockOut.StockOutDetails);
                fetchedStockOuts.Add(fetchedStockOut);
            }

            Flow.Session.Put(FlowConstants.CONFIRMING_STOCK_OUT_LIST,confirmingStockOuts);
            return null;
        }
Example #5
0
        /// <summary>
        /// Find all StockIn from database. No pagination.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public IList FindAll(ObjectCriteria criteria)
        {
            return (IList) HibernateTemplate.Execute(
                               delegate(ISession session)
                                   {
                                       //ISession session = HibernateTemplate.SessionFactory.OpenSession();
                                       try
                                       {
                                           ICriteria hibernateCriteria = session.CreateCriteria(typeof (StockIn));
                                           if (criteria != null)
                                           {
                                               IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                                               if (map.Count > 0)
                                               {
                                                   foreach (string key in map.Keys)
                                                   {
                                                       hibernateCriteria.CreateAlias(key, key);
                                                   }
                                                   AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(),
                                                                       criteria.GetOrder());

                                                   foreach (string key in map.Keys)
                                                   {
                                                       SubObjectCriteria subCriteria = null;
                                                       map.TryGetValue(key, out subCriteria);
                                                       AddCriteriaAndOrder(hibernateCriteria, subCriteria.GetWhere(),
                                                                           subCriteria.GetOrder());
                                                   }
                                               }
                                               else
                                               {
                                                   AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(),
                                                                       criteria.GetOrder());
                                               }
                                           }
                                           return hibernateCriteria.List();
                                       }
                                       finally
                                       {
                                           /*if (session != null)
                                           {
                                               session.Disconnect();
                                           }*/
                                       }
                                   });
        }
Example #6
0
        public Department Add(Department data)
        {
            ObjectCriteria objectCriteria = new ObjectCriteria();
            objectCriteria.AddLesserCriteria("DepartmentId", (long)10000);
            var maxId = DepartmentDAO.SelectSpecificType(objectCriteria, Projections.Max("DepartmentId"));
            var departmentId = maxId == null ? 1 : (Int64.Parse(maxId.ToString()) + 1);
            data.DepartmentId = departmentId;
            if (data.Active == 1)
            {
                DepartmentDAO.SetInActiveAll();
            }

            DepartmentDAO.Add(data);
            IList employees = data.Employees;
            SaveEmployees(employees,departmentId);

            return data;
        }
        /// <summary>
        /// Find all ProductMaster from database. No pagination.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public IList FindAll(ObjectCriteria criteria)
        {
            ISession session = DbUtility.getSession(HibernateTemplate);
            try
            {
                ICriteria hibernateCriteria = session.CreateCriteria(typeof(ProductMaster));
                if (criteria != null)
                {
                    IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                    if (map.Count > 0)
                    {
                        foreach (string key in map.Keys)
                        {
                            hibernateCriteria.CreateAlias(key, key);
                        }
                        AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());

                        foreach (string key in map.Keys)
                        {
                            SubObjectCriteria subCriteria = null;
                            map.TryGetValue(key, out subCriteria);
                            AddCriteriaAndOrder(hibernateCriteria, subCriteria.GetWhere(), subCriteria.GetOrder());
                        }
                    }
                    else
                    {
                        AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());
                    }
                }
                if(criteria.MaxResult > 0 )
                {
                    hibernateCriteria.SetMaxResults(criteria.MaxResult);
                }
                return hibernateCriteria.List();
            }
            finally
            {
                if (session != null)
                {
                    session.Close();
                }
            }
        }
        /// <summary>
        /// Find all PurchaseOrder from database. No pagination.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public IList FindAll(ObjectCriteria criteria)
        {
            ISession session = HibernateTemplate.SessionFactory.OpenSession();
            try
            {
                ICriteria hibernateCriteria = session.CreateCriteria(typeof(PurchaseOrder));
                if (criteria != null)
                {
                    IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                    if (map.Count > 0)
                    {
                        foreach (string key in map.Keys)
                        {
                            hibernateCriteria.CreateAlias(key, key);
                        }
                        AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());

                        foreach (string key in map.Keys)
                        {
                            SubObjectCriteria subCriteria = null;
                            map.TryGetValue(key, out subCriteria);
                            AddCriteriaAndOrder(hibernateCriteria, subCriteria.GetWhere(), subCriteria.GetOrder());
                        }
                    }
                    else
                    {
                        AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());
                    }
                }
                return hibernateCriteria.List();
            }
            finally
            {
                if (session != null)
                {
                    session.Close();
                }
            }
        }
Example #9
0
        /// <summary>
        /// Find all ReceiptOut from database. Has pagination.
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        public QueryResult FindPaging(ObjectCriteria criteria)
        {
            QueryResult queryResult = new QueryResult();
            if (criteria == null)
            {
                return null;
            }

            ISession session = HibernateTemplate.SessionFactory.OpenSession();
            try
            {
                int page = criteria.PageIndex;
                int pageSize = criteria.PageSize;
                queryResult.Page = page;

                int count = Count(criteria);
                if (count == 0)
                {
                   return null;
                }
                queryResult.TotalPage = (((count % pageSize == 0) ? (count / pageSize) : (count / pageSize + 1)));

                ICriteria hibernateCriteria = session.CreateCriteria(typeof(ReceiptOut));

                IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                if (map.Count > 0)
                {
                    foreach (string key in map.Keys)
                    {
                        hibernateCriteria.CreateAlias(key, key);
                    }
                    AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());

                    SubObjectCriteria subCriteria = null;
                    foreach (string key in map.Keys)
                    {
                        map.TryGetValue(key, out subCriteria);
                        AddCriteriaAndOrder(hibernateCriteria, subCriteria.GetWhere(), subCriteria.GetOrder());
                    }
                }
                else
                {
                    AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());
                }
                hibernateCriteria.SetFirstResult((page - 1) * pageSize);
                hibernateCriteria.SetMaxResults(pageSize);
                IList list = hibernateCriteria.List();
                if (list.Count == 0)
                {
                   return null;
                }
                else
                {
                   queryResult.Result = list;
                }
            }
            finally
            {
                if (session != null)
                {
                    session.Disconnect();
                }
            }

            return queryResult;
        }
 /// <summary>
 /// Find all EmployeeWorkingDay from database. Has pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public QueryResult FindPaging(ObjectCriteria criteria)
 {
     return EmployeeWorkingDayDAO.FindPaging(criteria);
 }
 /// <summary>
 /// Find all DepartmentManagement from database. Has pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public QueryResult FindPaging(ObjectCriteria criteria)
 {
     return DepartmentManagementDAO.FindPaging(criteria);
 }
 public IList FindByMaxDate(ObjectCriteria criteria)
 {
     var sqlString = new StringBuilder("select stock, max(stock.CreateDate) FROM StockHistory stock, Product p WHERE stock.Product.ProductId = p.ProductId ");
     foreach (SQLQueryCriteria crit in criteria.GetQueryCriteria())
     {
         sqlString.Append(" AND ")
                .Append(crit.PropertyName)
                .Append(" ")
                .Append(crit.SQLString)
                .Append(" :")
                .Append(crit.PropertyName)
                .Append(" ");
     }
     sqlString.Append(" Group BY pm.ProductMasterId");
     //criteria.AddQueryCriteria("productName", "Ao%");
     //var sqlString = "select * FROM Stock stock, Product p WHERE stock.Product_Id = p.Product_Id";
     return StockHistoryDAO.FindByMaxDate(sqlString.ToString(), criteria);
 }
        public void Process(StockHistory defect)
        {
            // find exist stock base on productid
            ObjectCriteria objectCriteria = new ObjectCriteria();
            objectCriteria.AddEqCriteria("Product.ProductId", defect.Product.ProductId);
            IList existList = StockHistoryDAO.FindAll(objectCriteria);

            if (existList.Count > 0) // exist stock ?
            {
                StockHistory existDefect = (StockHistory)existList[0];
                existDefect.DamageCount = defect.DamageCount;
                existDefect.Description = defect.Description;
                existDefect.ErrorCount = defect.ErrorCount;
                existDefect.LostCount = defect.LostCount;
                existDefect.GoodCount = defect.GoodCount;
                existDefect.Product = defect.Product;
                existDefect.ProductMaster = defect.ProductMaster;
                existDefect.Quantity = defect.Quantity;
                existDefect.Stock = defect.Stock;
                existDefect.UnconfirmCount = defect.UnconfirmCount;
                existDefect.UpdateDate = defect.UpdateDate;
                existDefect.UpdateId = defect.UpdateId;

                existDefect.ExclusiveKey = existDefect.ExclusiveKey + 1;
                defect.StockHistoryId = existDefect.StockHistoryId;

                StockHistoryDAO.Update(existDefect);
            }
            else
            {
                StockHistoryDAO.Add(defect);
            }
        }
 public void TempSave(IList saveStockViewList)
 {
     foreach (DepartmentStockView view in saveStockViewList)
     {
         foreach (DepartmentStock stock in view.DepartmentStocks)
         {
             DepartmentStockTemp temp = new DepartmentStockTempMapper().Convert(stock);
             ObjectCriteria crit = new ObjectCriteria();
             crit.AddEqCriteria("TempSave", 1);
             crit.AddEqCriteria("Fixed", 0);
             crit.AddEqCriteria("DelFlg", 0);
             crit.AddEqCriteria("DepartmentStockTempPK.DepartmentId",temp.DepartmentStockTempPK.DepartmentId);
             crit.AddEqCriteria("DepartmentStockTempPK.ProductId", temp.DepartmentStockTempPK.ProductId);
             IList list =DepartmentStockTempDAO.FindAll(crit);
             if(list == null || list.Count == 0)
             {
                 temp.TempSave = 1;
                 DepartmentStockTempDAO.Add(temp);
             }
             else
             {
                 DepartmentStockTemp tempSave = (DepartmentStockTemp) list[0];
                 tempSave.Quantity = temp.Quantity;
                 tempSave.GoodQuantity = temp.GoodQuantity;
                 tempSave.ErrorQuantity = temp.ErrorQuantity;
                 tempSave.LostQuantity = temp.LostQuantity;
                 tempSave.UnconfirmQuantity = temp.UnconfirmQuantity;
                 tempSave.DamageQuantity = temp.DamageQuantity;
                 tempSave.TempSave = 1;
                 DepartmentStockTempDAO.Update(tempSave);
             }
         }
     }
 }
        public IList FindByQuery(string sqlString, ObjectCriteria criteria)
        {
            List<SQLQueryCriteria> query = criteria.GetQueryCriteria();
            var paramNames = new List<string>();
            var values = new List<object>();
            foreach (SQLQueryCriteria crit in query)
            {
                //sqlString += " AND " + crit.PropertyName + " " + crit.SQLString + " :" + crit.PropertyName + " ";
                paramNames.Add(crit.PropertyName);
                values.Add(crit.Value);
            }

            IList list = HibernateTemplate.FindByNamedParam(sqlString, paramNames.ToArray(), values.ToArray());

            IList returnList = new ArrayList();
            for (int i = 0; i < list.Count; i++)
            {
                object[] obj = (object[]) list[i];
                long qty = Int64.Parse(obj[1].ToString());
                var result = new DepartmentStockSearchResult
                                 {
                                     DepartmentStock = ((DepartmentStock)obj[0]),
                                     SumQuantity = qty,
                                     SumInPrice = Int64.Parse(obj[2].ToString()),
                                     SumSellPrice = obj[3] != null ? ((DepartmentPrice)obj[3]).Price * qty : 0//Int64.Parse(obj[3].ToString())
                                 };
                returnList.Add(result);
            }
            return returnList;
        }
 /// <summary>
 /// Find all DepartmentStockTemp from database. No pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public IList FindAll(ObjectCriteria criteria)
 {
     return DepartmentStockTempDAO.FindAll(criteria);
 }
 /// <summary>
 /// Find all DepartmentStockTemp from database. Has pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public QueryResult FindPaging(ObjectCriteria criteria)
 {
     return DepartmentStockTempDAO.FindPaging(criteria);
 }
 public IList FindByQueryForDeptStock(string sqlString, ObjectCriteria criteria)
 {
     ISession session = DbUtility.getSession(HibernateTemplate);
     try
     {
         List<SQLQueryCriteria> query = criteria.GetQueryCriteria();
         var paramNames = new List<string>();
         var values = new List<object>();
         foreach (SQLQueryCriteria crit in query)
         {
             //sqlString += " AND " + crit.PropertyName + " " + crit.SQLString + " :" + crit.PropertyName + " ";
             paramNames.Add(crit.PropertyName);
             values.Add(crit.Value);
         }
         HibernateTemplate.MaxResults = criteria.MaxResult;
         IList list = HibernateTemplate.FindByNamedParam(sqlString, paramNames.ToArray(), values.ToArray());
         IList returnList = new ArrayList();
         for (int i = 0; i < list.Count; i++)
         {
             var stock = (DepartmentStock)((object[])list[i])[0];
             stock.Quantity = Int64.Parse(((object[])list[i])[1].ToString());
             returnList.Add(stock);
         }
         return returnList;
     }
     finally
     {
         session.Close();
     }
 }
 /// <summary>
 /// Find all StockHistory from database. Has pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public QueryResult FindPaging(ObjectCriteria criteria)
 {
     return StockHistoryDAO.FindPaging(criteria);
 }
        public IList FindStockQuantityForPurchaseOrder(string sqlString, ObjectCriteria criteria)
        {
            List<SQLQueryCriteria> query = criteria.GetQueryCriteria();
            var paramNames = new List<string>();
            var values = new List<object>();
            foreach (SQLQueryCriteria crit in query)
            {
                paramNames.Add(crit.PropertyName);
                values.Add(crit.Value);
            }

            IList list = HibernateTemplate.FindByNamedParam(sqlString, paramNames.ToArray(), values.ToArray());

            IList returnList = new ArrayList();
            for (int i = 0; i < list.Count; i++)
            {
                var obj = (object[])list[i];
                var result = new DepartmentStockSearchResult
                {
                    DepartmentStock = ((DepartmentStock)obj[0]),
                    DepartmentPrice = ((DepartmentPrice)obj[1])
                };
                returnList.Add(result);
            }
            return returnList;
        }
 /// <summary>
 /// Find all StockHistory from database. No pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public IList FindAll(ObjectCriteria criteria)
 {
     return StockHistoryDAO.FindAll(criteria);
 }
        public IList ListProductMasterStockQuery(string sqlString, ObjectCriteria criteria)
        {
            List<SQLQueryCriteria> query = criteria.GetQueryCriteria();
            var paramNames = new List<string>();
            var values = new List<object>();
            foreach (SQLQueryCriteria crit in query)
            {
                //sqlString += " AND " + crit.PropertyName + " " + crit.SQLString + " :" + crit.PropertyName + " ";
                paramNames.Add(crit.PropertyName);
                values.Add(crit.Value);
            }

            return HibernateTemplate.FindByNamedParam(sqlString, paramNames.ToArray(), values.ToArray());
        }
 /// <summary>
 /// Find all DepartmentManagement from database. No pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public IList FindAll(ObjectCriteria criteria)
 {
     return DepartmentManagementDAO.FindAll(criteria);
 }
        public object SelectSpecificType(ObjectCriteria criteria, IProjection type)
        {
            ISession session = HibernateTemplate.SessionFactory.OpenSession();
            try
            {
                ICriteria hibernateCriteria = session.CreateCriteria(typeof(DepartmentStock)).SetProjection(type); ;
                if (criteria != null)
                {
                    IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                    if (map.Count > 0)
                    {
                        foreach (string key in map.Keys)
                        {
                            hibernateCriteria.CreateAlias(key, key);
                        }
                        foreach (ICriterion criterion in criteria.GetWhere())
                        {
                            hibernateCriteria.Add(criterion);
                        }

                        SubObjectCriteria subCriteria;
                        foreach (string key in map.Keys)
                        {
                            map.TryGetValue(key, out subCriteria);
                            foreach (ICriterion criterion in subCriteria.GetWhere())
                            {
                                hibernateCriteria.Add(criterion);
                            }
                        }
                    }
                    else
                    {
                        foreach (ICriterion criterion in criteria.GetWhere())
                        {
                            hibernateCriteria.Add(criterion);
                        }
                    }
                }
                return (hibernateCriteria.List()[0]);
            }
            finally
            {
                if (session != null)
                {
                    session.Disconnect();
                }
            }
        }
 /// <summary>
 /// Find all EmployeeWorkingDay from database. No pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public IList FindAll(ObjectCriteria criteria)
 {
     return EmployeeWorkingDayDAO.FindAll(criteria);
 }
Example #26
0
 /// <summary>
 /// Find all Country from database. Has pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public QueryResult FindPaging(ObjectCriteria<Country> criteria)
 {
     return CountryDao.FindPaging(criteria);
 }
Example #27
0
 public System.Collections.IList FindAll(ObjectCriteria criteria)
 {
     throw new NotImplementedException();
 }
Example #28
0
 /// <summary>
 /// Find all Country from database. No pagination.
 /// </summary>
 /// <param name="criteria"></param>
 /// <returns></returns>
 public IList<Country> FindAll(ObjectCriteria<Country> criteria)
 {
     return CountryDao.FindAll(criteria);
 }
Example #29
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>
        private int Count(ObjectCriteria criteria)
        {
            ISession session = HibernateTemplate.SessionFactory.OpenSession();
            try
            {
                ICriteria hibernateCriteria = session.CreateCriteria(typeof(ReceiptOut)).SetProjection(Projections.RowCount()); ;
                if (criteria != null)
                {
                    IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                    if (map.Count > 0)
                    {
                        foreach (string key in map.Keys)
                        {
                            hibernateCriteria.CreateAlias(key, key);
                        }
                        foreach (ICriterion criterion in criteria.GetWhere())
                        {
                            hibernateCriteria.Add(criterion);
                        }

                        SubObjectCriteria subCriteria;
                        foreach (string key in map.Keys)
                        {
                            map.TryGetValue(key, out subCriteria);
                            foreach (ICriterion criterion in subCriteria.GetWhere())
                            {
                                hibernateCriteria.Add(criterion);
                            }
                        }
                    }
                    else
                    {
                        foreach (ICriterion criterion in criteria.GetWhere())
                        {
                            hibernateCriteria.Add(criterion);
                        }
                    }
                }
                return ((int)hibernateCriteria.List()[0]);
            }
            finally
            {
                if (session != null)
                {
                    session.Disconnect();
                }
            }
        }
 public IList FindByQuery(ObjectCriteria criteria)
 {
     var sql = new StringBuilder("SELECT s FROM DepartmentStockInDetail s, DepartmentStockIn deptStockIn, Product p, ProductMaster pm, DepartmentPrice price ");
     sql.Append("WHERE s.DepartmentStockInDetailPK.ProductId = p.ProductId AND p.ProductMaster.ProductMasterId = pm.ProductMasterId ");
     sql.Append(" AND pm.ProductMasterId = price.DepartmentPricePK.ProductMasterId ");
     sql.Append(" AND s.DepartmentStockInDetailPK.DepartmentId = price.DepartmentPricePK.DepartmentId ");
     sql.Append(" AND s.DepartmentStockInDetailPK.DepartmentId = deptStockIn.DepartmentStockInPK.DepartmentId ");
     sql.Append(" AND s.DepartmentStockInDetailPK.StockInId = deptStockIn.DepartmentStockInPK.StockInId");
     int i = 0;
     foreach (SQLQueryCriteria crit in criteria.GetQueryCriteria())
     {
         sql.Append(" AND ")
            .Append(crit.PropertyName)
            .Append(" ")
            .Append(crit.SQLString)
            .Append(" :")
            .Append(crit.PropertyName)
            .Append(i++)
            .Append(" ");
     }
     return DepartmentStockInDetailDAO.FindByQuery(sql.ToString(), criteria);
 }