コード例 #1
0
ファイル: WorkOrderBll.cs プロジェクト: jimidzj/Inspect
        public void DoDeleteWorkOrder(List<MESParameterInfo> lstParameters)
        {
            try
            {
                dbInstance.BeginTransaction();
                WorkOrderDtlDal dtlDal = new WorkOrderDtlDal(dbInstance);

                //List<tinpworkorderdtl> lstDtl = dtlDal.GetSelectedObjects<tinpworkorderdtl>(lstParameters, string.Empty, true, -1);

                //for (int i = 0; i < lstDtl.Count; i++)
                //{
                //    List<MESParameterInfo> lstCustOrderParams = new List<MESParameterInfo>() {
                //            new MESParameterInfo(){ParamName="custorderno",ParamValue=lstDtl[i].custorderno},
                //            new MESParameterInfo(){ParamName="styleno",ParamValue=lstDtl[i].styleno},
                //            new MESParameterInfo(){ParamName="checktype",ParamValue=lstDtl[i].checktype}
                //        };

                //    //do delete

                //}

                //delete detail
                dtlDal.DoDelete<tinpworkorderdtl>(lstParameters);

                //delete main
                baseDal.DoDelete<tinpworkorder>(lstParameters);

                dbInstance.Commit();
            }
            catch (Exception ex)
            {
                dbInstance.Rollback();
                throw ex;
            }
            finally
            {
                dbInstance.CloseConnection();
            }
        }
コード例 #2
0
ファイル: WorkOrderBll.cs プロジェクト: jimidzj/Inspect
        private void CheckDelete(CustOrderDal custOrderDal,WorkOrderDtlDal dtlDal,
            tinpworkorder workorder,List<tinpworkorderdtl> lstDtl)
        {
            List<MESParameterInfo> lstParams = new List<MESParameterInfo>() {
                            new MESParameterInfo(){ParamName="workordersysid",ParamValue=workorder.workordersysid}
                        };

            List<tinpworkorderdtl> lstOldDtl = dtlDal.GetSelectedObjects<tinpworkorderdtl>(lstParams, string.Empty, true, -1);
            for (int i = 0; i < lstOldDtl.Count; i++)
            {
                var q = (from p in lstDtl
                         where p.custorderno == lstOldDtl[i].custorderno
                         && p.styleno == lstOldDtl[i].styleno
                         && p.checktype == lstOldDtl[i].checktype
                         select p).ToList();
                if (q.Count <= 0)
                {
                    //need to delete

                    //do delete
                    dtlDal.DoDelete<tinpworkorderdtl>(lstParams);
                }
            }
        }