Esempio n. 1
0
    protected void BtnAddTicket_Click(object sender, EventArgs e)
    {
        LotteryWebService.DBService          lws = new LotteryWebService.DBService();
        LotteryWebService.WebServiceResponse wsr = new LotteryWebService.WebServiceResponse();
        try
        {
            wsr = lws.InsertTicketInfo(TicketNo.Value.Trim(), int.Parse(TicketPrice.Value.Trim()), int.Parse(PriceAmount.Value.Trim()), DateTime.Parse(DateTime.Now.ToString("yyy-MM-dd")), DateTime.Parse(CloseDate.Value), DateTime.Parse(DrawDate.Value), Status.SelectedItem.Text);
            if (wsr.Status == "1")
            {
                Response.Redirect("Admin.aspx", false);
                Context.ApplicationInstance.CompleteRequest();
            }
            else if (wsr.Status == "0")
            {
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + wsr.Error + "');", true);
            }
        }

        catch (Exception ex)
        {
            //string message = string.Format("Message: {0}", ex.Message);
            // int st = message.IndexOf("System.Exception:");
            // int en = message.IndexOf(".\n");
            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message.Replace("\'", " ") + "');", true);
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Session["UserId"] as string))
                {
                    LotteryWebService.DBService  lws = new LotteryWebService.DBService();
                    LotteryWebService.TicketInfo ti  = new LotteryWebService.TicketInfo();

                    ti = lws.GetTicketInfo();

                    if (ti.Status != 0)
                    {
                        Availability.InnerHtml = ti.TicketCount.ToString();
                        ProductPrice.InnerHtml = ti.TicketPrice.ToString();
                    }
                }
                else
                {
                    Response.Redirect("Login.aspx", false);
                    Context.ApplicationInstance.CompleteRequest();
                }
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message.Replace("\'", " ") + "');", true);
        }
    }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             if (!string.IsNullOrEmpty(Session["UserId"] as string))
             {
                 //Response.Redirect("UserHome.aspx", false);
                 // Context.ApplicationInstance.CompleteRequest();
             }
             else
             {
                 db  = new LotteryWebService.DBService();
                 wsr = db.GetUserCount();
                 if (wsr.Status != "0")
                 {
                     userCount.InnerText   = wsr.Status + "+";
                     ActiveCount.InnerText = Application["TotalOnlineUsers"].ToString();
                 }
                 else if (wsr.Status == "0")
                 {
                     ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + wsr.Error + "');", true);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message.Replace("\'", " ") + "');", true);
     }
 }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Session["Name"] as string))
                {
                    db        = new LotteryWebService.DBService();
                    Ticketsds = db.GetStoreInfo();
                    if (Ticketsds.Tables["Response"].Rows[0][0].ToString() == "1")
                    {
                        DataTable dt = Ticketsds.Tables["StoreInfo"];


                        StringBuilder sb = new StringBuilder();
                        //Table start.
                        sb.Append("<table>");

                        //Adding HeaderRow.
                        sb.Append("<tr>");
                        foreach (DataColumn column in dt.Columns)
                        {
                            sb.Append("<th>" + column.ColumnName + "</th>");
                        }
                        sb.Append("</tr>");


                        //Adding DataRow.
                        foreach (DataRow row in dt.Rows)
                        {
                            sb.Append("<tr>");
                            foreach (DataColumn column in dt.Columns)
                            {
                                sb.Append("<td>" + row[column.ColumnName].ToString() + "</td>");
                            }
                            sb.Append("</tr>");
                        }

                        //Table end.
                        sb.Append("</table>");
                        StoreInfo.Text = sb.ToString();
                    }
                    else if (Ticketsds.Tables["Response"].Rows[0][0].ToString() == "0")
                    {
                        ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + Ticketsds.Tables["Response"].Rows[0][1].ToString() + "');", true);
                    }
                }
                else
                {
                    Response.Redirect("Home.aspx", false);
                    Context.ApplicationInstance.CompleteRequest();
                }
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message.Replace("\'", " ") + "');", true);
        }
    }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             if (Session["UserId"] != null)
             {
                 //Log.InnerHtml = "Logout";
                 btnLogin.Text = "Signout";
                 lws           = new LotteryWebService.DBService();
                 wsr           = new LotteryWebService.WebServiceResponse();
             }
             else
             {
                 Response.Redirect("Login.aspx", false);
                 Context.ApplicationInstance.CompleteRequest();
             }
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message.Replace("\'", " ") + "');", true);
     }
 }
