Beispiel #1
0
        public Boolean updateStatusCatalogue(statuscatalogue doc)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update StatusCatalogue set ID = '" + doc.ID + "'," +
                                   "Description= '" + doc.Description +
                                   "', Status= " + doc.Status +
                                   " where RowID= " + doc.Rowid;
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "StatusCatalogue", "", 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);
        }
Beispiel #2
0
        public List <statuscatalogue> getStatusCatalogue()
        {
            statuscatalogue        stclg;
            List <statuscatalogue> statcatlog = new List <statuscatalogue>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "  select a.RowID,a.DocumentID, b.DocumentName, a.ID,a.Description, a.CreateUser, " +
                                      " a.CreateTime,a.Status from StatusCatalogue a, Document b where a.DocumentID=b.DocumentID" +
                                      " order by a.DocumentId,a.ID";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    stclg                = new statuscatalogue();
                    stclg.Rowid          = reader.GetInt32(0);
                    stclg.DocumentID     = reader.GetString(1);
                    stclg.DocumentName   = reader.GetString(2);
                    stclg.ID             = reader.GetInt32(3);
                    stclg.Description    = reader.GetString(4);
                    stclg.userCreateUser = reader.GetString(5);
                    stclg.userCreateime  = reader.GetDateTime(6);
                    stclg.Status         = reader.GetInt32(7);
                    statcatlog.Add(stclg);
                }
                conn.Close();
            }
            catch (Exception)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(statcatlog);
        }
Beispiel #3
0
        public Boolean insertStatusCatalogue(statuscatalogue doc)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                DateTime cdt       = DateTime.Now;
                string   updateSQL = "insert into StatusCatalogue(DocumentID,ID,Description,Status,CreateTime,CreateUser)" +
                                     "values (" +
                                     "'" + doc.DocumentID + "'," +
                                     "'" + doc.ID + "'," +
                                     "'" + doc.Description + "'," +
                                     "'" + doc.Status + "'," +
                                     "GETDATE()" + "," +
                                     "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "StatusCatalogue", "", 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);
        }
Beispiel #4
0
        public Boolean validateDocument(statuscatalogue doc)
        {
            Boolean status = true;

            try
            {
                if (doc.DocumentID.Trim().Length == 0 || doc.DocumentID == null)
                {
                    return(false);
                }
                if (doc.Description.Trim().Length == 0 || doc.Description == null)
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(status);
        }