Ejemplo n.º 1
0
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     nsskills.clsqst    obj    = new nsskills.clsqst();
     nsskills.clsqstprp objprp = new nsskills.clsqstprp();
     objprp.qstcod = Convert.ToInt32(GridView1.DataKeys[e.RowIndex][0]);
     obj.del_rec(objprp);
     GridView1.DataBind();
     e.Cancel = true;
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         if (Session["ucod"] == null)
         {
             Response.Redirect("index.aspx");
         }
         else if (Session["tcod"] == null)
         {
             Response.Redirect("frmstrtst.aspx");
         }
         else
         {
             Int32     a  = Convert.ToInt32(Session["tcod"]);
             Int32     b  = Convert.ToChar(Session["lvl"]);
             DataTable tb = new DataTable("tb1");
             tb.Columns.Add(new DataColumn("qstcod", Type.GetType("System.Int32")));
             tb.Columns.Add(new DataColumn("qstdsc", Type.GetType("System.String")));
             tb.Columns.Add(new DataColumn("crtopt", Type.GetType("System.String")));
             tb.Columns.Add(new DataColumn("yoropt", Type.GetType("System.String")));
             nsskills.clsqst           obj = new nsskills.clsqst();
             List <nsskills.clsqstprp> k   = obj.dspqstbyteclvl(Convert.ToInt32(Session["tcod"]), Convert.ToChar(Session["lvl"]));
             Random rnd = new Random();
             int    idx, j;
             for (int i = 1; i <= 3; i++)
             {
                 idx = rnd.Next(0, k.Count);
                 for (j = 0; j < tb.Rows.Count; j++)
                 {
                     if (Convert.ToInt32(tb.Rows[j][0]) == k[idx].qstcod)
                     {
                         break;
                     }
                 }
                 if (j < tb.Rows.Count)
                 {
                     i--;
                     continue;
                 }
                 DataRow r = tb.NewRow();
                 r[0] = k[idx].qstcod;
                 r[1] = k[idx].qstdsc;
                 tb.Rows.Add(r);
             }
             GridView1.DataSource = tb;
             GridView1.DataBind();
             Label1.Text   = "5";
             Session["tb"] = tb;
         }
     }
 }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         if (Request.QueryString["qcod"] == null)
         {
             Response.Redirect("frmqstbnk.aspx");
         }
         else
         {
             nsskills.clsqst           obj = new nsskills.clsqst();
             List <nsskills.clsqstprp> k   = obj.fnd_rec(Convert.ToInt32(Request
                                                                         .QueryString["qcod"]));
             Literal1.Text = k[0].qstdsc;
         }
     }
 }
Ejemplo n.º 4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     nsskills.clsqst    obj    = new nsskills.clsqst();
     nsskills.clsqstprp objprp = new nsskills.clsqstprp();
     objprp.qstteccod = Convert.ToInt32(DropDownList1.SelectedValue);
     objprp.qstlvl    = Convert.ToChar(DropDownList2.SelectedValue);
     objprp.qstdsc    = TextBox1.Text;
     objprp.qstdat    = DateTime.Now;
     if (Button1.Text == "Submit")
     {
         obj.save_rec(objprp);
     }
     else
     {
         objprp.qstcod = Convert.ToInt32(Request.QueryString["qcod"]);
         obj.upd_rec(objprp);
     }
     Response.Redirect("frmqstbnk.aspx");
 }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         if (Request.QueryString["qcod"] != null)
         {
             nsskills.clsqst           obj = new nsskills.clsqst();
             List <nsskills.clsqstprp> k   = obj.fnd_rec(Convert.ToInt32(Request
                                                                         .QueryString["qcod"]));
             TextBox1.Text = k[0].qstdsc;
             DropDownList1.DataBind();
             DropDownList1.SelectedIndex = -1;
             DropDownList1.Items.FindByValue(k[0].qstteccod.ToString())
             .Selected = true;
             DropDownList2.SelectedIndex = -1;
             DropDownList2.Items.FindByValue(k[0].qstlvl.ToString())
             .Selected    = true;
             Button1.Text = "Update";
         }
     }
 }