protected void Page_Load(object sender, EventArgs e)
 {
     conn = new Connection();
        string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
     conn.Open(connectionstring);
     Rs1 = new Recordset();
     Rs2 = new Recordset();
     Rs3 = new Recordset();
     Rs4 = new Recordset();
     StationID = Request["StationID"];
     UserID = Session["UserID"];
     SecLevel = Session["SecLevel"];
     Barcode = Request["Barcode"];
     ProductType = Request["ProductType"];
     CarPlate = Request["CarPlate"];
     Response.Write(StationID);
     Response.Write(UserID);
     Response.Write(SecLevel);
     Response.End();
     iMessage = null;
     Rs1.Open(("Exec Checkrange '" + Barcode + "'"), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1);
     //Response.write ("Exec Checkrange '"&Barcode&"'")
     //Response.end
     if (Rs1.Eof)
     {
     Message = "Check Range ���ҥ��� - §��L��!";
     Response.Redirect("CouponVerification.aspx?Message=" + Message);
     }
     else
     {
     if (Convert.ToDateTime(Rs1.Fields["Expiry_Date"].Value) < DateTime.Parse(Convert.ToString(DateTime.Now)))
     {
         Message = "���ҥ��� - §��L��!";
         Response.Redirect("CouponVerification.aspx?Message=" + Message);
     }
     }
     Rs1.Close();
     Rs1 = null;
     Rs2.Open(("Exec CheckCouponExist '" + Barcode + "'"), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1);
     //Response.write ("Exec CheckCouponExist '"&Barcode&"'")
     iCount = Rs2.Fields["iCount"].Value;
     Rs2.Close();
     Rs2 = null;
     if (Convert.ToInt32(iCount) > 0)
     {
     Message = "���ҥ��� - ���ƨϥ�!";
     }
     else
     {
     Session.Add("SecLevel", SecLevel);
     Session.Add("UserID", UserID);
     Session.Add("StationID", StationID);
     Response.Redirect("Insert.aspx?ProductType=" + ProductType + "&Barcode=" + Barcode + "&CarPlate=" + CarPlate);
     }
     Session.Add("SecLevel", SecLevel);
     Session.Add("UserID", UserID);
     Session.Add("StationID", StationID);
     Response.Redirect("CouponVerification.aspx?Message=" + Message + "&Coupon_Number=" + Convert.ToString(Coupon_Number));
 }
Exemple #2
1
 protected void Page_Load(object sender, EventArgs e)
 {
     conn = new Connection();
      string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
      conn.Open(connectionstring);
     UserID = Request["UserID"];
     Password = Request["Password"];
     if (Session["StationID"] != null)
     {
     StationID = Session["StationID"].ToString();
     }
     Rs1 = new Recordset();
     Rs1.Open(("Exec CheckLoginPwd '" + UserID + "', '" + Password + "' "), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1);
     if (!(Rs1.Eof))
     {
     Session.Add("SecLevel", Rs1.Fields["SecLevel"].Value);
     Session.Add("UserID", UserID);
     Session.Add("StationID", StationID);
     Response.Redirect("CouponVerification.aspx");
     }
     else
     {
     Response.Redirect("Default.aspx?Message=Fail");
     }
 }
Exemple #3
0
        public static Connection getConnection()
        {
            if (connection == null)
            {
                connection = new Connection("127.0.0.1");
            }

            return connection;
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Thread.Sleep(200);

            const string serverUrl = "http://localhost:5000/echo/";
            var connection = new Connection(serverUrl);

            connection.StateChanged += OnConnectionStateChanged;

            try
            {
                connection.Start().Wait();
            }
            catch(AggregateException ex)
            {
                throw ex.Flatten();
            }

            Console.ReadKey();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            conn = new Connection();
           string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
            conn.Open(connectionstring); 
            UserID = (Request["UserID"]).Trim();
            Level = (Request["SecLevel"]).Trim();
            StationID = (Request["StationID"]).Trim();
            UserID = (Request["UserID"]).TrimEnd();
            SDay = Request["SDay"];
            SMonth = Request["SMonth"];
            SYear = Request["SYear"];
            NDay = Request["NDay"];
            NMonth = Request["NMonth"];
            NYear = Request["NYear"];
            // Search_Date = Strings.FormatDateTime(new DateTime(Convert.ToInt32(SYear), Convert.ToInt32(SMonth), Convert.ToInt32(SDay)), (DateFormat)2);
            //Search_NDate = Strings.FormatDateTime(new DateTime(Convert.ToInt32(NYear), Convert.ToInt32(NMonth), Convert.ToInt32(NDay)), (DateFormat)2);

            Search_Date = SDay + "/" + SMonth + "/" + SYear;
            Search_NDate = NDay + "/" + NMonth + "/" + NYear;
            fsql = "select * from MasterCoupon where RequestedID = " + StationID +
                " and  Present_Date >=   Convert(datetime, '" + Search_Date + "', 105) " +
                " and  Present_Date < DATEADD(dd,DATEDIFF(dd,0, Convert(datetime, '" + Search_NDate + "', 105)),0) + 1 " +
                " order by id desc";
            //response.write fsql
            //response.end
            RS1 = conn.Execute(fsql);
            Response.ContentType = "text/csv";
            //Today = Strings.FormatDateTime(DateTime.Now, (DateFormat)2);
            Today = DateTime.Now.ToString("dd-MM-yyyy");
            Response.AddHeader("Content-Disposition", "attachment;filename=§¨é¬ö¿ý(" + Today + ").csv");
             Write_CSV_From_Recordset(RS1);         
        }
        catch (Exception ex)
        { 
        }
    }
Exemple #6
0
 public Tank(Parser parser)
 {
     connection = new Connection(parser);
 }
Exemple #7
0
 public static void setConnection(string IPAddress)
 {
     connection = new Connection(IPAddress);
 }
Exemple #8
0
 public Tank()
 {
     connection = new Connection ();
 }
Exemple #9
0
 private void Connection_Disconnect(Connection Sender, DisconnectMessage Message)
 {
     // If the server disconnects, close the window
     Dispatcher.Invoke((Action)Close);
 }