Ejemplo n.º 1
0
        protected void enterexpert_Click(object sender, EventArgs e)
        {
            path = Server.MapPath("~") + "Admin//uploads//";
            if (expimg.HasFile)
            {
                try
                {
                    expimg.SaveAs(path + expimg.FileName);

                    explab.Text = "file uploaded successfuly" + expimg.PostedFile.ContentLength + "mb" + "path" + path + expimg.FileName;
                    // insertion code
                    row                     = ex2.expert2.Newexpert2Row();
                    row.expertemail         = exemail.Text;
                    row.password            = expass.Text;
                    row.expertname          = expertname.Text;
                    row.expertqualification = qualification.Text;
                    row.expertcontact       = contactexp.Text;
                    row.fileupload          = "Admin//uploads//" + expimg.FileName.ToString();
                }
                catch (Exception ex)
                {
                    explab.Text = "file not uploaded" + ex.Message.ToString();
                }
            }
            else
            {
                explab.Text = "please select file and upload again";
            }
            ex2.expert2.Rows.Add(row);
            pe2.Update(row);
            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Expert Added');", true);
        }
        protected void send_Click(object sender, EventArgs e)
        {
            String id = Request.QueryString["k"];

            row2 = qu.expert2.FindById(Convert.ToInt32(id));
            row  = qu.Question.NewQuestionRow();
            String usname = Session["username"].ToString();

            row3               = qu.User.FindByUsername(usname);
            row.Expertemail    = row2.expertemail;
            row.UserName       = usname;
            row.Ques           = question.Text;
            row.DateofQuestion = DateTime.Now.Date;
            qu.Question.Rows.Add(row);
            ns.Update(row);
            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Question Sent To Expert');", true);
        }