Пример #1
0
 public Reject(FormalizationPosition position)
 {
     Product      = position.PositionName;
     ProductId    = (uint?)position.ProductId;
     Producer     = position.FirmCr;
     ProducerId   = (uint?)position.CodeFirmCr;
     Series       = position.Offer.Code;
     LetterNo     = position.Offer.CodeCr;
     LetterDate   = SafeConvert.ToDateTime(position.Offer.Note);
     CauseRejects = position.Offer.Doc;
 }
Пример #2
0
 public static DateTime _ToDateTime(this object obj)
 {
     return(SafeConvert.ToDateTime(obj));
 }
Пример #3
0
        public override void DataBind()
        {
            var db   = DB.Current;
            var cpin = from x in db.sm_biz_Workpiece
                       join s in db.sm_biz_State on x.State equals s.ID
                       where s.Group == (int)ws
                       select x;
            var zongsh = from x in db.sm_biz_Workpiece
                         where x.State == 0 || x.State > ((int)ws) * 10
                         select x;
            var condition = new Query();

            condition.Step     = ws;
            condition.TimeFrom = SafeConvert.ToDateTime(this.txt_tf.Text, DateTime.Parse("2000-1-1"));
            condition.TimeTo   = SafeConvert.ToDateTime(this.txt_tt.Text, DateTime.Parse("2050-1-1"));
            cpin   = cpin.Where(x => x.Date >= condition.TimeFrom && x.Date <= condition.TimeTo);
            zongsh = zongsh.Where(x => x.Date >= condition.TimeFrom && x.Date <= condition.TimeTo);
            if (ddl_mid.SelectedValue != string.Empty)
            {
                condition.MachineID = ddl_mid.SelectedValue.Char();
                cpin   = cpin.Where(x => x.MachineID == condition.MachineID);
                zongsh = zongsh.Where(x => x.MachineID == condition.MachineID);
            }
            if (ddl_type.SelectedValue != string.Empty)
            {
                condition.Type = ddl_type.SelectedValue.Char();
                cpin           = cpin.Where(x => x.Type == condition.Type);
                zongsh         = zongsh.Where(x => x.Type == condition.Type);
            }
            if (ddl_shift.SelectedValue != string.Empty)
            {
                condition.Shift = ddl_shift.SelectedValue.Char();
                cpin            = cpin.Where(x => x.Shift == condition.Shift);
                zongsh          = zongsh.Where(x => x.Shift == condition.Shift);
            }
            var cpinc = from x in cpin
                        group x by x.Date into g
                        select new Pices {
                Date = g.Key, Count = g.Count()
            };
            var zongshc = from x in zongsh
                          group x by x.Date into g
                          select new Pices {
                Date = g.Key, Count = g.Count()
            };
            var source = from y in zongshc.ToList()
                         join x in cpinc.ToList() on y.Date equals x.Date into pcs
                         from z in pcs.DefaultIfEmpty(new Pices {
                Date = DateTime.Now, Count = 0
            })
                         select new AClass {
                Date = y.Date, ZongShu = y.Count, Good = y.Count - z.Count, Bad = z.Count
            };

            this.AspNetPager1.RecordCount = source.Count();
            var paged = source.Skip(AspNetPager1.StartRecordIndex - 1).Take(AspNetPager1.PageSize);

            this.Repeater1.DataSource = Session["Tmp_data"] = paged;
            this.Repeater1.DataBind();
            Session["TQuery"] = condition;
        }