protected void Button2_Click(object sender, EventArgs e)
    {
        if (!checkCookie())
            Response.Redirect("Login.aspx");
        String fname = TextBox1.Text;
        String lname = TextBox2.Text;
        String addr = TextBox3.Text;
        String addr_proof = FileUpload1.PostedFile.FileName;
        String photo_id = FileUpload2.PostedFile.FileName;
        String phone = TextBox4.Text;
        String email = TextBox5.Text;
        String pword = TextBox6.Text;
        String alerts = RadioButtonList1.Text;

        String addrProofFolder = HttpContext.Current.Server.MapPath("~/Address ID");
        String addrProofTarget = Path.Combine(addrProofFolder, addr_proof);
        FileUpload1.SaveAs(addrProofTarget);

        String photoProofFolder = HttpContext.Current.Server.MapPath("~/Photo ID");
        String photoProofTarget = Path.Combine(photoProofFolder, photo_id);
        FileUpload2.SaveAs(photoProofTarget);

        String uname=Request.Cookies["Car-Trading"]["Username"].ToString();
        DatabaseHandler obj = new DatabaseHandler();
        obj.UpdateCustomerInfo(fname, lname, addr, addrProofTarget, photoProofTarget, phone, email, pword, alerts, uname);
        Response.Redirect("CustomerHome.aspx");
    }
 protected void Button2_Click(object sender, EventArgs e)
 {
     String bidAmount = TextBox1.Text;
     DatabaseHandler obj = new DatabaseHandler();
     String auctionId = Session["auctionId"].ToString();
     DataSet ds = obj.GetAuctionCarInfo(auctionId);
     int basePrice = Convert.ToInt32(ds.Tables[0].Rows[0]["CAR_BASE_PRICE"].ToString());
     if (Convert.ToInt32(bidAmount) < basePrice)
     {
         Label9.Text = "Bid amount must be more than base price";
         Label9.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF0000");
     }
     else
     {
         obj.PlaceAuctionBid(Request.Cookies["Car-Trading"]["Username"].ToString(), bidAmount);
         DataSet ds1 = new DataSet();
         DatabaseHandler obj1 = new DatabaseHandler();
         ds1 = obj.GetAuctionBids(auctionId);
         GridView1.DataSource = ds1;
         GridView1.DataBind();
         Panel1.Visible = false;
         Label9.Text = "Bid placed !";
         Label9.ForeColor = System.Drawing.ColorTranslator.FromHtml("#00FF00");
     }
 }
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerName = TextBox1.Text;
     String sellerCountry = TextBox2.Text;
     String sellerCity = TextBox3.Text;
     String sellerStreet = TextBox4.Text;
     String sellerPhone = TextBox5.Text;
     String sellerEmail = TextBox6.Text;
     String sellerBankName = TextBox7.Text;
     String sellerBankAccountNum = TextBox8.Text;
     String sellerPassword = TextBox9.Text;
     String sellerIdProof = FileUpload1.PostedFile.FileName;
     String IdProofFolder = HttpContext.Current.Server.MapPath("~/Seller ID");
     String IdProofTarget = Path.Combine(IdProofFolder, sellerIdProof);
     FileUpload1.SaveAs(IdProofTarget);
     String sellerId = Request.QueryString["sellerId"].ToString();
     EncryptDecrypt obj = new EncryptDecrypt();
     sellerId = obj.Decrypt(HttpUtility.UrlDecode(sellerId));
     DatabaseHandler obj1 = new DatabaseHandler();
     obj1.UpdateSellerInfo(sellerName, sellerCountry, sellerCity, sellerStreet, sellerPhone,
         sellerEmail, sellerIdProof, sellerBankName, sellerPhone, sellerPassword, sellerId);
     Response.Redirect("SellerHome.aspx?sellerId=" + Request.QueryString["sellerId"].ToString());
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String auctionId=Request.QueryString["auctionId"].ToString();
     DatabaseHandler obj = new DatabaseHandler();
     DataSet ds = obj.GetAuctionWinnerUsername(auctionId);
     if (ds == null)
         Label1.Text = "Auction not found or currently in progress";
     else
     {
         Panel1.Visible = true;
         Label1.Text = "Auction No. " + auctionId;
         Label2.Text = ds.Tables[0].Rows[0]["WINNER_USERNAME"].ToString();
         ds = obj.GetAuctionWinnerBid(Label2.Text);
         Label4.Text = ds.Tables[0].Rows[0]["CUSTOMER_BID_AMOUNT"].ToString();
         ds = obj.GetAuctionCarInfo(auctionId);
         Label3.Text = ds.Tables[0].Rows[0]["CAR_BASE_PRICE"].ToString();
         Label6.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
         Label7.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
         Label8.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
         String sellerId=ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
         ds=obj.GetSellerName(sellerId);
         Label9.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     }
 }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        String brand = TextBox1.Text;
        String modelName = TextBox2.Text;
        String modelNum = TextBox3.Text;
        String carAvailableDate = TextBox4.Text;
        String frontImg = FileUpload1.PostedFile.FileName;
        String sideImg = FileUpload2.PostedFile.FileName;
        String rearImg = FileUpload3.PostedFile.FileName;

        String frontImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Front");
        String frontImgTarget = Path.Combine(frontImgFolder, frontImg);
        FileUpload1.SaveAs(frontImgTarget);

        String sideImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Side");
        String sideImgTarget = Path.Combine(sideImgFolder, sideImg);
        FileUpload2.SaveAs(sideImgTarget);

        String rearImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Rear");
        String rearImgTarget = Path.Combine(rearImgFolder, rearImg);
        FileUpload3.SaveAs(rearImgTarget);

        DatabaseHandler obj = new DatabaseHandler();
        obj.InsertUpcomingCar(brand, modelName, modelNum, frontImgTarget, sideImgTarget, rearImgTarget, carAvailableDate);

        Response.Write("Car Added");
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     this.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
     if (!IsPostBack)
         Wizard1.ActiveStepIndex = 0;
     Panel2.Visible = false;
     Panel3.Visible = false;
     String customerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DatabaseHandler obj = new DatabaseHandler();
     DataSet ds = obj.GetCustomerAddressPhone(customerUsername);
     String customerAddress = ds.Tables[0].Rows[0]["CUSTOMER_ADDRESS"].ToString();
     Label1.Text = customerAddress;
     String carId = Request.QueryString["carId"].ToString();
     String sellerId = Request.QueryString["sellerId"].ToString();
     EncryptDecrypt obj1 = new EncryptDecrypt();
     carId = obj1.Decrypt(HttpUtility.UrlDecode(carId));
     sellerId = obj1.Decrypt(HttpUtility.UrlDecode(sellerId));
     ds = obj.GetSellerName(sellerId);
     Label2.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     ds = obj.GetCarInfo(carId);
     Label3.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString();
     Label7.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
     Label13.Text = Label2.Text;
     Label14.Text = Label7.Text;
     ImageButton1.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_FRONT_IMAGE"].ToString());
     ImageButton1.Width = 150;
     ImageButton1.Height = 150;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DatabaseHandler obj=new DatabaseHandler();
     DataSet ds = obj.GetSellerId(sellerUsername);
     String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
     ds = obj.GetSellerAuctionInfo(sellerId);
     if (ds == null)
         Label8.Text = "You have no auction currently in progress";
     else
     {
         Table1.Visible = true;
         Table2.Visible = true;
         Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
         Label2.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
         Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
         Label4.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
         Label5.Text = ds.Tables[0].Rows[0]["AUCTION_START_TIME"].ToString();
         Label6.Text = ds.Tables[0].Rows[0]["AUCTION_END_TIME"].ToString();
         Label7.Text = ds.Tables[0].Rows[0]["AUCTION_BIDS"].ToString();
         String auctionId = ds.Tables[0].Rows[0]["AUCTION_ID"].ToString();
         if(Label7.Text!="0")
         {
             ds = obj.GetAuctionBids(auctionId);
             GridView1.DataSource = ds;
             GridView1.DataBind();
         }
     }
 }
