Пример #1
0
        public static Feedbk GetOne(Int64 OID)
        {
            DBCon         dBCon  = new DBCon();
            SqlCommand    cmd    = null;
            SqlDataReader SDR    = null;
            Feedbk        feedbk = new Feedbk();

            try
            {
                string Quary = "Select TOP 1 * From FeedBk where OrderId=" + OID;
                cmd = new SqlCommand(Quary, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    feedbk.FeedBkId     = SDR.GetInt32(0);
                    feedbk.OrgId        = SDR.GetInt32(1);
                    feedbk.OrderId      = SDR.GetInt64(2);
                    feedbk.FeedbkFormId = SDR.GetInt32(3);
                    feedbk.CreateOn     = SDR.GetDateTime(4);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose();; dBCon.Con.Close(); }

            return(feedbk);
        }
Пример #2
0
        public static List <Feedbk> GetAll(int OrgId, DateTime Fdate, DateTime Tdate)
        {
            DBCon         dBCon      = new DBCon();
            SqlCommand    cmd        = null;
            SqlDataReader SDR        = null;
            List <Feedbk> listfeedbk = new List <Feedbk>();

            try
            {
                string Quary = "Select * From FeedBk where OrgId=" + OrgId;
                if (Fdate != null && Tdate != null)
                {
                    Quary += "and CreateOn between '" + Fdate.ToString("MM/dd/yyyy") + "' and '" + Tdate.ToString("MM/dd/yyyy HH:mm:ss") + "";
                }
                cmd = new SqlCommand(Quary, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    Feedbk OBJfeedbk = new Feedbk();
                    OBJfeedbk.FeedBkId     = SDR.GetInt32(0);
                    OBJfeedbk.OrgId        = SDR.GetInt32(1);
                    OBJfeedbk.OrderId      = SDR.GetInt64(2);
                    OBJfeedbk.FeedbkFormId = SDR.GetInt32(3);
                    OBJfeedbk.CreateOn     = SDR.GetDateTime(4);
                    listfeedbk.Add(OBJfeedbk);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose();; dBCon.Con.Close(); }
            return(listfeedbk);
        }