示例#1
0
        public static void AddNewShiftDef(ShiftDef.DTO headDTO, List <ShiftPoint.DTO> lineDTOs)
        {
            DakkaLinqDataContext db = DBHelper.GetDakkaLinqDataContext();

            ShiftDef shiftDef = new ShiftDef
            {
                Code        = headDTO.Code,
                Name        = headDTO.Name,
                ShiftType   = new ShiftTypeEnum(headDTO.ShiftType).Value,
                Description = headDTO.Description
            };

            foreach (var line in lineDTOs)
            {
                ShiftPoint shiftPoint = new ShiftPoint
                {
                    IndexNumber = line.IndexNumber,
                    Name        = line.Name,
                    PointTime   = DateTime.Parse(line.PointTime),
                    Before      = int.Parse(line.Before),
                    After       = int.Parse(line.After),
                    PointType   = new PointTypeEnum(line.PointType).Value
                };

                shiftDef.ShiftPoint.Add(shiftPoint);
            }

            db.ShiftDef.InsertOnSubmit(shiftDef);

            db.SubmitChanges();
        }
示例#2
0
        public static void UpdateShiftDef(ShiftDef.DTO headDTO, List <ShiftPoint.DTO> lineDTOs)
        {
            DakkaLinqDataContext db = DBHelper.GetDakkaLinqDataContext();

            ShiftDef shiftDef = db.ShiftDef.Single(sd => sd.ID == headDTO.ID);

            foreach (ShiftPoint point in shiftDef.ShiftPoint)
            {
                db.ShiftPoint.DeleteOnSubmit(point);
            }

            shiftDef.Code        = headDTO.Code;
            shiftDef.Name        = headDTO.Name;
            shiftDef.ShiftType   = new ShiftTypeEnum(headDTO.ShiftType).Value;
            shiftDef.Description = headDTO.Description;

            foreach (var line in lineDTOs)
            {
                ShiftPoint shiftPoint = new ShiftPoint
                {
                    IndexNumber = line.IndexNumber,
                    Name        = line.Name,
                    PointTime   = DateTime.Parse(line.PointTime),
                    Before      = int.Parse(line.Before),
                    After       = int.Parse(line.After),
                    PointType   = new PointTypeEnum(line.PointType).Value
                };

                shiftDef.ShiftPoint.Add(shiftPoint);
            }

            db.SubmitChanges();
        }
示例#3
0
 private void detach_ShiftPoint(ShiftPoint entity)
 {
     this.SendPropertyChanging();
     entity.ShiftDef1 = null;
 }
示例#4
0
 private void attach_ShiftPoint(ShiftPoint entity)
 {
     this.SendPropertyChanging();
     entity.ShiftDef1 = this;
 }
示例#5
0
 partial void DeleteShiftPoint(ShiftPoint instance);
示例#6
0
 partial void UpdateShiftPoint(ShiftPoint instance);
示例#7
0
 partial void InsertShiftPoint(ShiftPoint instance);