Exemplo n.º 1
0
 /// <summary>
 /// 删除请求的新闻
 /// </summary>
 public void deleteRequestAssistant()
 {
     string id = Request.QueryString["id"];
     Assistants assistant = AssistantHandler.getAssistantById(id);
     AssistantHandler assistantHandler = new AssistantHandler(assistant);
     assistantHandler.Delete();
 }
Exemplo n.º 2
0
 protected bool register(string id, string pwd, string name)
 {
     Assistants a = new Assistants { ID=id,name=name,password=pwd};
     AssistantHandler ah = new AssistantHandler(a);
     try
     {
         ah.Insert();
     }
     catch (Exception)
     {
         return false;
     }
     return true;
 }
        public void DeleteTest()
        {
            Assistants a = new Assistants { ID = "test", name = "test", password = "******" };
            AssistantHandler.DB.Assistants.InsertOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();
            AssistantHandler ah = new AssistantHandler(a);
            ah.Delete();
            Assert.IsFalse(AssistantHandler.DB.Assistants.Any(assistant => assistant.ID == "test"));

            if (AssistantHandler.DB.Assistants.Any(assistant => assistant.ID == "test"))
            {
                AssistantHandler.DB.Assistants.DeleteOnSubmit(a);
                AssistantHandler.DB.SubmitChanges();
            }
        }
 public void AssistantHandlerConstructorTest()
 {
     Assistants assistant = new Assistants();
     AssistantHandler assistantHandler = new AssistantHandler(assistant);
     Assert.AreSame(assistant, assistantHandler.CurrentAssistant);
 }
        public void SubmitTest()
        {
            Assistants a = new Assistants { ID = "test", name = "test", password = "******" };
            AssistantHandler.DB.Assistants.InsertOnSubmit(a);
            AssistantHandler ah = new AssistantHandler(a);
            ah.Submit();

            Assert.IsTrue(AssistantHandler.DB.Assistants.First(assistant => assistant.ID == "test").Equals(a));

            AssistantHandler.DB.Assistants.DeleteOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();
        }