public ResponseData AddPerson([FromBody] ZL_PersonSetup person)
 {
     using (SqlConnection con = new SqlConnection(_connectionString))
     {
         ResponseData response = new ResponseData();
         try
         {
             if (con.State == ConnectionState.Closed)
             {
                 con.Open();
             }
             SqlTransaction    tran = con.BeginTransaction();
             BllZL_PersonSetup bll  = new BllZL_PersonSetup(con);
             if (bll.AddPerson(person, tran))
             {
                 tran.Commit();
                 response.result = true;
                 response.msg    = "Ìí¼Ó³É¹¦";
             }
             else
             {
                 response.result = false;
                 response.msg    = "Ìí¼Óʧ°Ü";
             }
         }
         catch (Exception ex)
         {
             response.result = false;
             response.msg    = ex.Message;
         }
         return(response);
     }
 }
 public ResponseData DelPerson(long PersonAutoID)
 {
     using (SqlConnection con = new SqlConnection(_connectionString))
     {
         ResponseData response = new ResponseData();
         try
         {
             if (con.State == ConnectionState.Closed)
             {
                 con.Open();
             }
             SqlTransaction    tran = con.BeginTransaction();
             BllZL_PersonSetup bll  = new BllZL_PersonSetup(con);
             if (bll.DelPerson(PersonAutoID, tran))
             {
                 tran.Commit();
                 response.result = true;
                 response.msg    = "ɾ³ý³É¹¦";
             }
             else
             {
                 response.result = false;
                 response.msg    = "ɾ³ýʧ°Ü";
             }
         }
         catch (Exception ex)
         {
             response.result = false;
             response.msg    = ex.Message;
         }
         return(response);
     }
 }
예제 #3
0
 public Object Get(string employeeNo)
 {
     using (SqlConnection con = new SqlConnection(_connectionString))
     {
         BllZL_PersonSetup bll = new BllZL_PersonSetup(con);
         return(bll.GetPersonWork(" where EmployeeNo='" + employeeNo + "'"));
     }
 }
 public Object Get(string WorkProduct, string WorkName)
 {
     using (SqlConnection con = new SqlConnection(_connectionString))
     {
         if (WorkName == null)
         {
             WorkName = "";
         }
         if (WorkProduct == null)
         {
             WorkProduct = "";
         }
         BllZL_PersonSetup bll      = new BllZL_PersonSetup(con);
         string            strWhere = "where WorkProduct like '%{0}%' and WorkName like '%{1}%'";
         strWhere = string.Format(strWhere, WorkProduct, WorkName);
         //List<ZL_PersonSetup> person= bll.GetPersonWork(strWhere);
         return(bll.GetPersonWork(strWhere));
     }
 }