예제 #1
0
        public List <Du> GetDu()
        {
            List <Du> duList = new List <Du>();

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(connectionString);
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "GetDUs";
                command.Connection  = connection;

                connection.Open();

                SqlDataReader reader = command.ExecuteReader();

                // Call Read before accessing data.
                while (reader.Read())
                {
                    Du du = new Du();
                    du.DuId = reader["DUID"] != null?Convert.ToInt32(reader["DUID"]) : 0;

                    du.DuName = Convert.ToString(reader["DUName"]);
                    duList.Add(du);
                }

                // Call Close when done reading.
                reader.Close();
            }

            return(duList);
        }
        public bool AddDu(Du du)
        {
            if (ModelState.IsValid)
            {
                return(BLogicObj.AddDu(du));
            }

            return(false);
        }
예제 #3
0
 /// <summary>
 /// 转换为字符串,保留到小数点后n位
 /// </summary>
 /// <param name="n">保留到小数点后n位</param>
 /// <returns></returns>
 public string ToFormatString(int n)
 {
     if (Miao >= 0)
     {
         return(Du.ToString() + "°" + Fen.ToString() + "′" + Miao.ToFormatString(n) + "″");
     }
     else
     {
         return(Du.ToString() + "°" + (-Fen).ToString() + "′" + (-Miao).ToFormatString(n) + "″");
     }
 }
예제 #4
0
        public bool AddDu(Du du)
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(connectionString);
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "AddDU";
                command.Connection  = connection;

                command.Parameters.AddWithValue("@DUName", du.DuName);
                command.Parameters.AddWithValue("@DULeadEID", du.DuLeadEId);
                command.Parameters.AddWithValue("@DULeadEmail", du.DuLeadEmail);
                connection.Open();

                int rows = command.ExecuteNonQuery();
                if (rows <= 0)
                {
                    throw new Exception("No records updated");
                }
                return(true);
            }
        }
예제 #5
0
 public bool AddDu(Du du)
 {
     return(ReferenceDataDalObj.AddDu(du));
 }
 public void print()
 {
     Re.print();
     Du.print();
 }
예제 #7
0
 public bool AddDu(Du du)
 {
     return(repository.AddDu(du));
 }