示例#1
0
 protected void save()
 {
     try
     {
         using (VisitMgtDataContext vmdc = new VisitMgtDataContext())
         {
             visit_main vm = new visit_main
             {
                 v_id         = this.ID,
                 v_gate       = this.Gate.GateID,
                 v_card       = this.Card.Id,
                 v_life       = this.Life,
                 v_visitor    = this.Visitor.Id,
                 v_hasID      = this.HasID,
                 v_type       = this.vType,
                 v_reason     = this.vReason,
                 v_nums       = this.Nums,
                 v_entry      = this.Entry,
                 v_respondent = this.Respondent.Id,
                 v_status     = this.status,
                 v_intime     = this.InTime,
                 v_outtime    = this.OutTime
             };
             vmdc.visit_main.InsertOnSubmit(vm);
             vmdc.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception("保存访问记录失败", ex);
     }
 }
示例#2
0
 public void Postponed(int i)
 {
     if (this.ID != null)
     {
         using (VisitMgtDataContext vmdc = new VisitMgtDataContext())
         {
             visit_main vm = vmdc.visit_main.Single(q => q.v_id == this.ID);
             vm.v_life += i;
             vmdc.SubmitChanges();
         }
     }
 }
示例#3
0
 public void Load()
 {
     if (this.ID != null)
     {
         try
         {
             using (VisitMgtDataContext vmdc = new VisitMgtDataContext())
             {
                 visit_main vm = vmdc.visit_main.Single(q => q.v_id == this.ID);
                 this.Gate       = new Gate(vm.v_gate);
                 this.Card       = new VisitCard(vm.v_card);
                 this.Life       = vm.v_life;
                 this.Visitor    = new Visitor(vm.v_visitor);
                 this.HasID      = vm.v_hasID;
                 this.vType      = vm.v_type;
                 this.vReason    = vm.v_reason;
                 this.Nums       = (int)vm.v_nums;
                 this.Entry      = vm.v_entry;
                 this.Respondent = new Respondent((int)vm.v_respondent);
                 this.status     = vm.v_status;
                 this.loaded     = true;
                 if (vm.v_intime != null)
                 {
                     this.InTime = (DateTime)vm.v_intime;
                 }
                 if (vm.v_outtime != null)
                 {
                     this.OutTime = (DateTime)vm.v_outtime;
                 }
             }
         }
         catch (Exception ex)
         {
             throw new Exception("加载访问信息失败", ex);
         }
     }
     else
     {
         throw new Exception("未指定ID");
     }
 }