Ejemplo n.º 1
0
        private void txtu_Name_TextChanged(object sender, EventArgs e)
        {
            //Get the keyword fro the text box
            string keyword = txtu_Name.Text;


            if (keyword == "")
            {
                //Clear all the textboxes
                txtu_Name.Text    = "";
                txtu_Contact.Text = "";
                txtcompany.Text   = "";
                textqry.Text      = "";
                return;
            }
            custBLL dc = tDAL.searchcustumer(keyword);

            //Write the code to get the details and set the value on text boxes

            //queryBLL q = new queryBLL();


            //Now transfer or set the value from DeCustBLL to textboxes
            // dc.name= txtu_Name.Text;
            txtu_Contact.Text = dc.mobile;
            int         Cid = dc.cid;
            companysBLL c   = pDAL.Searchfromid(Cid);

            txtcompany.Text = c.c_name;
            txtemail.Text   = dc.email;
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            custBLL     c  = new custBLL();
            custDAL     cd = new custDAL();
            queryBLL    q  = new queryBLL();
            queryDAL    qd = new queryDAL();
            companysBLL b  = new companysBLL();
            companysDAL dc = new companysDAL();


            #region user details
            //int id;

            string email;
            string name = "";
            string mobile;
            //int nquery;
            #endregion
            #region query details
            string ques;
            string ans;
            int    status = 1;
            int    cid;
            string cname;
            int    i = dataGridView1.Rows.Count;
            i--;
            #endregion

            for (int j = 1; j < i; j++)
            {
                #region get data from table
                name   = dataGridView1.Rows[j].Cells[4].Value.ToString();
                mobile = dataGridView1.Rows[j].Cells[5].Value.ToString();
                ans    = dataGridView1.Rows[j].Cells[3].Value.ToString();
                email  = dataGridView1.Rows[j].Cells[6].Value.ToString();
                cname  = dataGridView1.Rows[j].Cells[1].Value.ToString();
                ques   = dataGridView1.Rows[j].Cells[2].Value.ToString();
                #endregion
                #region fill the query
                q.u_name   = name;
                q.u_mobile = mobile;
                q.ques     = ques;
                q.soln     = ans;
                q.status   = status;
                b          = dc.GetcompanysForTransaction(cname);
                cid        = b.id;
                q.c_id     = cid;
                bool isuser1 = cd.chkcustumer(name);
                if (isuser1 == true)
                {
                    c = cd.searchcustumer(name);
                }
                else
                {
                    MessageBox.Show("user not found");
                }
                q.cu_id  = c.id;
                q.status = status;
                bool qadded = qd.Insert(q);
                if (qadded == false)
                {
                    MessageBox.Show("query not added");
                }
                #endregion
            }
        }