Exemplo n.º 1
0
        public Boolean updateCompAddress(companyaddress ca)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update CompanyAddress set AddressType = " + ca.AddressType +
                                   " ,Address = '" + ca.Address.Replace("'", "''") + "',Status=" + ca.Status +
                                   " where RowID=" + ca.RowID;
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "CompanyAddress", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 2
0
        public List <companyaddress> getCompAddList()
        {
            companyaddress        ca;
            List <companyaddress> AddList = new List <companyaddress>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select a.RowID,a.CompanyID, b.CompanyName,a.AddressType,a.Address,a.Status,a.CreateTime,a.CreateUser " +
                                      "from CompanyAddress a,CompanyDetail b where a.CompanyID = b.CompanyID order by a.CompanyID";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    ca             = new companyaddress();
                    ca.RowID       = reader.GetInt32(0);
                    ca.CompanyID   = reader.GetInt32(1);
                    ca.CompanyName = reader.GetString(2);
                    ca.AddressType = reader.GetInt32(3);
                    ca.Address     = reader.GetString(4);
                    ca.Status      = reader.GetInt32(5);
                    ca.CreateTime  = reader.GetDateTime(6);
                    ca.CreateUser  = reader.GetString(7);

                    AddList.Add(ca);
                }
                conn.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error querying Company Address");
            }
            return(AddList);
        }
Exemplo n.º 3
0
        public Boolean insertCompAddress(companyaddress ca)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "insert into CompanyAddress (CompanyID,AddressType,Address," +
                                   "Status,CreateTime,CreateUser)" +
                                   " values (" +
                                   ca.CompanyID + "," +
                                   ca.AddressType + "," +
                                   "'" + ca.Address + "'," +
                                   ca.Status + "," +
                                   "GETDATE()" + "," +
                                   "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "CompanyAddress", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
Exemplo n.º 4
0
        public Boolean validateCompanyAdd(companyaddress ca)
        {
            Boolean status = true;

            try
            {
                if (ca.CompanyID == 0)
                {
                    return(false);
                }
                if (ca.AddressType == 0)
                {
                    return(false);
                }
                if (ca.Address.Trim().Length == 0 || ca.Address == null)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
            }
            return(status);
        }