Ejemplo n.º 1
0
        public WebServiceResponse InsertTicketInfo(string TicketNo, int TicketPrice, int PriceAmount, DateTime DisplayDate, DateTime CloseDate, DateTime DrawDate, string Status)
        {
            try
            {
                wsr = new WebServiceResponse();
                using (SqlCmd = new SqlCommand("INSERT into TicketInfo(TicketNo,TicketPrice,PriceAmount,DisplayDate,CloseDate,DrawDate,Status) values('" + TicketNo + "','" + TicketPrice + "','" + PriceAmount + "','" + Convert.ToDateTime(DisplayDate).ToString("yyy/MM/dd HH:mm:ss") + "','" + Convert.ToDateTime(CloseDate).ToString("yyy/MM/dd HH:mm:ss") + "','" + Convert.ToDateTime(DrawDate).ToString("yyy/MM/dd HH:mm:ss") + "','" + Status + "')", SqlCon))
                {
                    SqlCon.Open();
                    int res = SqlCmd.ExecuteNonQuery();
                    if (res == 1)
                    {
                        wsr.Status = "1";
                    }
                }
                SqlCon.Close();
                return(wsr);
            }
            catch (Exception ex)
            {
                wsr.Status = "0";
                wsr.Error  = ex.Message;
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }

                return(wsr);
            }
        }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
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);
        }
    }
Ejemplo n.º 4
0
        public WebServiceResponse GetTicketCount()
        {
            try
            {
                wsr = new WebServiceResponse();
                SqlCon.Open();
                using (SqlCmd = new SqlCommand("SELECT COUNT(*) AS TicketCount FROM TicketInfo ", SqlCon))
                {
                    string Count = SqlCmd.ExecuteScalar().ToString();

                    if (Count != "")
                    {
                        wsr.Status = Count;
                    }
                    SqlCon.Close();
                    return(wsr);
                }
            }
            catch (Exception ex)
            {
                wsr.Status = "0";
                wsr.Error  = ex.Message;
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }

                return(wsr);
            }
        }
Ejemplo n.º 5
0
        public WebServiceResponse VerifyUserLogin(string UserId, string Password)
        {
            try
            {
                wsr = new WebServiceResponse();
                using (SqlCmd = new SqlCommand("Select UserId From UserLoginInfo where Userid='" + UserId + "' and Password='******' and Status=1 ", SqlCon))
                {
                    SqlCon.Open();
                    var name = SqlCmd.ExecuteScalar();

                    if (name != null)
                    {
                        wsr.Status = name.ToString();
                    }
                }
                SqlCon.Close();
                return(wsr);
            }
            catch (Exception ex)
            {
                wsr.Status = "0";
                wsr.Error  = ex.Message;

                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }
                return(wsr);
            }
        }
Ejemplo n.º 6
0
        public WebServiceResponse UpdateUserInfo(string FirstName, string LastName, string PhoneNumber, string Email, string DOB, string Country, string IdType, string IdNo, string Address, string State, string City, string Code)
        {
            try
            {
                wsr = new WebServiceResponse();
                using (SqlCmd = new SqlCommand("UPDATE UserInfo SET FirstName='" + FirstName + "',LastName='" + LastName + "',PhoneNumber='" + PhoneNumber + "',Email='" + Email + "',DateOfBirth='" + DOB + "',Nationality='" + Country + "',IDType='" + IdType + "',IdNo='" + IdNo + "',Address='" + Address + "',State='" + State + "',City='" + City + "',Code='" + Code + "' WHERE PhoneNumber='" + PhoneNumber + "'", SqlCon))
                {
                    SqlCon.Open();
                    int res = SqlCmd.ExecuteNonQuery();

                    if (res == 1)
                    {
                        wsr.Status = "1";
                    }
                    SqlCon.Close();
                    return(wsr);
                }
            }
            catch (Exception ex)
            {
                wsr.Status = "0";
                wsr.Error  = ex.Message;
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }
                return(wsr);
            }
        }
Ejemplo n.º 7
0
        public WebServiceResponse UpdateTicketInfo(string TicketNo, string Status)
        {
            try
            {
                wsr = new WebServiceResponse();
                using (SqlCmd = new SqlCommand("UPDATE TicketInfo SET Status='" + Status + "' WHERE TicketNo='" + TicketNo + "' ", SqlCon))
                {
                    SqlCon.Open();
                    int res = SqlCmd.ExecuteNonQuery();
                    if (res == 1)
                    {
                        wsr.Status = "1";
                    }
                }
                SqlCon.Close();
                return(wsr);
            }
            catch (Exception ex)
            {
                wsr.Status = "0";
                wsr.Error  = ex.Message;
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }

                return(wsr);
            }
        }
