Пример #1
0
 private bool AddAgent(string agentName, string userName, DateTime hireDate, string password)
 {
     var agentToInsert = new Agent();
       agentToInsert.userName = userName;
       agentToInsert.agentName = agentName;
       agentToInsert.hireDate = hireDate;
       agentToInsert.password = password;
       var adherence = new Adherence();
       adherence.agentName = agentToInsert.agentName;
       var aht = new AHT();
       aht.agentName = agentToInsert.agentName;
       var knowledgeCheck = new KnowledgeCheck();
       knowledgeCheck.agentName = agentToInsert.agentName;
       var qualityControl = new QualityControl();
       qualityControl.agentName = agentToInsert.agentName;
       qualityControl.recordID = RandomRecordId();
       qualityControl.qcRecordID = RandomQcRecordId();
       var dataContext = new GrangeCallCenterDataClassesDataContext();
       dataContext.Agents.InsertOnSubmit(agentToInsert);
       dataContext.Adherences.InsertOnSubmit(adherence);
       dataContext.AHTs.InsertOnSubmit(aht);
       dataContext.KnowledgeChecks.InsertOnSubmit(knowledgeCheck);
       dataContext.QualityControls.InsertOnSubmit(qualityControl);
       try
       {
     dataContext.SubmitChanges();
     return true;
       }
       catch (Exception exception)
       {
     Console.WriteLine("Error: {0}", exception.ToString());
     return false;
       }
 }
 partial void DeleteKnowledgeCheck(KnowledgeCheck instance);
 partial void UpdateKnowledgeCheck(KnowledgeCheck instance);
 partial void InsertKnowledgeCheck(KnowledgeCheck instance);