Ejemplo n.º 8
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     String uname = TextBox1.Text;
     String pword = TextBox2.Text;
     String type = RadioButtonList1.Text;
     DatabaseHandler obj = new DatabaseHandler();
     int status = obj.Login(uname, pword, type);
     if (status == 1 && type == "A Customer")
     {
         HttpCookie cookie = new HttpCookie("Car-Trading");
         if(CheckBox1.Checked)
             cookie.Expires = DateTime.Now.AddDays(10);
         cookie["Username"] = uname;
         Response.Cookies.Add(cookie);
         Response.Redirect("CustomerHome.aspx");
     }
     else if (status == 1 && type == "A Seller")
     {
         HttpCookie cookie = new HttpCookie("Car-Trading");
         if(CheckBox1.Checked)
             cookie.Expires = DateTime.Now.AddDays(10);
         cookie["Username"] = uname;
         Response.Cookies.Add(cookie);
         Response.Redirect("SellerHome.aspx");
     }
     else
         Response.Write("Login failed");
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     DataSet ds = new DataSet();
     String orderId=Request.QueryString["orderId"].ToString();
     EncryptDecrypt obj=new EncryptDecrypt();
     orderId=obj.Decrypt(HttpUtility.UrlDecode(orderId));
     DatabaseHandler obj1 = new DatabaseHandler();
     ds = obj1.GetSellerPendingOrderInfo(orderId);
     Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
     Label2.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
     Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["CAR_STOCK_QUANTITY"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString();
     Label7.Text = ds.Tables[0].Rows[0]["CUSTOMER_FIRST_NAME"].ToString() + " " + ds.Tables[0].Rows[0]["CUSTOMER_LAST_NAME"].ToString();
     Label8.Text = ds.Tables[0].Rows[0]["CUSTOMER_PHONE_NUMBER"].ToString();
     Label9.Text = ds.Tables[0].Rows[0]["CUSTOMER_ADDRESS"].ToString();
     Label10.Text = ds.Tables[0].Rows[0]["PAYMENT_MODE"].ToString();
     Label11.Text = ds.Tables[0].Rows[0]["ORDER_DATE"].ToString();
     if (Label5.Text == "0")
     {
         Label13.Visible = true;
         Button1.Enabled = false;
         Label13.Text = "This car is out of stock";
     }
 }
    protected void Button2_Click(object sender, EventArgs e)
    {
        String name = TextBox1.Text;
        String country = DropDownList1.Text;
        String city = DropDownList2.Text;
        String street=TextBox2.Text;
        String num = TextBox3.Text;
        String email = TextBox4.Text;
        String sellerProof = FileUpload1.PostedFile.FileName;
        String bank = DropDownList4.Text;
        String accountNum = TextBox5.Text;
        String uname = TextBox6.Text;
        String pword = TextBox7.Text;
        String sellerProofFolder = HttpContext.Current.Server.MapPath("~/Seller ID");
        String sellerProofTarget = Path.Combine(sellerProofFolder, sellerProof);
        FileUpload1.SaveAs(sellerProofTarget);

        DatabaseHandler obj = new DatabaseHandler();
        String sellerId = "SEL_" + DateTime.Now.Ticks.ToString();
        obj.InsertSeller(sellerId, name, country, city, street, num, email, sellerProofTarget, bank, accountNum, uname, pword);
        HttpCookie cookie = new HttpCookie("Car-Trading");
        cookie.Expires = DateTime.Now.AddDays(10);
        cookie["Username"] = uname;
        Response.Cookies.Add(cookie);
        EncryptDecrypt obj1 = new EncryptDecrypt();
        sellerId = HttpUtility.HtmlEncode(obj1.Encrypt(sellerId));
        Response.Redirect("SellerHome.aspx?sellerId=" + sellerId);
    }
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String orderId = Request.QueryString["orderId"].ToString();
     EncryptDecrypt obj = new EncryptDecrypt();
     orderId = obj.Decrypt(HttpUtility.UrlDecode(orderId));
     DatabaseHandler obj1 = new DatabaseHandler();
     String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DataSet ds = obj1.GetSellerId(sellerUsername);
     String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
     ds = obj1.GetSellerPendingOrderInfo(orderId);
     String customerId = ds.Tables[0].Rows[0]["CUSTOMER_ID"].ToString();
     String carId = ds.Tables[0].Rows[0]["CAR_ID"].ToString();
     String oldStock = Label5.Text;
     int oldStock1 = Convert.ToInt32(oldStock);
     int newStock = oldStock1-1;
     String newStock1 = newStock.ToString();
     obj1.DecrementCarStock(carId, newStock1);
     String paymentMode = Label10.Text;
     String customerAddr = Label9.Text;
     String orderDate = Label11.Text;
     obj1.InsertCompletedOrder(orderId, customerId, carId, sellerId, paymentMode, customerAddr, orderDate);
     Label13.Visible = true;
     Label13.Text = "Order Completed";
     Button1.Enabled = false;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerId = null;
     try
     {
         sellerId = Request.QueryString["sellerId"].ToString();
         EncryptDecrypt obj = new EncryptDecrypt();
         sellerId = obj.Decrypt(HttpUtility.UrlDecode(sellerId));
     }
     catch(System.NullReferenceException exc)
     {
         String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
         DatabaseHandler x = new DatabaseHandler();
         DataSet ds1 = x.GetSellerId(sellerUsername);
         sellerId = ds1.Tables[0].Rows[0]["SELLER_ID"].ToString();
     }
     DatabaseHandler obj1 = new DatabaseHandler();
     DataSet ds = new DataSet();
     ds = obj1.GetSellerHomeInfo(sellerId);
     Label1.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     Label2.Text = ds.Tables[0].Rows[0]["SELLER_COUNTRY"].ToString();
     Label3.Text = ds.Tables[0].Rows[0]["SELLER_CITY"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["SELLER_STREET"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["SELLER_PHONE_NUMBER"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["SELLER_EMAIL_ID"].ToString();
     Label7.Text = ds.Tables[0].Rows[0]["SELLER_BANK"].ToString();
     Label8.Text = ds.Tables[0].Rows[0]["SELLER_BANK_ACCOUNT_NUMBER"].ToString();
     Image1.ImageUrl = "~\\Seller ID\\" + Path.GetFileName(ds.Tables[0].Rows[0]["SELLER_ID_PROOF"].ToString());
     Image1.Width = 100;
     Image1.Height = 100;
 }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        String fname=TextBox2.Text;
        String lname=TextBox1.Text;
        String addr=TextBox3.Text;
        String addrProof=FileUpload1.PostedFile.FileName;
        String photoId=FileUpload2.PostedFile.FileName;
        String num=TextBox4.Text;
        String email=TextBox9.Text;
        String uname=TextBox5.Text;
        String pword=TextBox6.Text;
        String alerts=RadioButtonList1.Text;
        String id = "CUST_" + DateTime.Now.Ticks.ToString();

        String addrProofFolder = HttpContext.Current.Server.MapPath("~/Address ID");
        String addrProofTarget = Path.Combine(addrProofFolder, addrProof);
        FileUpload1.SaveAs(addrProofTarget);

        String photoProofFolder = HttpContext.Current.Server.MapPath("~/Photo ID");
        String photoProofTarget = Path.Combine(photoProofFolder, photoId);
        FileUpload2.SaveAs(photoProofTarget);

        DatabaseHandler obj = new DatabaseHandler();
        obj.InsertCustomer(id, fname, lname, addr, addrProofTarget, photoProofTarget, num, email, uname, pword, alerts);
        HttpCookie cookie = new HttpCookie("Car-Trading");
        cookie.Expires = DateTime.Now.AddMinutes(1);
        cookie["Username"] = uname;
        Response.Cookies.Add(cookie);
        Response.Redirect("CustomerHome.aspx");
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     EncryptDecrypt obj1 = new EncryptDecrypt();
     String carId = obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["carId"].ToString()));
     String sellerId = obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["sellerId"].ToString()));
     if (carId == null || sellerId == null)
         Response.Redirect("Error.aspx");
     else
     {
         DatabaseHandler obj = new DatabaseHandler();
         DataSet ds = obj.GetCarInfo(carId);
         Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString() + " " + ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
         Label2.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
         Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
         Label4.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
         Label5.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString();
         Label6.Text = ds.Tables[0].Rows[0]["CAR_YEAR_OF_PURCHASE"].ToString();
         Label7.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
         Label8.Text = ds.Tables[0].Rows[0]["CAR_ENGINE"].ToString();
         Label9.Text = ds.Tables[0].Rows[0]["CAR_FUEL"].ToString();
         ImageButton1.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_FRONT_IMAGE"].ToString());
         ImageButton1.Width = 100;
         ImageButton1.Height = 100;
         ImageButton2.ImageUrl = "~\\Car\\Side\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_SIDE_IMAGE"].ToString());
         ImageButton2.Width = 100;
         ImageButton2.Height = 100;
         ImageButton3.ImageUrl = "~\\Car\\Rear\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_REAR_IMAGE"].ToString());
         ImageButton3.Width = 100;
         ImageButton3.Height = 100;
         ds = obj.GetSellerName(sellerId);
         Label10.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
        if (!checkCookie())
            Response.Redirect("Login.aspx");
        String auctionId = Session["auctionId"].ToString();
        DatabaseHandler obj = new DatabaseHandler();
        DataSet ds = obj.GetAuctionCarInfo(auctionId);
        Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
        Label2.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
        Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
        Label4.Text = ds.Tables[0].Rows[0]["CAR_PRODUCTION_YEAR"].ToString();
        Label5.Text = ds.Tables[0].Rows[0]["CAR_BASE_PRICE"].ToString();
        Label7.Text = ds.Tables[0].Rows[0]["CAR_ENGINE"].ToString();
        Label8.Text = ds.Tables[0].Rows[0]["CAR_FUEL"].ToString();
        ImageButton1.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_FRONT_IMAGE"].ToString());
        ImageButton2.ImageUrl = "~\\Car\\Side\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_SIDE_IMAGE"].ToString());
        ImageButton3.ImageUrl = "~\\Car\\Rear\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_REAR_IMAGE"].ToString());

        DataSet ds1 = new DataSet();
        ds1 = obj.GetAuctionBids(auctionId);
        if (ds1 == null)
            Label9.Text = "No bids have been placed for this car yet";
        else
        {
            Label9.Text = ds1.Tables[0].Rows.Count + " bid(s) placed on this car";
            GridView1.DataSource = ds1;
            GridView1.DataBind();
        }
    }