Ejemplo n.º 8
0
        public WebServiceResponse InsertUserInfo(string FirstName, string LastName, string PhoneNumber, string Email, string Password, string DOB, string Country, string IdType, string IdNo, string Address, string State, string City, string Code)
        {
            try
            {
                wsr = new WebServiceResponse();
                using (SqlCmd = new SqlCommand("INSERT INTO UserInfo(FirstName,LastName,PhoneNumber,Email,Password,DateOfBirth,Nationality,IDType,IdNo,Address,State,City,Code) VAULES('" + FirstName + "','" + LastName + "','" + PhoneNumber + "','" + Email + "','" + Password + "','" + DOB + "','" + Country + "','" + IdType + "','" + IdNo + "','" + Address + "','" + State + "','" + City + "','" + Code + "')", SqlCon))
                {
                    SqlCon.Open();
                    int res = SqlCmd.ExecuteNonQuery();

                    if (res == 1)
                    {
                        wsr.Status = "1";
                    }
                    SqlCon.Close();
                    return(wsr);
                }
            }
            catch (Exception ex)
            {
                wsr.Status = "0";
                wsr.Error  = ex.Message;
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }
                return(wsr);
            }
        }
Ejemplo n.º 9
0
        public WebServiceResponse InsertStoreInfo(string Store, string Address, string Timing)
        {
            try
            {
                wsr = new WebServiceResponse();
                using (SqlCmd = new SqlCommand("insert into StoreInfo values('" + Store + "','" + Address + "','" + Timing + "')", SqlCon))
                {
                    SqlCon.Open();
                    int res = SqlCmd.ExecuteNonQuery();
                    if (res == 1)
                    {
                        wsr.Status = "1";
                    }
                }
                SqlCon.Close();
                return(wsr);
            }
            catch (Exception ex)
            {
                wsr.Status = "0";
                wsr.Error  = ex.Message;
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }

                return(wsr);
            }
        }
Ejemplo n.º 10
0
        public WebServiceResponse InsertTractionInfo()
        {
            try
            {
                wsr = new WebServiceResponse();
                //using (SqlCmd = new SqlCommand("insert into UserInfo values('" + FirstName + "','" + LastName + "','" + PhoneNumber + "','" + Email + "','" + Password + "','" + DOB + "','" + Country + "','" + IdType + "','" + IdNo + "','" + Address + "','" + State + "','" + City + "','" + Code + "')", SqlCon))
                //{
                //    SqlCon.Open();
                //    int res = SqlCmd.ExecuteNonQuery();

                //    if (res == 1)
                //    {
                //        wsr.Status = "1";

                //    }
                //

                //}
                SqlCon.Close();
                return(wsr);
            }
            catch (Exception ex)
            {
                wsr.Status = "0";
                wsr.Error  = ex.Message;
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                    wsr.Error = ex.Message;
                }
                return(wsr);
            }
        }
Ejemplo n.º 11
0
        public WebServiceResponse IsExistingUser(string UserId)
        {
            try
            {
                wsr = new WebServiceResponse();
                using (SqlCmd = new SqlCommand("Select UserId From UserLoginInfo where UserId='" + UserId + "'  ", SqlCon))
                {
                    SqlCon.Open();
                    var name = SqlCmd.ExecuteScalar();

                    if (name != null)
                    {
                        wsr.Status = "1";
                    }
                }
                SqlCon.Close();
                return(wsr);
            }
            catch (Exception ex)
            {
                wsr.Status = "0";
                wsr.Error  = ex.Message;
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }

                return(wsr);
            }
        }
Ejemplo n.º 12
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);
     }
 }
Ejemplo n.º 13
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);
     }
 }
Ejemplo n.º 14
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();
 }
