Ejemplo n.º 1
0
        public List <documentuc> getDocuments()
        {
            documentuc        docrec;
            List <documentuc> DocUC = new List <documentuc>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select a.UserID, a.Status,b.EmployeeID,b.Name from DocumentUC a Inner Join ViewUserEmployeeList b on a.UserID=b.UserID";

                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    docrec         = new documentuc();
                    docrec.UserID  = reader.GetString(0);
                    docrec.Status  = reader.GetInt32(1);
                    docrec.empid   = reader.GetString(2);
                    docrec.empname = reader.GetString(3);
                    DocUC.Add(docrec);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(DocUC);
        }
Ejemplo n.º 2
0
        public Boolean insertDocument(documentuc doc)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                DocumentDB dc = new DocumentDB();

                DateTime cdt       = DateTime.Now;
                string   updateSQL = "insert into DocumentUC (UserID,Status,CreateTime,CreateUser)" +
                                     "values (" +
                                     "'" + doc.UserID + "'," +
                                     doc.Status + "," +
                                     "GETDATE()" + "," +
                                     "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "DocumentUC", "", 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 updateDocument(documentuc doc)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update DocumentUC set Status=" + doc.Status + " where UserID='" + doc.UserID + "'";

                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "DocumentUC", "", 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.º 4
0
        public Boolean validateDocument(documentuc doc)
        {
            Boolean status = true;

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

            return(status);
        }