protected bool Exists(PbknityarncountModel model, bool isNew)
        {
            PbknityarncountTable table = new PbknityarncountTable();
            SelectSqlSection     sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                         .Where(table.YarnCount == model.YarnCount &&
                                                table.IsActive == model.IsActive
                                                );

            return(sql.ToScalar <int>() > 0);
        }
Exemple #2
0
        protected bool Exists(QcfinishdtlModel model, bool isNew)
        {
            QcfinishdtlTable table = new QcfinishdtlTable();
            SelectSqlSection sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                     .Where(table.Iden == model.Iden &&
                                            table.QualityCode == model.QualityCode &&
                                            table.FinishingCode == model.FinishingCode
                                            );

            return(sql.ToScalar <int>() > 0);
        }
        protected bool Exists(PbknitdyemethodModel model, bool isNew)
        {
            PbknitdyemethodTable table = new PbknitdyemethodTable();
            SelectSqlSection     sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                         .Where(table.DyeMethod == model.DyeMethod &&
                                                table.DyeType == model.DyeType &&
                                                table.Description == model.Description
                                                );

            return(sql.ToScalar <int>() > 0);
        }
Exemple #4
0
        protected bool Exists(PbknitparameterModel model, bool isNew)
        {
            PbknitparameterTable table = new PbknitparameterTable();
            SelectSqlSection     sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                         .Where(table.Sort == model.Sort &&
                                                table.Parameter == model.Parameter &&
                                                table.IsActive == model.IsActive
                                                );

            return(sql.ToScalar <int>() > 0);
        }
        protected bool Exists(PbknitfinishModel model, bool isNew)
        {
            PbknitfinishTable table = new PbknitfinishTable();
            SelectSqlSection  sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                      .Where(table.FinishingCode == model.FinishingCode &&
                                             table.FinishingName == model.FinishingName &&
                                             table.Description == model.Description &&
                                             table.WashingFlag == model.WashingFlag &&
                                             table.IsActive == model.IsActive
                                             );

            return(sql.ToScalar <int>() > 0);
        }
Exemple #6
0
        protected bool Exists(PbknityarntypeModel model, bool isNew)
        {
            PbknityarntypeTable table = new PbknityarntypeTable();
            SelectSqlSection    sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                        .Where(table.YarnType == model.YarnType &&
                                               table.Description == model.Description &&
                                               table.IeDescription == model.IeDescription &&
                                               table.CustomerDescription == model.CustomerDescription &&
                                               table.IsActive == model.IsActive
                                               );

            return(sql.ToScalar <int>() > 0);
        }
        protected bool Exists(QcmaininfologModel model, bool isNew)
        {
            QcmaininfologTable table = new QcmaininfologTable();
            SelectSqlSection   sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                       .Where(table.QualityCode == model.QualityCode &&
                                              table.Status == model.Status &&
                                              table.EditReason == model.EditReason &&
                                              table.EditorContent == model.EditorContent &&
                                              table.Editor == model.Editor &&
                                              table.EditorTime == model.EditorTime
                                              );

            return(sql.ToScalar <int>() > 0);
        }
Exemple #8
0
        protected bool Exists(PbknitconstructionModel model, bool isNew)
        {
            PbknitconstructionTable table = new PbknitconstructionTable();
            SelectSqlSection        sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                            .Where(table.Construction == model.Construction &&
                                                   table.Description == model.Description &&
                                                   table.DescriptionCn == model.DescriptionCn &&
                                                   table.SingleDouble == model.SingleDouble &&
                                                   table.IsSpecial == model.IsSpecial &&
                                                   table.IsActive == model.IsActive
                                                   );

            return(sql.ToScalar <int>() > 0);
        }
Exemple #9
0
        protected bool Exists(QcyarndtlModel model, bool isNew)
        {
            QcyarndtlTable   table = new QcyarndtlTable();
            SelectSqlSection sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                     .Where(table.Iden == model.Iden &&
                                            table.QualityCode == model.QualityCode &&
                                            table.YarnType == model.YarnType &&
                                            table.YarnCount == model.YarnCount &&
                                            table.Threads == model.Threads &&
                                            table.YarnRatio == model.YarnRatio &&
                                            table.WarpWeft == model.WarpWeft &&
                                            table.YarnDensity == model.YarnDensity
                                            );

            return(sql.ToScalar <int>() > 0);
        }
        protected bool Exists(QcavailablewidthModel model, bool isNew)
        {
            QcavailablewidthTable table = new QcavailablewidthTable();
            SelectSqlSection      sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                          .Where(table.Iden == model.Iden &&
                                                 table.QualityCode == model.QualityCode &&
                                                 table.Gauge == model.Gauge &&
                                                 table.Diameter == model.Diameter &&
                                                 table.TotalNeedles == model.TotalNeedles &&
                                                 table.Width == model.Width &&
                                                 table.MaxWidth == model.MaxWidth &&
                                                 table.UpdatedBy == model.UpdatedBy &&
                                                 table.UpdatedTime == model.UpdatedTime
                                                 );

            return(sql.ToScalar <int>() > 0);
        }
        protected bool Exists(QccustomerlibraryModel model, bool isNew)
        {
            QccustomerlibraryTable table = new QccustomerlibraryTable();
            SelectSqlSection       sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                           .Where(table.Iden == model.Iden &&
                                                  table.QualityCode == model.QualityCode &&
                                                  table.BuyerId == model.BuyerId &&
                                                  table.Brand == model.Brand &&
                                                  table.CustomerQualityId == model.CustomerQualityId &&
                                                  table.Sales == model.Sales &&
                                                  table.SalesGroup == model.SalesGroup &&
                                                  table.MillComments == model.MillComments &&
                                                  table.IsFirstOwner == model.IsFirstOwner &&
                                                  table.CreateDate == model.CreateDate &&
                                                  table.Creator == model.Creator
                                                  );

            return(sql.ToScalar <int>() > 0);
        }
Exemple #12
0
        public static int SetRangeSql(ref SelectSqlSection sql, QueryTable table, QueryColumn IkeyColumn, int startPage, int pageSize, string orderByField)
        {
            string[] origanalStr = sql.ColumnNames;
            sql.ColumnNames = new string[] { "COUNT(*)" };
            int count = Convert.ToInt32(sql.ToScalar());

            if (!string.IsNullOrEmpty(orderByField))
            {
                string[] orderStr = orderByField.Split(new char[] { '*' });
                try
                {
                    QueryColumn qc = TableMapModel.GetTableColumnByProName(orderStr[0], table);

                    if (orderStr[1].Contains("Asc"))  //升序
                    {
                        sql.OrderBy(qc.Asc, IkeyColumn.Asc);
                    }
                    if (orderStr[1].Contains("Desc"))  //降序
                    {
                        sql.OrderBy(qc.Desc, IkeyColumn.Asc);
                    }
                }
                catch (Exception e)
                {
                    // throw e;
                }
            }

            int wPageSize = pageSize;

            if (pageSize * startPage > count)
            {
                wPageSize = count - pageSize * (startPage - 1);
            }
            if (pageSize > 0 && startPage > 0 && wPageSize > 0)
            {
                sql.SetSelectRange(wPageSize, pageSize * (startPage - 1), IkeyColumn);
            }

            sql.ColumnNames = origanalStr;

            return(count);
        }