Ejemplo n.º 1
0
 public bool Edit(Result_LotteryDTO RSL)
 {
     try
     {
         R_DAL.Edit(RSL);
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
        public SqlDataReader SearchNumberWin(Result_LotteryDTO RSL)
        {
            ConnectDB.con.Open();
            SqlCommand cmd = new SqlCommand("search_WINNER_NUMBER", ConnectDB.con);

            cmd.Parameters.Add("@NUMBER_WIN", SqlDbType.VarChar).Value   = RSL.NUMBER_WIN;
            cmd.Parameters.Add("@ID_TYPE", SqlDbType.VarChar).Value      = RSL.ID_TYPE;
            cmd.Parameters.Add("@DATE_RESULT", SqlDbType.DateTime).Value = RSL.DATE_RESULT;
            cmd.Parameters.Add("@LEN_NUMBER", SqlDbType.Int).Value       = RSL.LEN_NUMBER;
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader rd = cmd.ExecuteReader();

            return(rd);
        }
Ejemplo n.º 3
0
 public void Insert(Result_LotteryDTO RSL)
 {
     ConnectDB.con.Open();
     try
     {
         SqlCommand cmd = new SqlCommand("insert_RESULT_LOTTERY", ConnectDB.con);
         cmd.Parameters.Add("@ID_TYPE", SqlDbType.VarChar).Value     = RSL.ID_TYPE;
         cmd.Parameters.Add("@ID_PRIZE", SqlDbType.VarChar).Value    = RSL.ID_PRIZE;
         cmd.Parameters.Add("@DATE_RESULT", SqlDbType.VarChar).Value = RSL.DATE_RESULT;
         cmd.Parameters.Add("@NUMBER_WIN", SqlDbType.VarChar).Value  = RSL.NUMBER_WIN;
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.ExecuteNonQuery();
     }
     catch
     {
         throw;
     }
     finally
     {
         ConnectDB.con.Close();
     }
 }
        protected void btn_edit_Click(object sender, EventArgs e)
        {
            Result_LotteryDTO RSL = new Result_LotteryDTO();

            RSL.ID_RESULT = input_Id_result.Text;
            RSL.ID_TYPE   = input_Id_type.SelectedValue;
            RSL.ID_PRIZE  = input_Id_prize.SelectedValue;

            string[] d    = input_Date_result.Text.Split('/');
            string   date = d[1] + "-" + d[0] + "-" + d[2];

            RSL.DATE_RESULT = date;
            RSL.NUMBER_WIN  = input_Number_win.Text;


            if (RBL.Edit(RSL) == true)
            {
                MessageBox("Sửa thành công", "Result_Lottery.aspx");
            }
            else
            {
                MessageBox("Sửa không thành công", "Result_Lottery.aspx");
            }
        }
Ejemplo n.º 5
0
 protected void btn_import_data_Click(object sender, EventArgs e)
 {
     FileUpload1.SaveAs(Server.MapPath("~/file_log/" + FileUpload1.FileName));
     if (FileUpload1.HasFile)
     {
         string fileExtension = Path.GetExtension(FileUpload1.FileName);
         if (fileExtension.ToLower() == ".txt")
         {
             string fileDir = Server.MapPath("~/file_log/" + FileUpload1.FileName);
             using (StreamReader sr = new StreamReader(fileDir))
             {
                 Result_LotteryDTO RSL   = new Result_LotteryDTO();
                 string[]          line1 = sr.ReadLine().Split('\t');
                 RSL.ID_TYPE     = line1[0].Trim();
                 RSL.DATE_RESULT = line1[1].Trim();
                 while (sr.Peek() >= 0)
                 {
                     string[] result_line = sr.ReadLine().Split('\t');
                     RSL.ID_PRIZE   = result_line[0].Trim();
                     RSL.NUMBER_WIN = result_line[1].Trim();
                     RBL.Insert(RSL);
                 }
             }
             ConnectDB.con.Close();
             MessageBox("Đã import dữ liệu thành công", "Result_Lottery.aspx");
         }
         else
         {
             MessageBox("File phải là dạng txt", "Result_Lottery.aspx");
         }
     }
     else
     {
         MessageBox("Hãy chọn dữ liệu để upload", "Result_Lottery.aspx");
     }
 }
Ejemplo n.º 6
0
 public SqlDataReader SearchNumberWin(Result_LotteryDTO RSL)
 {
     return(R_DAL.SearchNumberWin(RSL));
 }
Ejemplo n.º 7
0
        /* Chức năng dò số */
        protected void btn_search_Click(object sender, EventArgs e)
        {
            if (input_winner_number_search.Text.Length < 6)
            {
                error_search.Text = "Lỗi: Vé số phải là 6 kí tự , Xin hãy nhập lại !!!";
            }
            else
            {
                error_search.Text = "";
                DataTable  dt = new DataTable();
                DataColumn dc = new DataColumn("CHANNEL", typeof(String));
                dt.Columns.Add(dc);
                dc = new DataColumn("DATE_RESULT", typeof(String));
                dt.Columns.Add(dc);
                dc = new DataColumn("NUMBER_WIN", typeof(String));
                dt.Columns.Add(dc);
                dc = new DataColumn("NAME_PRIZE", typeof(String));
                dt.Columns.Add(dc);
                dc = new DataColumn("REWARD", typeof(String));
                dt.Columns.Add(dc);

                Result_LotteryDTO RSL  = new Result_LotteryDTO();
                string[]          date = input_date_search.Text.Split('/');
                RSL.DATE_RESULT = date[1] + "/" + date[0] + "/" + date[2];
                RSL.ID_TYPE     = input_id_type_search.Text;

                for (int i = 2; i <= 6; i++)
                {
                    RSL.NUMBER_WIN = cutString(input_winner_number_search.Text, i);
                    RSL.LEN_NUMBER = RSL.NUMBER_WIN.Length;
                    SqlDataReader rd = RBL.SearchNumberWin(RSL);
                    if (rd.HasRows)
                    {
                        while (rd.Read())
                        {
                            DataRow dr = dt.NewRow();
                            dr[0] = rd[0];
                            dr[1] = rd[1];
                            dr[2] = rd[2];
                            dr[3] = rd[3];
                            dr[4] = rd[4];
                            dt.Rows.Add(dr);
                        }
                    }
                    ConnectDB.con.Close();
                }
                table = new StringBuilder();
                table.Append("<div class='row'><div class='col-sm-12' style='padding-top:1%;'>Mã vé số - <strong>" + input_winner_number_search.Text + "</strong> , ngày xổ - <strong>" + input_date_search.Text + "</strong></div></div>");
                if (dt.Rows.Count == 0)
                {
                    table.Append("<div class='row' style='color:#cc5151; padding-top:1%; font-size:20px; font-weight:bold;'><div class='col-sm-12'>Vé số này đã không trúng, chúc quý khách may mắn lần sau</div></div>");
                }
                else
                {
                    table.Append("<div class='row' style='color:#cc5151; padding-top:1%; font-size:20px; font-weight:bold;'><div class='col-sm-12'>Chúng mình quý khách đã trúng vé số với giải như sau: </div></div>");
                }
                table.Append("<div class='row' style='border-bottom:1px solid #808080; padding-top:1%;'>");
                table.Append("<div class='col-sm-12'>");
                table.Append("<table class='table table-hover'>");
                table.Append("<tr>");
                table.Append("<th>STT</th><th>Số trúng</th><th>Giải</th><th>Trị giá</th>");
                table.Append("</tr>");
                table.Append("</div>");
                table.Append("</div>");

                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    table.Append("<tr>");
                    table.Append("<td>" + (j + 1) + "</td>");
                    table.Append("<td>" + dt.Rows[j][2] + "</td>");
                    table.Append("<td>" + dt.Rows[j][3] + "</td>");
                    table.Append("<td>" + string.Format("{0:0,0}", int.Parse(dt.Rows[j][4].ToString())) + " VNĐ</td>");
                    table.Append("</tr>");
                }
                table.Append("</table>");
                content = new Literal {
                    Text = table.ToString()
                };
                table_result_number.Controls.Add(content);
            }
        }