Ejemplo n.º 1
0
        public List <cmpnydetails> getdetails()
        {
            cmpnydetails        det;
            List <cmpnydetails> Details = new List <cmpnydetails>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select CompanyID, CompanyName,Address,Status " +
                                      "from CompanyDetail order by CompanyID";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    det                = new cmpnydetails();
                    det.companyID      = reader.GetInt32(0);
                    det.companyname    = reader.GetString(1);
                    det.companyAddress = reader.GetString(2);
                    det.status         = reader.GetInt32(3);
                    Details.Add(det);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(Details);
        }
Ejemplo n.º 2
0
        public Boolean insertdetails(cmpnydetails det)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "insert into CompanyDetail (CompanyID,CompanyName,Address,Status)" +
                                   "values (" +
                                   "'" + det.companyID + "'," +
                                   "'" + det.companyname + "'," +
                                   "'" + det.companyAddress + "'," +
                                   "'" + det.status + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "CompanyDetail", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
                status = false;
            }
            return(status);
        }
Ejemplo n.º 3
0
        public Boolean validatedetails(cmpnydetails det)
        {
            Boolean status = true;

            try
            {
                if (/*bool hasAllwhitespace =*/ det.companyAddress.Trim().Length == 0 || det.companyAddress == null)
                {
                    return(false);
                }
                if (det.companyname.Trim().Length == 0 || det.companyname == null)
                {
                    return(false);
                }
                if (det.companyID.ToString().Length == 0)
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(status);
        }