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); }
/// <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) + "″"); } }
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); } }
public bool AddDu(Du du) { return(ReferenceDataDalObj.AddDu(du)); }
public void print() { Re.print(); Du.print(); }
public bool AddDu(Du du) { return(repository.AddDu(du)); }