Ejemplo n.º 16
0
        public Frontend()
        {
            InitializeComponent();
            db = new DatabaseHandler();
            db.InitDatabase();

            audioManager = new AudioManager(this);
        }
Ejemplo n.º 17
0
 private ItemHandler()
 {
     this._picture = new Dictionary<uint, Bitmap>();
     this._handler = DatabaseHandler.GetInstance();
     this._items = new ObservableCollection<Item>();
     this._items.CollectionChanged += EventItemCollectionChanged;
     this._nullImage = null;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     DatabaseHandler obj = new DatabaseHandler();
     DataSet ds = obj.GetAuctions();
     GridView1.DataSource = ds;
     GridView1.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     int flag = 0;
     DataSet ds = new DataSet();
     DatabaseHandler obj = new DatabaseHandler();
     ds = obj.GetAllCars();
     if (ds == null)
         Label1.Text = "No car to display";
     else
     {
         int count = ds.Tables[0].Rows.Count;
         TableRow tr = new TableRow();
         for (int i = 0; i < count; i++)
         {
             TableCell tc = new TableCell();
             ImageButton imgbutton = new ImageButton();
             imgbutton.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[i]["CAR_FRONT_IMAGE"].ToString());
             imgbutton.Width = 150;
             imgbutton.Height = 150;
             imgbutton.CssClass = "image-zoom";
             tc.Controls.Add(imgbutton);
             LinkButton lbutton1 = new LinkButton();
             String brand = ds.Tables[0].Rows[i]["CAR_BRAND"].ToString();
             String model = ds.Tables[0].Rows[i]["CAR_MODEL_NAME"].ToString();
             lbutton1.Text = brand + " " + model;
             tc.Controls.Add(lbutton1);
             String carId = ds.Tables[0].Rows[i]["CAR_ID"].ToString();
             String sellerId = ds.Tables[0].Rows[i]["SELLER_ID"].ToString();
             EncryptDecrypt obj1 = new EncryptDecrypt();
             carId = HttpUtility.UrlEncode(obj1.Encrypt(carId));
             sellerId = HttpUtility.UrlEncode(obj1.Encrypt(sellerId));
             lbutton1.PostBackUrl = "CarDetails.aspx?carId=" + carId + "&sellerId=" + sellerId;
             imgbutton.PostBackUrl = "CarDetails.aspx?carId=" + carId + "&sellerId=" + sellerId;
             tc.Attributes.Add("width", "150px");
             tc.Attributes.Add("height", "150px");
             flag++;
             if (flag % 5 != 0)
             {
                 tr.Controls.Add(tc);
             }
             else
             {
                 Table1.Rows.Add(tr);
                 tr = new TableRow();
                 tr.Controls.Add(tc);
             }
         }
         Table1.Rows.Add(tr);
         Table1.CellSpacing = 30;
     }
 }
 protected void LinkButton1_Click(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String customerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DatabaseHandler obj=new DatabaseHandler();
     DataSet ds=obj.GetCustomerId(customerUsername);
     String customerId = ds.Tables[0].Rows[0]["CUSTOMER_ID"].ToString();
     EncryptDecrypt obj1 = new EncryptDecrypt();
     customerId = HttpUtility.UrlEncode(obj1.Encrypt(customerId));
     Response.Redirect("CustomerBuyCar.aspx?carId=" + Request.QueryString["carId"].ToString() + "&sellerId=" + Request.QueryString["sellerId"].ToString() + "&customerId=" + customerId);
 }
 protected void LinkButton1_Click(object sender, EventArgs e)
 {
     Panel1.Visible = true;
     int flag = 1;
     DatabaseHandler obj = new DatabaseHandler();
     EncryptDecrypt obj1 = new EncryptDecrypt();
     String sellerId = obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["sellerId"].ToString()));
     DataSet ds = obj.GetSellerCars(sellerId);
     if (ds.Tables[0].Rows.Count == 0)
     {
         Label7.Text = "This seller has no car in stock";
         LinkButton1.Visible = false;
     }
     else
     {
         int count1 = ds.Tables[0].Rows.Count;
         TableRow tr = new TableRow();
         for (int i = 0; i < count1; i++)
         {
             LinkButton1.Visible = false;
             TableCell tc = new TableCell();
             Image img = new Image();
             img.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[i]["CAR_FRONT_IMAGE"].ToString());
             img.Width = 150;
             img.Height = 150;
             tc.Controls.Add(img);
             LinkButton lbutton1 = new LinkButton();
             String brand = ds.Tables[0].Rows[i]["CAR_BRAND"].ToString();
             String model = ds.Tables[0].Rows[i]["CAR_MODEL_NAME"].ToString();
             lbutton1.Text = brand + " " + model;
             tc.Controls.Add(lbutton1);
             String carId = ds.Tables[0].Rows[i]["CAR_ID"].ToString();
             DataSet ds1 = obj.GetCarSeller(carId);
             carId = HttpUtility.UrlEncode(obj1.Encrypt(carId));
             sellerId = HttpUtility.UrlEncode(obj1.Encrypt(sellerId));
             lbutton1.PostBackUrl = "CarDetails.aspx?carId=" + carId + "&sellerId=" + sellerId;
             tc.Attributes.Add("width", "150px");
             tc.Attributes.Add("height", "150px");
             flag++;
             if (flag % 5 != 0)
                 tr.Controls.Add(tc);
             else
             {
                 Table1.Rows.Add(tr);
                 tr.Controls.Add(tc);
                 tr = new TableRow();
             }
         }
         Table1.Rows.Add(tr);
         Table1.CellSpacing = 30;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DataSet ds = new DataSet();
     DatabaseHandler obj=new DatabaseHandler();
     ds = obj.GetSellerId(sellerUsername);
     String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
     ds = obj.GetSellerCarStock(sellerId);
     GridView1.DataSource = ds;
     GridView1.DataBind();
 }