Ejemplo n.º 15
0
        public WebServiceResponse SendForgetEmail(string EmailId, string url, DateTime dt)
        {
            try
            {
                wsr = new WebServiceResponse();
                string PasswordResetCode = Guid.NewGuid().ToString();
                using (MailMessage mm = new MailMessage("*****@*****.**", EmailId))
                {
                    string body;
                    string newurl = url.Replace("Rest.aspx", "Reset.aspx?ResetCode=" + PasswordResetCode);
                    mm.Subject = "Password Reset";
                    // string body = "Hello " + Name + ",";
                    body          = "<br /><br />Please click the following link to Reset your account Password";
                    body         += "<br /><a href = '" + newurl + "'>Click here to activate your account.</a>";
                    body         += "<br /><br />Thanks";
                    mm.Body       = body;
                    mm.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host      = "smtp.gmail.com";
                    smtp.EnableSsl = true;
                    NetworkCredential NetworkCred = new NetworkCredential("*****@*****.**", "(Sakilove2ani)");
                    smtp.UseDefaultCredentials = true;
                    smtp.Credentials           = NetworkCred;
                    smtp.Port = 587;
                    smtp.Send(mm);
                }

                using (SqlCmd = new SqlCommand("INSERT INTO ForgetPassword VALUES('" + PasswordResetCode + "','" + EmailId + "','" + dt + "')", SqlCon))
                {
                    SqlCon.Open();
                    int res = SqlCmd.ExecuteNonQuery();
                    if (res == 1)
                    {
                        wsr.Status = "1";
                    }
                    else
                    {
                        wsr.Status = "0";
                    }
                    SqlCon.Close();
                }

                return(wsr);
            }
            catch (Exception ex)
            {
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                    wsr.Error = ex.Message;
                }
                else
                {
                    wsr.Error = ex.Message;
                }
                return(wsr);
            }
        }
Ejemplo n.º 16
0
 public WebServiceResponse VerifyActivationEmail(string activationCode)
 {
     try
     {
         wsr = new WebServiceResponse();
         using (SqlCommand cmd = new SqlCommand("SELECT ActivationCode FROM UserLoginInfo WHERE ActivationCode = '" + activationCode + "' and Status='0' ", SqlCon))
         {
             SqlCon.Open();
             Sqldr = cmd.ExecuteReader();
             if (Sqldr.Read())
             {
                 Sqldr.Close();
                 using (SqlCmd = new SqlCommand("UPDATE UserLoginInfo SET Status='1' WHERE ActivationCode='" + activationCode + "'", SqlCon))
                 {
                     int rel = SqlCmd.ExecuteNonQuery();
                     if (rel == 1)
                     {
                         SqlCon.Close();
                         wsr.Status = "1";
                     }
                     else
                     {
                         SqlCon.Close();
                         wsr.Status = "0";
                     }
                 }
             }
             else
             {
                 Sqldr.Close();
                 wsr.Status = "0";
             }
             return(wsr);
         }
     }
     catch (Exception ex)
     {
         if (SqlCon.State == ConnectionState.Open)
         {
             SqlCon.Close();
             wsr.Error = ex.Message;
         }
         else
         {
             wsr.Error = ex.Message;
         }
         return(wsr);
     }
 }
Ejemplo n.º 17
0
    protected void BtnSignup_Click(object sender, EventArgs e)
    {
        try
        {
            wsr1 = lws.IsExistingUser(Email.Value.Trim());
            if (wsr1.Status == "0")
            {
                wsr2 = lws.InsertUserInfo(FirstName.Value.Trim(), LastName.Value.Trim(), PhoneNumber.Value, Email.Value.Trim(), Password.Value.Trim(), DOB.Value.Trim(), Country.SelectedItem.Value.Trim(), IDType.Items[IDType.SelectedIndex].Text.Trim(), IDNo.Value.Trim(), Address.Value.Trim(), State.Value.Trim(), City.Value.Trim(), Code.Value.Trim());
                if (wsr2.Status == "1")
                {
                    wsr = ms.SendActivationEmail(Email.Value.Trim(), FirstName.Value.Trim(), HttpContext.Current.Request.Url.AbsoluteUri, Password.Value.Trim());
                    if (wsr.Status == "1")
                    {
                        ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Registration  Success. Activation Link sent to your Registered Email ');", true);
                        Response.Redirect("Home.aspx", false);
                        Context.ApplicationInstance.CompleteRequest();
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + wsr.Error + "');", true);
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + wsr2.Error + "');", true);
                }
            }

            else
            {
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert(' Mail id is Already register with another account ');", true);
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + ex.Message.Replace("\'", " ") + "');", true);
        }
    }
Ejemplo n.º 18
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);
        }
    }