Esempio n. 6
0
 protected void BtnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         lws = new LotteryWebService.DBService();
         wsr = new LotteryWebService.WebServiceResponse();
         wsr = lws.VerifyUserLogin(UserId.Value.Trim(), Password.Value.Trim());
         if (wsr.Status != "")
         {
             Session["UserId"] = wsr.Status;
             Response.Redirect("UserHome.aspx", false);
             Context.ApplicationInstance.CompleteRequest();
         }
         else if (wsr.Status == "0")
         {
             ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + wsr.Error + "')", true);
         }
         else
         {
             ClientScript.RegisterStartupScript(GetType(), "alert", "alert('UserName Or Password Incorrect');", true);
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message + "');", true);
     }
 }
Esempio n. 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     lws  = new LotteryWebService.DBService();
     ms   = new MailService.Mail();
     wsr  = new MailService.WebServiceResponse();
     wsr1 = new  LotteryWebService.WebServiceResponse();
     wsr2 = new LotteryWebService.WebServiceResponse();
 }
Esempio n. 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Session["UserId"] as string))
                {
                    lws = new LotteryWebService.DBService();
                    ui  = new LotteryWebService.UserInfo();

                    ui = lws.GetUserInfo(Session["UserId"].ToString());

                    if (ui.Status != 0)
                    {
                        FirstName.Value   = ui.FirstName;
                        LastName.Value    = ui.LastName;
                        PhoneNumber.Value = ui.PhoneNumber;
                        Email.Value       = ui.Email;
                        //Password.Value = ui.Password;
                        DOB.Value         = ui.DateOfBirth;
                        Nationality.Value = ui.Nationality;
                        ID.Value          = ui.IDType;
                        IDNo.Value        = ui.IdNo;
                        Address.Value     = ui.Address;
                        State.Value       = ui.State;
                        City.Value        = ui.City;
                        Code.Value        = ui.Code;
                        //FirstName.Attributes.Add("readonly","readonly");
                    }
                }
                else
                {
                    Response.Redirect("Login.aspx", false);
                    Context.ApplicationInstance.CompleteRequest();
                }
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message.Replace("\'", " ") + "');", true);
        }
    }
Esempio n. 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             if (!string.IsNullOrEmpty(Session["Name"] as string))
             {
                 db        = new LotteryWebService.DBService();
                 Ticketsds = db.GetTicketsInfo();
                 if (Ticketsds.Tables["Response"].Rows[0][0].ToString() == "1")
                 {
                     GridView1.DataSource = Ticketsds.Tables["TicketsInfo"];
                     GridView1.DataBind();
                     Ticketsds.Dispose();
                 }
                 else if (Ticketsds.Tables["Response"].Rows[0][0].ToString() == "0")
                 {
                     ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + Ticketsds.Tables["Response"].Rows[0][1].ToString() + "');", true);
                 }
                 else
                 {
                     Response.Redirect("Home.aspx", false);
                     Context.ApplicationInstance.CompleteRequest();
                 }
             }
             else
             {
                 Response.Redirect("Home.aspx", false);
                 Context.ApplicationInstance.CompleteRequest();
             }
         }
     }
     catch (Exception ex)
     {
         ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message.Replace("\'", " ") + "');", true);
     }
 }
Esempio n. 10
0
    protected void BtnAddStore_Click(object sender, EventArgs e)
    {
        LotteryWebService.DBService          lws = new LotteryWebService.DBService();
        LotteryWebService.WebServiceResponse wsr = new LotteryWebService.WebServiceResponse();
        try
        {
            wsr = lws.InsertStoreInfo(StoreName.Value.Trim(), Address.Value.Trim(), Timing.Value.Trim());

            if (wsr.Status == "1")
            {
                Response.Redirect("Store.aspx", false);
                Context.ApplicationInstance.CompleteRequest();
            }
            else if (wsr.Status == "0")
            {
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + wsr.Error + "');", true);
            }
        }

        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message.Replace("\'", " ") + "');", true);
        }
    }