Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            companysBLL tc      = new companysBLL();
            custBLL     c       = new custBLL();
            string      keyword = textcompany.Text;
            bool        sucess  = pDAL.chkcompanybyname(keyword);

            if (sucess == true)

            {
                MessageBox.Show("company found");
                tc = pDAL.GetcompanysForTransaction(keyword);
                int id = tc.id;
                c.cid    = id;
                c.nquery = 0;
            }
            else
            {
                addcompanys ca = new addcompanys();
                ca.Show();
            }
            c.name   = txtu_Name.Text;
            c.mobile = textmobile.Text;
            c.type   = texttyp.Text;
            c.email  = textemail.Text;
            tc       = pDAL.Search(textcompany.Text);
            sucess   = tDAL.Insert(c);

            if (sucess == true)
            {
                MessageBox.Show("costumer  added sucessfully");
                clear();
            }
            else
            {
                MessageBox.Show("costumer can not be added");
            }
        }
        private void txtSearchProduct_TextChanged(object sender, EventArgs e)
        {
            //Get the keyword from productsearch textbox
            string keyword = txtSearchProduct.Text;

            //Check if we have value to txtSearchProduct or not
            if (keyword == "")
            {
                txtProductName.Text = "";
                txtInventory.Text   = "";
                txtRate.Text        = "";
                TxtQty.Text         = "";
                return;
            }

            //Search the product and display on respective textboxes
            companysBLL p = pDAL.GetcompanysForTransaction(keyword);

            //Set the values on textboxes based on p object
            txtProductName.Text = p.c_name;
            txtInventory.Text   = p.c_mobile.ToString();
            txtRate.Text        = p.c_email.ToString();
        }
Exemple #3
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
            }
        }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region dal and bll
            custBLL     c  = new custBLL();
            custDAL     cd = new custDAL();
            queryBLL    q  = new queryBLL();
            queryDAL    qd = new queryDAL();
            companysBLL b  = new companysBLL();
            companysDAL dc = new companysDAL();
            #endregion
            #region query variables
            string ques;
            string ans;
            int    cid;
            string cname;
            #endregion
            #region user details
            //int id;
            string type = "user";
            string email;
            string name = "";
            string mobile;
            //int nquery;
            #endregion

            int i = dataGridView1.Rows.Count;
            i--;
            for (int j = 1; j < i; j++)

            {
                cname = dataGridView1.Rows[j].Cells[4].Value.ToString();
                bool sucess = cd.chkcustumer(cname);

                if (sucess == false)

                {
                    #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 adding the user
                    bool isuser = cd.chkcustumer(name);
                    if (isuser == false)
                    {
                        c.name   = name;
                        c.mobile = mobile;
                        c.email  = email;
                        c.type   = type;
                        b        = dc.GetcompanysForTransaction(cname);
                        cid      = b.id;
                        c.cid    = cid;
                        c.nquery = 0;
                        bool useradded = cd.Insert(c);
                        bool qinc      = cd.Increasenoofquery(c);
                        if (useradded == false)
                        {
                            MessageBox.Show("user adding failed");
                        }
                    }

                    #endregion
                }
            }
        }