Exemple #1
0
        public List <Audittrails> Audittrails_data()
        {
            List <Audittrails> adtlist = new List <Audittrails>();

            try
            {
                SqlCommand cmd = new SqlCommand("GET_AUDITTRAILS", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                Connection();
                SqlDataReader dr = cmd.ExecuteReader();
                Audittrails   adtlist1;
                while (dr.Read())
                {
                    adtlist1        = new Audittrails();
                    adtlist1.USERID = dr["USERID"] != null?Convert.ToInt32(dr["USERID"]) : 0;

                    adtlist1.USERNAME        = dr["USERNAME"] != null ? dr["USERNAME"].ToString() : "";
                    adtlist1.ACTIONOFATTEMPT = dr["ACTIONOFATTEMPT"] != null ? dr["ACTIONOFATTEMPT"].ToString() : "";
                    adtlist1.TYPEOFATTEMPT   = dr["TYPEOFATTEMPT"] != null ? dr["TYPEOFATTEMPT"].ToString() : "";
                    adtlist1.DESCRIPTION     = dr["DESCRIPTION"] != null ? dr["DESCRIPTION"].ToString() : "";
                    adtlist1.FRONTENDDATE    = dr["FRONTENDDATE"] != null ? dr["FRONTENDDATE"].ToString() : "";
                    adtlist1.BACKENDDATE     = dr["BACKENDDATE"] != null ? dr["BACKENDDATE"].ToString() : "";
                    adtlist.Add(adtlist1);
                }
                return(adtlist);
            }
            catch (Exception ch)
            {
                return(adtlist);
            }
            finally
            {
                conn.Close();
            }
        }
Exemple #2
0
        public Outputclass AUDITTRAILS(Audittrails adt)
        {
            Outputclass outputclass = new Outputclass();

            try
            {
                SqlCommand cmd = new SqlCommand("Insert_AUDITTRAILS", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@USERID", adt.USERID);
                cmd.Parameters.AddWithValue("@USERNAME", adt.USERNAME);
                cmd.Parameters.AddWithValue("@ACTIONOFATTEMPT", adt.ACTIONOFATTEMPT);
                cmd.Parameters.AddWithValue("@TYPEOFATTEMPT", adt.TYPEOFATTEMPT);
                cmd.Parameters.AddWithValue("@DESCRIPTION", adt.DESCRIPTION);
                cmd.Parameters.AddWithValue("@FRONTENDDATE", adt.FRONTENDDATE);
                cmd.Parameters.AddWithValue("@BACKENDDATE", adt.BACKENDDATE);
                Connection();
                int i = cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    outputclass.Count = i;
                }
                return(outputclass);
            }
            catch (Exception ex)
            {
                outputclass.Msg = ex.ToString();
                return(outputclass);
            }
            finally
            {
                conn.Close();
            }
        }