Ejemplo n.º 23
0
 private void saveEventButton_Click(object sender, EventArgs e)
 {
     DatabaseHandler db = new DatabaseHandler();
     Event ev = new Event();
     ev.Name = eventNameTB.Text;
     ev.Info = eventInfoRTB.Text;
     if (validateEvent(ev)) {
         db.saveEvent(ev);
         this.Close();
     } else {
         MessageBox.Show(errorMessage);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     DatabaseHandler obj = new DatabaseHandler();
     DataSet ds = obj.GetAllAuctionInfo();
     if (ds == null)
         Label1.Text = "No live auction";
     else
     {
         GridView1.DataSource = ds;
         GridView1.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     EncryptDecrypt obj1=new EncryptDecrypt();
     String sellerId=obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["sellerId"].ToString()));
     DatabaseHandler obj = new DatabaseHandler();
     DataSet ds = obj.GetSellerInfo(sellerId);
     Label1.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     Label2.Text = ds.Tables[0].Rows[0]["SELLER_COUNTRY"].ToString();
     Label3.Text = ds.Tables[0].Rows[0]["SELLER_CITY"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["SELLER_STREET"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["SELLER_PHONE_NUMBER"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["SELLER_EMAIL_ID"].ToString();
 }
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DataSet ds = new DataSet();
     DatabaseHandler obj=new DatabaseHandler();
     ds = obj.GetSellerId(sellerUsername);
     String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
     EncryptDecrypt obj1=new EncryptDecrypt();
     sellerId=HttpUtility.UrlEncode(obj1.Encrypt(sellerId));
     String carId=GridView1.SelectedRow.Cells[0].Text;
     carId=HttpUtility.UrlEncode(obj1.Encrypt(carId));
     Response.Redirect("SellerDisplayCarStockInfo.aspx?sellerId=" + sellerId + "&carId=" + carId);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
      int flag = 0;
     DataSet ds = new DataSet();
     DatabaseHandler obj = new DatabaseHandler();
     ds = obj.GetUpcomingCars();
     if (ds == null)
         Label1.Text = "No car to display";
     else
     {
         int count = ds.Tables[0].Rows.Count;
         TableRow tr = new TableRow();
         for (int i = 0; i < count; i++)
         {
             TableCell tc = new TableCell();
             Image img = new Image();
             img.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[i]["CAR_FRONT_IMAGE"].ToString());
             img.Width = 150;
             img.Height = 150;
             img.ID = "ImageID";
             img.CssClass = "image-zoom";
             tc.Controls.Add(img);
             Label label1 = new Label();
             String carBrand = ds.Tables[0].Rows[i]["CAR_BRAND"].ToString();
             String carModelName = ds.Tables[0].Rows[i]["CAR_MODEL_NAME"].ToString();
             String carModelNumber = ds.Tables[0].Rows[i]["CAR_MODEL_NUMBER"].ToString();
             label1.Text = carBrand + " " + carModelName + " " + carModelNumber;
             tc.Controls.Add(label1);
             tc.Attributes.Add("width", "150px");
             tc.Attributes.Add("height", "150px");
             flag++;
             if (flag % 5 != 0)
             {
                 tr.Controls.Add(tc);
             }
             else
             {
                 Table1.Rows.Add(tr);
                 tr = new TableRow();
                 tr.Controls.Add(tc);
             }
         }
         Table1.Rows.Add(tr);
         Table1.CellSpacing = 30;
     }
 }
Ejemplo n.º 28
0
 public List<AppUser> GetAll()
 {
     List<AppUser> allUsers = new List<AppUser>();
     DatabaseHandler dh = new DatabaseHandler();
     DataTable dt = dh.GetAllAppUsers();
     foreach (DataRow dr in dt.Rows)
     {
         AppUser user = new AppUser();
         user.AppUserId = dr["AppUserID"].ToString();
         user.AppUserPassword = dr["Password"].ToString();
         user.Email = "";
         user.Name = dr["Name"].ToString();
         allUsers.Add(user);
     }
     return allUsers;
 }
    protected void Button2_Click(object sender, EventArgs e)
    {
        String brand = TextBox1.Text;
        String modelName = TextBox2.Text;
        String modelNum = TextBox3.Text;
        String possessionType = RadioButtonList1.Text;
        String yearOfPurchase = DropDownList2.Text;
        String carPrice = TextBox4.Text;
        String carEngine = TextBox5.Text;
        String carStock = TextBox8.Text;
        String fuelType = DropDownList1.Text;
        String frontImg = FileUpload1.PostedFile.FileName;
        String sideImg = FileUpload2.PostedFile.FileName;
        String rearImg = FileUpload3.PostedFile.FileName;

        String frontImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Front");
        String frontImgTarget = Path.Combine(frontImgFolder, frontImg);
        FileUpload1.SaveAs(frontImgTarget);

        String sideImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Side");
        String sideImgTarget = Path.Combine(sideImgFolder, sideImg);
        FileUpload2.SaveAs(sideImgTarget);

        String rearImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Rear");
        String rearImgTarget = Path.Combine(rearImgFolder, rearImg);
        FileUpload3.SaveAs(rearImgTarget);

        DatabaseHandler obj = new DatabaseHandler();
        String carId = "CAR_" + DateTime.Now.Ticks.ToString();
        obj.InsertCar(carId, brand, modelName, modelNum, possessionType, yearOfPurchase, carPrice,
            carEngine, fuelType, frontImgTarget, sideImgTarget, rearImgTarget);
        String sellerUsername = Request.Cookies["Car-Trading"]["Username"];
        DataSet ds = obj.GetSellerId(sellerUsername);
        String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
        ds = obj.GetSellerName(sellerId);
        String sellerName = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
        obj.InsertSellerCar(sellerId, carId, carStock);

        Response.Write("Car Added");
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox5.Text = "";
        TextBox8.Text = "";
        RadioButtonList1.ClearSelection();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        String brandName = TextBox1.Text;
        String modelName = TextBox2.Text;
        String modelNum=TextBox3.Text;
        String carYear = DropDownList2.Text;
        String carPrice = TextBox4.Text;
        String carEngine = TextBox5.Text;
        String carFuel = DropDownList1.Text;
        String frontImg = FileUpload1.PostedFile.FileName;
        String sideImg = FileUpload2.PostedFile.FileName;
        String rearImg = FileUpload3.PostedFile.FileName;
        String auctionStartTime=TextBox6.Text;
        String auctionEndTime=TextBox7.Text;

        String frontImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Front");
        String frontImgTarget = Path.Combine(frontImgFolder, frontImg);
        FileUpload1.SaveAs(frontImgTarget);

        String sideImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Side");
        String sideImgTarget = Path.Combine(sideImgFolder, sideImg);
        FileUpload2.SaveAs(sideImgTarget);

        String rearImgFolder = HttpContext.Current.Server.MapPath("~\\Car\\Rear");
        String rearImgTarget = Path.Combine(rearImgFolder, rearImg);
        FileUpload3.SaveAs(rearImgTarget);

        DatabaseHandler obj = new DatabaseHandler();
        DataSet ds = obj.GetSellerId(Request.Cookies["Car-Trading"]["Username"].ToString());
        String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
        String carId = "CAR_" + DateTime.Now.Ticks.ToString();
        String auctionId = "AUCTION_" + DateTime.Now.Ticks.ToString();
        obj.InsertCar(carId, brandName, modelName, modelNum, "Old", carYear, carPrice, carEngine,
            carFuel, frontImgTarget, sideImgTarget, rearImgTarget);
        obj.InsertAuctionInfo(auctionId, sellerId, carId, auctionStartTime, auctionEndTime, "0");
        Label1.Text = "Car added for auction";
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox5.Text = "";
        TextBox6.Text = "";
        TextBox7.Text = "";
        DropDownList1.ClearSelection();
        DropDownList2.ClearSelection();
    }
Ejemplo n.º 31
0
    public void RegisterNewUser() // poate fi transforata in bool prin schimbare return si decomentare
    {
        bool valid = false;

        string username        = usernameField.text;
        string email           = emailField.text;
        string password        = passwordField.text;
        string passwordConfirm = passwordConfirmField.text;

        if (username.Equals(""))
        {
            errorBoxMsg.text = "Username field is empty!";
            Debug.Log("Username field is empty!");
            //return false;
        }
        else if (email.Equals(""))
        {
            errorBoxMsg.text = "Email field is empty!";
            Debug.Log("Email field is empty!");
            //return false;
        }
        else if (IsValidEmail(email) == false)
        {
            errorBoxMsg.text = "Email is not valid";
            Debug.Log("Email is not valid");
            //return false;
        }
        else if (password.Equals(""))
        {
            errorBoxMsg.text = "Password field is empty!";
            Debug.Log("Password field is empty!");
            //return false;
        }
        else if (password.Length < 6)
        {
            errorBoxMsg.text = "The password is too short!";
            Debug.Log("The password is too short!");
            //return false;
        }
        else if (passwordConfirm.Equals(""))
        {
            errorBoxMsg.text = "Confirm Password field is empty!";
            Debug.Log("Confirm Password field is empty!");
            //return false;
        }
        else if (!(password.Equals(passwordConfirm)))
        {
            errorBoxMsg.text = "The passwords don't match!";
            Debug.Log("The passwords don't match!");
            //return false;
        }
        else
        {
            bool temp = true;
            DatabaseHandler.GetUserByUsername(username, user_returnat =>
            {
                if (user_returnat == null)     //se poate face insert
                {
                    Debug.Log($"The username is available");
                    //Debug.Log($"Name: {usernameField.text}, Email: {emailField.text}, Password: {passwordField.text} PasswordConfirm: {passwordConfirmField.text}");
                    UserCredentials newUser = new UserCredentials(usernameField.text, passwordField.text, emailField.text);
                    DatabaseHandler.PostUser(newUser, () => Debug.Log("User created successfully!"));
                    errorBoxMsg.text = "User created successfully";

                    LoginScript.CurrentUser         = usernameField.text;
                    LoginScript.CurrentUserPassword = passwordField.text;
                    LoginScript.CurrentUserEmail    = emailField.text;
                    SceneManager.LoadScene("MenuScene");     // Temporary
                    temp = true;
                }
                else if (user_returnat.username.Equals(username))
                {
                    errorBoxMsg.text = "The username is already in use. Use another!";
                    Debug.Log($"The username is already in use. Use another!");
                    temp = false;
                }
            }
                                              );
            //return temp;
        }

        if (valid == true)
        {
            errorBoxMsg.text = "Succes";
        }

        //return valid;
    }
Ejemplo n.º 32
0
 public static void EndElection()
 {
     DatabaseHandler.EndElection();
 }
Ejemplo n.º 33
0
        // POST api/values
        public HttpResponseMessage Post([FromBody] JToken postData, HttpRequestMessage request)
        {
            JObject   result      = (JObject)JsonConvert.DeserializeObject(postData.ToString());
            DataTable responseObj = new DataTable();
            string    json        = string.Empty;

            json = JsonConvert.SerializeObject(responseObj);
            DatabaseHandler dh = new DatabaseHandler(configFilePath);
            QueryDispatcher qd = new QueryDispatcher(dh, configFilePath);

            var response = this.Request.CreateResponse(HttpStatusCode.OK);

            try
            {
                if (request.RequestUri.AbsolutePath == "/api/Values/cancel_reservation")
                {
                    qd.CancelReservation(result["reservation_id"].ToString());
                    response.Content = new StringContent("", Encoding.UTF8, "application/json");
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/make_reservation")
                {
                    response         = qd.CreateNewReservation(result["email"].ToString(), JsonConvert.DeserializeObject <List <string> >(result["flights"].ToString()), Convert.ToInt32(result["number_of_tickets"]));
                    response.Content = new StringContent("", Encoding.UTF8, "application/json");
                    return(response);
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/user_reservations")
                {
                    response.Content = new StringContent(qd.FindUserReservations(result["user_id"].ToString()), Encoding.UTF8, "application/json");
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/add_flight")
                {
                    return(qd.AddFlight(result["route_id"].ToString(), result["departure_time_GMT"].ToString(), result["arrival_time_GMT"].ToString(),
                                        Convert.ToInt32(result["ticket_price"].ToString()), result["airplane_IATA"].ToString()));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/cancel_flight")
                {
                    return(qd.RemoveFlight(result["flight_id"].ToString()));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/add_route")
                {
                    return(qd.AddRoute(result["source_airport"].ToString(), result["destination_airport"].ToString(), result["airline_id"].ToString(), result["equipment"].ToString()));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/remove_route")
                {
                    return(qd.RemoveRoute(result["route_id"].ToString()));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/add_airport")
                {
                    return(qd.AddAirport(result["name"].ToString(), result["city"].ToString(), result["country"].ToString(),
                                         result["IATA"].ToString(), result["ICAO"].ToString(), Convert.ToDouble(result["lat"].ToString()),
                                         Convert.ToDouble(result["lon"].ToString()), Convert.ToDouble(result["timezone"].ToString())));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/remove_airport")
                {
                    return(qd.RemoveAirport(result["airport_id"].ToString()));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/add_airplane")
                {
                    return(qd.AddAirplane(result["name"].ToString(), result["IATA"].ToString(), result["ICAO"].ToString(),
                                          Convert.ToInt32(result["cruise_speed"].ToString()), Convert.ToInt32(result["num_of_seats"].ToString())));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/remove_airplane")
                {
                    return(qd.RemoveAirplane(result["IATA"].ToString()));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/add_airline")
                {
                    return(qd.AddAirline(result["name"].ToString(), result["IATA"].ToString(), result["ICAO"].ToString(),
                                         bool.Parse(result["is_active"].ToString()), Convert.ToInt32(result["rating"].ToString())));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/remove_airline")
                {
                    return(qd.RemoveAirline(result["id"].ToString()));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/sign_up")
                {
                    return(qd.SignUp(result["email"].ToString(), result["full_name"].ToString(), DateTime.Parse(result["DOB"].ToString()), result["passport_id"].ToString()));
                }
                else if (request.RequestUri.AbsolutePath == "/api/Values/is_admin")
                {
                    response.Content = new StringContent(qd.IsAdmin(result["email"].ToString(), result["password"].ToString()), Encoding.UTF8, "application/json");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                response.StatusCode = HttpStatusCode.BadRequest;
            }
            response.Headers.Add("Access-Control-Allow-Origin", "*");
            return(response);
        }
Ejemplo n.º 34
0
 public static void StartElection()
 {
     DatabaseHandler.StartElection();
 }
Ejemplo n.º 35
0
 private void clearDatabase_Click(object sender, EventArgs e)
 {
     DatabaseHandler.getInstance().ClearDatabase();
 }
Ejemplo n.º 36
0
        public static async void checkmutes(IGuild guild)
        {
            var guildobj = DatabaseHandler.GetGuild(guild.Id);

            if (guildobj?.ModerationSetup.Mutes.MutedUsers.Any() != true)
            {
                return;
            }
            var mutedrole = guild.Roles.FirstOrDefault(x => x.Id == guildobj.ModerationSetup.Mutes.mutedrole);

            if (mutedrole == null)
            {
                return;
            }
            foreach (var mute in guildobj.ModerationSetup.Mutes.MutedUsers.ToList())
            {
                try
                {
                    if (!mute.expires)
                    {
                        continue;
                    }
                    var removemute = false;
                    var muteduser  = await guild.GetUserAsync(mute.userid);

                    if (muteduser == null)
                    {
                        removemute = true;
                    }
                    else
                    {
                        if (mute.expiry < DateTime.UtcNow)
                        {
                            removemute = true;
                            if (!muteduser.RoleIds.Contains(mutedrole.Id))
                            {
                                await muteduser.RemoveRoleAsync(mutedrole);
                            }
                        }
                    }

                    if (removemute)
                    {
                        guildobj.ModerationSetup.Mutes.MutedUsers.Remove(mute);
                        await guildobj.ModLog(new EmbedBuilder
                        {
                            Title       = "Mute Auto Removed - Expired",
                            Description = $"User: {muteduser?.Username}\n" +
                                          $"UserID: {muteduser?.Id}",
                            Color = Color.DarkGreen
                        }, guild);
                    }
                }
                catch (Exception e)
                {
                    Logger.LogMessage(e.ToString(), LogSeverity.Error);
                }
            }

            guildobj.Save();
        }
Ejemplo n.º 37
0
    public SageWoodResponse PaySageWoodElectricity(string MNo, string amount, string transactionId)
    {
        SageWoodResponse woodResponse = new SageWoodResponse();
        string           rawRequest;
        DatabaseHandler  dh = new DatabaseHandler();

        try
        {
            string    clientId     = "2019112800001";
            string    opName       = "UDEMO";
            string    password     = "******";
            string    meterno      = "14012018064";
            string    date         = DateTime.Now.ToString("yyyyMMddHHmmss").ToString();
            string    randomnumber = GenerateRandomNumber().ToString();
            MeterInfo custInfo     = new MeterInfo();
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback
                                                                          (delegate { return(true); });
            EANDeviceID deviceId = new EANDeviceID();
            deviceId.ean = clientId;
            GenericDeviceID genericDeviceID = new GenericDeviceID();
            genericDeviceID.id = clientId;
            PurchaseValueCurrency purchaseValue = new PurchaseValueCurrency();
            purchaseValue.amt        = new Currency();
            purchaseValue.amt.symbol = "UGX";
            purchaseValue.amt.value  = Decimal.Parse("10");
            Electricity electricity = new Electricity();
            MsgID       msg         = new MsgID();
            msg.dateTime     = DateTime.Now.ToString("yyyyMMddHHmmss").ToString();
            msg.uniqueNumber = randomnumber;
            AuthCred authCred = new AuthCred();
            authCred.opName      = opName;
            authCred.password    = password;
            authCred.newPassword = "";
            MsgID       messageId = msg;
            AuthCred    creds     = authCred;
            MeterDetail meter     = new MeterDetail();
            meter.msno = meterno;
            Cash pay = new Cash();
            pay.tenderAmt        = new Currency();
            pay.tenderAmt.symbol = "UGX";
            pay.tenderAmt.value  = Decimal.Parse("100");
            VendIDMethod vendIDMethod = new VendIDMethod();
            vendIDMethod.meterIdentifier = meter;
            CreditVendReq    request  = new CreditVendReq();
            XMLVendService21 sageWood = new XMLVendService21();
            request.clientID      = deviceId;
            request.msgID         = msg;
            request.authCred      = authCred;
            request.terminalID    = genericDeviceID;
            request.idMethod      = vendIDMethod;
            request.resource      = electricity;
            request.purchaseValue = purchaseValue;
            request.payType       = pay;
            rawRequest            = XmlCreditVend(request);
            CreditVendResp    response     = sageWood.CreditVendRequest(request);
            Tx                tx           = response.creditVendReceipt.transactions.tx[0];
            CreditVendTx      creditVendTx = (CreditVendTx)tx;
            CreditVendReceipt resp         = response.creditVendReceipt;
            STS1Token         sts1Token    = (STS1Token)creditVendTx.creditTokenIssue.token;
            woodResponse.Token     = sts1Token.stsCipher;
            woodResponse.ReceiptNo = response.creditVendReceipt.receiptNo;
            woodResponse.Units     = creditVendTx.creditTokenIssue.units.value.ToString();
            string rawResponse = XmlCreditVendResp(response);

            //log raw request and response
            dh.LogRequestAndResponse("SAGEWOOD", transactionId, rawRequest, rawResponse);
        }
        catch (SoapException soapException)
        {
            // XMLVendFaultResp xmlVendFaultResp = XMLDeserialize.Deserialize(soapException.Detail);

            // if (xmlVendFaultResp.fault.GetType() ==
            //typeof(UnknownMeterEx))
            // {
            //     Console.WriteLine("Unknown Meter Serial Number!");
            // }
            // else
            // {
            //     string fert = xmlVendFaultResp.fault.GetType().ToString();
            //     Console.WriteLine("Unexpected XMLVend Fault Response" +
            //                 "received: (" + xmlVendFaultResp.fault.GetType().ToString()
            //     + ")" + xmlVendFaultResp.fault.desc);
            // }
            dh.LogError(soapException.Detail.InnerXml, transactionId, DateTime.Now, "SAGEWOOD");
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex);
            dh.LogError(ex.ToString(), transactionId, DateTime.Now, "SAGEWOOD");
        }
        return(woodResponse);
    }
Ejemplo n.º 38
0
 public static int GetSeatId(int centerId)
 {
     return(DatabaseHandler.GetSeatIdFromCenterId(centerId));
 }
Ejemplo n.º 39
0
 public GuildHelper(GuildHandler guildHandler, DiscordSocketClient client, DatabaseHandler database)
 {
     _client       = client;
     _guildHandler = guildHandler;
     _database     = database;
 }
Ejemplo n.º 40
0
        public void removeFromClientOptions()
        {
            string query = string.Format(QueryStrings.Option.deleteOptionFromSystem, this.optionGuid);

            DataTable systemData = DatabaseHandler.getInstance().getFromStringQuery(query);
        }
Ejemplo n.º 41
0
 public static int GetCenterStatus(int centerId)
 {
     return(DatabaseHandler.GetCenterStatus(centerId));
 }
Ejemplo n.º 42
0
    public IEnumerator AfterSignRaised(bool combo)
    {
        foreach (var letter in titleLetters)
        {
            Destroy(letter.GetComponent <Draggable>());
        }
        AudioClip sound;

        if (!combo && StoryHandler.madeSignFall)
        {
            sound = SoundHandler.sound.ca;
            StoryHandler.scrambledSign = true;
            DatabaseHandler.PostVariableToDatabase(1, "scrambledSign");
        }
        else if (!combo && !StoryHandler.madeSignFall)
        {
            sound = SoundHandler.sound.cb;
            StoryHandler.scrambledSign = true;
            DatabaseHandler.PostVariableToDatabase(1, "scrambledSign");
        }
        else
        {
            sound = SoundHandler.sound.cc;
            StoryHandler.scrambledSign = false;
            DatabaseHandler.PostVariableToDatabase(1, "nScrambledSign");
        }

        SoundHandler.sound.Play(sound);
        if (!combo && !StoryHandler.madeSignFall)
        {
            yield return(new WaitForSeconds(3.5f));

            foreach (var letter in titleLetters)
            {
                foreach (var letterHolder in letterHolders)
                {
                    if (letterHolder.name[0] == letter.name[0])
                    {
                        letter.transform.position = letterHolder.transform.position;
                    }
                }
            }
        }
        var t = sound.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t);
        }
        while (t >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t    = 1;
            }

            t -= Time.deltaTime;
            yield return(null);
        }
        StartCoroutine(GameStillNotLoading());
    }
Ejemplo n.º 43
0
 private void Awake()
 {
     dbHandler = GameObject.Find("DatabaseHandler").GetComponent <DatabaseHandler>();
     graph     = GameObject.Find("Window_Graph").GetComponent <WindowGraph>();
 }
Ejemplo n.º 44
0
    private IEnumerator BigCrash()
    {
        SoundHandler.sound.Play(SoundHandler.sound._d);
        var t = SoundHandler.sound._d.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t);
        }
        while (t >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t    = 1;
            }

            t -= Time.deltaTime;
            yield return(null);
        }

        optionBox.playerChoice = 0;
        optionBox.PopupOptionBox("WHAT DO YOU WANT TO SAY?", "YES", "NO");
        while (optionBox.playerChoice == 0)
        {
            yield return(null);
        }

        if (optionBox.playerChoice == 1)
        {
            StoryHandler.saidYes = true;
            DatabaseHandler.PostVariableToDatabase(1, "saidYes");

            SoundHandler.sound.Play(SoundHandler.sound._eb);
            var t1 = SoundHandler.sound._eb.length;
            if (isSkipMode)
            {
                skipButtonScript.PopupSkipButton(t1);
            }
            while (t1 >= 0)
            {
                if (Skip)
                {
                    Skip = false;
                    t1   = 1;
                }

                t1 -= Time.deltaTime;
                yield return(null);
            }
        }
        else
        {
            DatabaseHandler.PostVariableToDatabase(1, "nSaidYes");

            SoundHandler.sound.Play(SoundHandler.sound._ea);
            var t1 = SoundHandler.sound._ea.length;
            if (isSkipMode)
            {
                skipButtonScript.PopupSkipButton(t1);
            }
            while (t1 >= 0)
            {
                if (Skip)
                {
                    Skip = false;
                    t1   = 1;
                }

                t1 -= Time.deltaTime;
                yield return(null);
            }
        }

        DatabaseHandler.PostVariableToDatabase(1, isSkipMode ? "finishedChapterSkip" : "finishedChapterNormal");
        SceneManager.LoadScene(8);

        optionBox.playerChoice = 0;
    }
        /// <summary>
        ///     Attempts to get a previously created announcement message based on values that were stored in the DB.
        ///     If the located message does not match the current event it will be deleted.
        ///     If nothing can be located, it does nothing.
        /// </summary>
        /// <returns></returns>
        public async Task TryAttachPreviousAnnounceMessage()
        {
            var testEvent = _calendar.GetTestEvent();

            //Get the last known message
            _oldMessage = DatabaseHandler.GetAnnouncementMessage();

            //No message found in the DB, do nothing. Likely to happen when DB is new.
            if (_oldMessage == null)
            {
                if (_data.RSettings.ProgramSettings.Debug)
                {
                    _ = _log.LogMessage("No message found in DB to reattach to", false, color: LOG_COLOR);
                }

                return;
            }

            //Make sure a test is valid
            if (!testEvent.IsValid)
            {
                if (_data.RSettings.ProgramSettings.Debug)
                {
                    _ = _log.LogMessage("No valid test found to post", false, color: LOG_COLOR);
                }

                return;
            }

            _ = _log.LogMessage("Attempting to get old announcement message\n" +
                                $"{_oldMessage.AnnouncementId} that was created at {_oldMessage.AnnouncementDateTime}",
                                false, color: LOG_COLOR);


            var eventEditTime = _calendar.GetTestEventNoUpdate().EventEditTime;

            if (eventEditTime != null && eventEditTime.Value.Equals(_oldMessage.AnnouncementDateTime))
            {
                try
                {
                    PlaytestAnnouncementMessage =
                        await _data.AnnouncementChannel.GetMessageAsync(_oldMessage.AnnouncementId) as IUserMessage;

                    if (PlaytestAnnouncementMessage != null)
                    {
                        _ = _log.LogMessage($"Retrieved old announcement! ID: {PlaytestAnnouncementMessage.Id}", false,
                                            color: LOG_COLOR);
                    }

                    var lastEditTime = _calendar.GetTestEventNoUpdate().LastEditTime;
                    if (lastEditTime != null)
                    {
                        _lastSeenEditTime = lastEditTime.Value;
                    }
                }
                catch
                {
                    _ = _log.LogMessage("Unable to retrieve old announcement message!", false, color: LOG_COLOR);
                }
            }
            else
            {
                _ = _log.LogMessage("Messages do not match, deleting old message", false, color: LOG_COLOR);
                try
                {
                    await _data.AnnouncementChannel.DeleteMessageAsync(_oldMessage.AnnouncementId);

                    PlaytestAnnouncementMessage = null;
                }
                catch
                {
                    _ = _log.LogMessage("Could not delete old message - it was likely deleted manually",
                                        false, color: LOG_COLOR);
                }
            }
        }
Ejemplo n.º 46
0
    public IEnumerator FinishEditor()
    {
        Destroy(GameObject.Find("LeaveEditorButton"));
        EditorHandler.activated      = false;
        GPlayerController.activated  = false;
        GPlayerController.editorMode = false;

        if (StoryHandler.leftEditor)
        {
            DatabaseHandler.PostVariableToDatabase(1, "nLeftEditor");
        }
        DatabaseHandler.PostVariableToDatabase(1, "nDeletedPlayer");

        if (StoryHandler.likedGirlGame)
        {
            SoundHandler.sound.Play(SoundHandler.sound._bc);
            yield return(new WaitForSeconds(SoundHandler.sound._bc.length));
        }
        else
        {
            optionBox.playerChoice = 0;
            SoundHandler.sound.Play(SoundHandler.sound._bb);
            var t = SoundHandler.sound._bb.length;
            if (isSkipMode)
            {
                skipButtonScript.PopupSkipButton(t);
            }
            while (t >= 0)
            {
                if (Skip)
                {
                    Skip = false;
                    t    = 1;
                }

                t -= Time.deltaTime;
                yield return(null);
            }

            optionBox.PopupOptionBox("WHAT DO YOU THINK OF THE GAME NOW?", "IT'S GREAT", "IT'S STILL BAD");
            while (optionBox.playerChoice == 0)
            {
                yield return(null);
            }

            if (optionBox.playerChoice == 1)
            {
                StoryHandler.likedGirlGameAgain = true;
                DatabaseHandler.PostVariableToDatabase(1, "likedGirlGameAgain");
                SoundHandler.sound.Play(SoundHandler.sound._ca);
                var t1 = SoundHandler.sound._ca.length;
                if (isSkipMode)
                {
                    skipButtonScript.PopupSkipButton(t1);
                }
                while (t1 >= 0)
                {
                    if (Skip)
                    {
                        Skip = false;
                        t1   = 1;
                    }

                    t1 -= Time.deltaTime;
                    yield return(null);
                }
            }
            else
            {
                DatabaseHandler.PostVariableToDatabase(1, "nLikedGirlGameAgain");
                SoundHandler.sound.Play(SoundHandler.sound._cb);
                yield return(SoundHandler.sound._cb.length);
            }
            optionBox.playerChoice = 0;
        }

        StartCoroutine(BigCrash());
    }
Ejemplo n.º 47
0
    public SageWoodResponse ValidateSageWoodMeter(string meterNo)
    {
        string           rawRequest;
        SageWoodResponse woodResponse = new SageWoodResponse();
        DatabaseHandler  dh           = new DatabaseHandler();

        try
        {
            string clientId = "2019112800001";
            string opName   = "UDEMO";
            string password = "******";
            //string meterno = "14012018064";//replace with user input
            string    date         = DateTime.Now.ToString("yyyyMMddHHmmss").ToString();
            string    randomnumber = GenerateRandomNumber().ToString();
            MeterInfo custInfo     = new MeterInfo();
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback
                                                                          (delegate { return(true); });
            EANDeviceID deviceId = new EANDeviceID();
            deviceId.ean = clientId;
            GenericDeviceID genericDeviceID = new GenericDeviceID();
            genericDeviceID.id = clientId;
            PurchaseValueCurrency purchaseValue = new PurchaseValueCurrency();
            purchaseValue.amt        = new Currency();
            purchaseValue.amt.symbol = "UGX";
            purchaseValue.amt.value  = Decimal.Parse("10");
            Electricity electricity = new Electricity();
            MsgID       msg         = new MsgID();
            msg.dateTime     = DateTime.Now.ToString("yyyyMMddHHmmss").ToString();
            msg.uniqueNumber = randomnumber;
            AuthCred authCred = new AuthCred();
            authCred.opName      = opName;
            authCred.password    = password;
            authCred.newPassword = "";
            MsgID       messageId = msg;
            AuthCred    creds     = authCred;
            MeterDetail meter     = new MeterDetail();
            meter.msno = meterNo;
            VendIDMethod vendIDMethod = new VendIDMethod();
            vendIDMethod.meterIdentifier = meter;
            ConfirmCustomerReq request  = new ConfirmCustomerReq();
            XMLVendService21   sageWood = new XMLVendService21();
            request.clientID   = deviceId;
            request.msgID      = msg;
            request.authCred   = authCred;
            request.terminalID = genericDeviceID;
            request.idMethod   = vendIDMethod;
            rawRequest         = XmlConfirmCustomerReq(request);
            ConfirmCustomerResp response = sageWood.ConfirmCustomerRequest(request);
            string rawResponse           = XmlConfirmCustomerResp(response);
            //log raw request and response
            dh.LogRequestAndResponse("SAGEWOOD", meterNo, rawRequest, rawResponse);
            foreach (ConfirmCustResult meterDetails in response.confirmCustResult)
            {
                woodResponse.Name               = meterDetails.custVendDetail.name;
                woodResponse.Msno               = meterDetails.custVendDetail.accNo;
                woodResponse.Address            = meterDetails.custVendDetail.address;
                woodResponse.ContactNo          = meterDetails.custVendDetail.contactNo;
                woodResponse.AccNo              = meterDetails.custVendDetail.accNo;
                woodResponse.LocRef             = meterDetails.custVendDetail.locRef;
                woodResponse.DaysOflastPurchase = meterDetails.custVendDetail.daysLastPurchase;
                woodResponse.StatusCode         = "0";
                woodResponse.StatusDescription  = "SUCCESS";
            }
        }
        catch (SoapException soapException)
        {
            //XMLVendFaultResp xmlVendFaultResp = XMLDeserialize.Deserialize(soapException.Detail);

            // if (xmlVendFaultResp.fault.GetType() ==
            //typeof(UnknownMeterEx))
            // {
            //     Console.WriteLine("Unknown Meter Serial Number!");
            // }
            // else
            // {
            //     string fert = xmlVendFaultResp.fault.GetType().ToString();
            //     Console.WriteLine("Unexpected XMLVend Fault Response" +
            //                 "received: (" + xmlVendFaultResp.fault.GetType().ToString()
            //     + ")" + xmlVendFaultResp.fault.desc);
            // }
            dh.LogError(soapException.Detail.InnerXml, meterNo, DateTime.Now, "SAGEWOOD");
            woodResponse.StatusCode = "100";
            woodResponse.Name       = "INVALID METER NUMBER";
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex);
            dh.LogError(ex.ToString(), meterNo, DateTime.Now, "SAGEWOOD");
            woodResponse.StatusCode = "100";
            woodResponse.Name       = "INVALID METER NUMBER";
        }
        return(woodResponse);
    }
Ejemplo n.º 48
0
    public IEnumerator StartRandomGame2()
    {
        ClickHandler.Active    = false;
        optionBox.playerChoice = 0;

        if (!StoryHandler.gaveUpFirstPuzzle)
        {
            SoundHandler.sound.Play(SoundHandler.sound.w);
            var t = SoundHandler.sound.w.length;
            if (isSkipMode)
            {
                skipButtonScript.PopupSkipButton(t);
            }
            while (t >= 0)
            {
                if (Skip)
                {
                    Skip = false;
                    t    = 1;
                }

                t -= Time.deltaTime;
                yield return(null);
            }

            optionBox.PopupOptionBox("WHAT DO YOU WANT TO SAY?", "I LIKED IT", "YOUR GAME IS BETTER");
            while (optionBox.playerChoice == 0)
            {
                yield return(null);
            }

            if (optionBox.playerChoice == 1)
            {
                StoryHandler.likedSimonGame = true;
                DatabaseHandler.PostVariableToDatabase(1, "likedSimonGame");
                SoundHandler.sound.Play(SoundHandler.sound.xb);
                var t1 = SoundHandler.sound.xb.length;
                if (isSkipMode)
                {
                    skipButtonScript.PopupSkipButton(t1);
                }
                while (t1 >= 0)
                {
                    if (Skip)
                    {
                        Skip = false;
                        t1   = 1;
                    }

                    t1 -= Time.deltaTime;
                    yield return(null);
                }

                if (StoryHandler.likedGirlGame)
                {
                    SoundHandler.sound.Play(SoundHandler.sound.xba);
                    var t2 = SoundHandler.sound.ua.length;
                    if (isSkipMode)
                    {
                        skipButtonScript.PopupSkipButton(t2);
                    }
                    while (t2 >= 0)
                    {
                        if (Skip)
                        {
                            Skip = false;
                            t2   = 1;
                        }

                        t2 -= Time.deltaTime;
                        yield return(null);
                    }
                }

                SoundHandler.sound.PlaySecondary(SoundHandler.sound.loadingSound);
                gameStarterImage.enabled    = true;
                gameStarterAnimator.enabled = true;
                gameStarterAnimator.Play("Opacity100P");
                yield return(new WaitForSeconds(SoundHandler.sound.loadingSound.length));

                SceneManager.LoadScene(7);
            }
            else
            {
                DatabaseHandler.PostVariableToDatabase(1, "nLikedSimonGame");
                SoundHandler.sound.Play(SoundHandler.sound.xa);
                var t1 = SoundHandler.sound.xa.length;
                if (isSkipMode)
                {
                    skipButtonScript.PopupSkipButton(t1);
                }
                while (t1 >= 0)
                {
                    if (Skip)
                    {
                        Skip = false;
                        t1   = 1;
                    }

                    t1 -= Time.deltaTime;
                    yield return(null);
                }

                if (StoryHandler.likedGirlGame)
                {
                    SoundHandler.sound.Play(SoundHandler.sound.xaa);
                    var t2 = SoundHandler.sound.ua.length;
                    if (isSkipMode)
                    {
                        skipButtonScript.PopupSkipButton(t2);
                    }
                    while (t2 >= 0)
                    {
                        if (Skip)
                        {
                            Skip = false;
                            t2   = 1;
                        }

                        t2 -= Time.deltaTime;
                        yield return(null);
                    }
                }

                ClickHandler.Active = true;
            }

            optionBox.playerChoice = 0;
        }
        else
        {
            SoundHandler.sound.Play(SoundHandler.sound.wa);
            var t = SoundHandler.sound.wa.length;
            if (isSkipMode)
            {
                skipButtonScript.PopupSkipButton(t);
            }
            while (t >= 0)
            {
                if (Skip)
                {
                    Skip = false;
                    t    = 1;
                }

                t -= Time.deltaTime;
                yield return(null);
            }

            if (StoryHandler.likedGirlGame)
            {
                SoundHandler.sound.Play(SoundHandler.sound.xba);
                var t1 = SoundHandler.sound.xba.length;
                if (isSkipMode)
                {
                    skipButtonScript.PopupSkipButton(t1);
                }
                while (t1 >= 0)
                {
                    if (Skip)
                    {
                        Skip = false;
                        t1   = 1;
                    }

                    t1 -= Time.deltaTime;
                    yield return(null);
                }
            }

            SoundHandler.sound.PlaySecondary(SoundHandler.sound.loadingSound);
            gameStarterImage.enabled    = true;
            gameStarterAnimator.enabled = true;
            gameStarterAnimator.Play("Opacity100P");
            yield return(new WaitForSeconds(SoundHandler.sound.loadingSound.length));

            SceneManager.LoadScene(7);
        }
    }
Ejemplo n.º 49
0
 //opens a new search page
 public async void Search()
 {
     await Navigation.PushAsync(new SearchPage(DatabaseHandler.GetDatabase().GetLocations()));
 }
Ejemplo n.º 50
0
 //pre initialization
 private void PreInit()
 {
     //init the database
     DatabaseHandler.InitDatabase();
     ImageBaseHandler.InitImageBaseHanlder();
 }
Ejemplo n.º 51
0
 private void Reqister_Click(object sender, EventArgs e)
 {
     DatabaseHandler handler = new DatabaseHandler();
     handler.Reqister(textBox_Username.Text, textBox_email.Text, textBox_password.Text);
 }
Ejemplo n.º 52
0
    public IEnumerator StartRandomGame()
    {
        optionBox.playerChoice = 0;
        ClickHandler.Active    = false;

        yield return(new WaitForSeconds(1f));

        SoundHandler.sound.Play(SoundHandler.sound.m);
        var t = SoundHandler.sound.m.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t);
        }
        while (t >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t    = 1;
            }

            t -= Time.deltaTime;
            yield return(null);
        }

        optionBox.PopupOptionBox("WHAT DO YOU WANT TO DO?", "TELL HIM", "REMAIN SILENT");
        while (optionBox.playerChoice == 0)
        {
            yield return(null);
        }

        StoryHandler.saidName  = optionBox.playerChoice == 1;
        optionBox.playerChoice = 0;

        if (StoryHandler.saidName)
        {
            DatabaseHandler.PostVariableToDatabase(1, "saidName");
            SoundHandler.sound.Play(SoundHandler.sound.na);
            var t1 = SoundHandler.sound.na.length;
            if (isSkipMode)
            {
                skipButtonScript.PopupSkipButton(t1);
            }
            while (t1 >= 0)
            {
                if (Skip)
                {
                    Skip = false;
                    t1   = 1;
                }

                t1 -= Time.deltaTime;
                yield return(null);
            }
        }
        else
        {
            DatabaseHandler.PostVariableToDatabase(1, "nSaidName");
            SoundHandler.sound.Play(SoundHandler.sound.nb);
            var t2 = SoundHandler.sound.nb.length;
            if (isSkipMode)
            {
                skipButtonScript.PopupSkipButton(t2);
            }
            while (t2 >= 0)
            {
                if (Skip)
                {
                    Skip = false;
                    t2   = 1;
                }

                t2 -= Time.deltaTime;
                yield return(null);
            }
        }

        SoundHandler.sound.Play(SoundHandler.sound.o);
        var t3 = SoundHandler.sound.o.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t3);
        }
        while (t3 >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t3   = 1;
            }

            t3 -= Time.deltaTime;
            yield return(null);
        }

        infoBox.PopupInfoBox("TRY DRAGGING THE BLOCKS TO THE LIGHT", 5);
        giveUpButtonScript.PopdownGiveUpButton();
        onFirstPuzzle       = true;
        ClickHandler.Active = true;
    }
Ejemplo n.º 53
0
 public static void BlockCenter()
 {
     DatabaseHandler.BlockCenter(CenterId);
 }
 private void SaveConnectionForLater(IncomingLoginAttempt args)
 {
     DatabaseHandler.AddRecordToSavedConnections(args);
 }
Ejemplo n.º 55
0
        public async Task OnCommandExecutedAsync(Optional <CommandInfo> command, ICommandContext context, IResult result)
        {
            bool error_state = false;

            switch (result)
            {
            case WestbotCommandResult customResult:
                if (!customResult.Get_reaction())
                {
                    break;     //no reaction needed
                }
                if (customResult.IsSuccess)
                {
                    error_state = AcceptState.Accept;
                }
                else
                {
                    error_state = AcceptState.Error;
                }

                break;

            default:
                if (!string.IsNullOrEmpty(result.ErrorReason))
                {
                    error_state = AcceptState.Error;
                }
                else
                {
                    error_state = AcceptState.Accept;
                }
                break;
            }

            string reaction_type;

            if (!error_state)
            {
                reaction_type = "Accept";
            }
            else
            {
                reaction_type = "Error";
            }

            int ReturnValue = DatabaseHandler.EmoteOrEmoji(reaction_type);

            if (ReturnValue == 0)
            {   //Emojis
                string ReturnString = DatabaseHandler.GetRandomEmoji(reaction_type);

                Emoji emoji_to_add = new Emoji(ReturnString);
                await context.Message.AddReactionAsync(emoji_to_add);
            }
            else
            {   //emotes
                long   ReturnID = DatabaseHandler.GetRandomEmote(reaction_type);
                UInt64 ResultID = (UInt64)ReturnID;

                IEmote emote_to_add = context.Guild.Emotes.FirstOrDefault(x => x.Id == ResultID);
                //var emote_to_add = Context.Guild.GetEmoteAsync(result);

                await context.Message.AddReactionAsync((IEmote)emote_to_add);
            }
        }
Ejemplo n.º 56
0
 public ReservationController(ReservationContext context, UserManager <Teacher> userManager)
 {
     _reservationContext = context;
     _databaseHandler    = new DatabaseHandler(context);
     _userManager        = userManager;
 }
Ejemplo n.º 57
0
        public void UpdateSelfInDB()
        {
            DatabaseHandler db = new DatabaseHandler();

            db.UpdatePatient(this);
        }
Ejemplo n.º 58
0
        public int DeleteWithStoredProc(string storedProc, params object[] storedProcParameters)
        {
            int rowsAffected = DatabaseHandler.ExecuteNonQuery(storedProc, storedProcParameters);

            return(rowsAffected);
        }
Ejemplo n.º 59
0
    public IEnumerator FinishFirstPuzzle(bool failed = false)
    {
        if (!failed)
        {
            giveUpButtonScript.PopupGiveUpButton();
        }
        foreach (var square in GameObject.FindGameObjectsWithTag("Square"))
        {
            square.GetComponent <BoxCollider2D>().enabled = false;
        }

        if (failed)
        {
            StoryHandler.gaveUpFirstPuzzle = true;
            DatabaseHandler.PostVariableToDatabase(1, "gaveUpFirstPuzzle");
        }
        else
        {
            DatabaseHandler.PostVariableToDatabase(1, "nGaveUpFirstPuzzle");
        }
        SoundHandler.sound.Play(failed ? SoundHandler.sound.pa : SoundHandler.sound.p);
        var t = failed ? SoundHandler.sound.pa.length : SoundHandler.sound.p.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t);
        }
        while (t >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t    = 1;
            }

            t -= Time.deltaTime;
            yield return(null);
        }

        var sound = SoundHandler.sound.qb;

        if (StoryHandler.likedGirlGame)
        {
            sound = SoundHandler.sound.qa;
        }

        SoundHandler.sound.Play(sound);
        var t1 = sound.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t1);
        }
        while (t1 >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t1   = 1;
            }

            t1 -= Time.deltaTime;
            yield return(null);
        }


        if (StoryHandler.madeSignFall && StoryHandler.scrambledSign && !StoryHandler.wentToGuyGame)
        {
            sound = SoundHandler.sound.rb;
        }
        else
        {
            sound = SoundHandler.sound.ra;
        }

        SoundHandler.sound.Play(sound);
        var t2 = sound.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t2);
        }
        while (t2 >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t2   = 1;
            }

            t2 -= Time.deltaTime;
            yield return(null);
        }

        infoBox.PopupInfoBox(StoryHandler.likedGirlGame ? "PAUL LEFT THE GAME" : "SERENA AND PAUL LEFT THE GAME", 6);

        optionBox.playerChoice = 0;

        yield return(new WaitForSeconds(2));

        SoundHandler.sound.Play(SoundHandler.sound.s);
        var t3 = SoundHandler.sound.s.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t3);
        }
        while (t3 >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t3   = 1;
            }

            t3 -= Time.deltaTime;
            yield return(null);
        }

        optionBox.PopupOptionBox("WHAT DO YOU WANT TO DO?", "GO WITH SIMON", "STAY WITH DAVE");
        while (optionBox.playerChoice == 0)
        {
            yield return(null);
        }

        sound = optionBox.playerChoice == 1 ? SoundHandler.sound.ta : SoundHandler.sound.tb;
        optionBox.playerChoice = 0;

        SoundHandler.sound.Play(sound);
        var t4 = sound.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t4);
        }
        while (t4 >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t4   = 1;
            }

            t4 -= Time.deltaTime;
            yield return(null);
        }

        sound = failed ? SoundHandler.sound.taa : SoundHandler.sound.tba;
        SoundHandler.sound.Play(sound);
        var t5 = sound.length;

        if (isSkipMode)
        {
            skipButtonScript.PopupSkipButton(t5);
        }
        while (t5 >= 0)
        {
            if (Skip)
            {
                Skip = false;
                t5   = 1;
            }

            t5 -= Time.deltaTime;
            yield return(null);
        }

        SoundHandler.sound.PlaySecondary(SoundHandler.sound.loadingSound);
        gameStarterImage.enabled    = true;
        gameStarterAnimator.enabled = true;
        gameStarterAnimator.Play("Opacity100BL");
        yield return(new WaitForSeconds(SoundHandler.sound.loadingSound.length));

        SceneManager.LoadScene(5);
    }
Ejemplo n.º 60
0
 public SchedulerService(DatabaseHandler database)
 {
     _database = database;
 }