Exemplo n.º 1
0
        private async void button2_Click(object sender, EventArgs e)
        {
            button4_Click(this, new EventArgs());
            await System.Threading.Tasks.Task.Delay(2000);

            OpenFileDialog file = new OpenFileDialog(); //open dialog to choose file
            //if there is a file choosen by the user
            {
                c = dc.Search(companydeact);
                emailsBLL email = new emailsBLL();
                // txtemail.Text = c.c_email;
                email.to      = txtemail.Text;
                email.subject = "solidworks deactivation form ";
                string body = "<span style='color:#1F497D'>Dear Sir,</span> \n<span style='color:#1F497D'>As per our discussion, please find the attached deactivation form.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'>Please sign and stamp and revert it asap.<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'>It will take 24-48 hours to process the request.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p>&nbsp;</o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='color:#1F497D'>In case of any query, feel free to contact us.</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='color:#1F497D'>&nbsp;</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='color:#1F497D'>Technical Support Team</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'>IRIS HIGHTECH PRIVATE LIMITED</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'>Contact: mailto [email protected]" + "<span style='color:#6666FF'>[email protected]</span></a><span style='color:#1F497D'> || 011-48175001, 011- 47005616</span><o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p></div> " + "\n\n\n\n\n";
                email.body       = body;
                email.name       = companydeact;
                email.attachment = createandsendpath;
                bool sucess = em.senddeactivationform(email);
                if (sucess == true)
                {
                    MessageBox.Show("email sent sucessfully");
                }
                else
                {
                    MessageBox.Show("email not sent");
                }
            }
        }
        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            //Get the keyword fro the text box
            string keyword = txtcSearch.Text;

            if (keyword == "")
            {
                //Clear all the textboxes
                txtcname.Text     = "";
                txtcemail.Text    = "";
                txtcmobile.Text   = "";
                txtclocation.Text = "";
                txtcsubend.Text   = "";
                return;
            }

            //Write the code to get the details and set the value on text boxes
            companysBLL dc = pDAL.Search(keyword);

            //Now transfer or set the value from DeCustBLL to textboxes
            txtcname.Text     = dc.c_name;
            txtcemail.Text    = dc.c_email;
            txtcmobile.Text   = dc.c_mobile;
            txtclocation.Text = dc.c_location;
            txtccatogary.Text = dc.c_category;
            txtcsubend.Text   = dc.subend_date;
        }
Exemplo n.º 3
0
        private void button5_Click(object sender, EventArgs e)
        {
            OpenFileDialog file  = new OpenFileDialog(); //open dialog to choose file
            string         templ = file.FileName;

            c = dc.Search(companydeact);
            emailsBLL email = new emailsBLL();

            //txtemail.Text = c.c_email;
            email.to      = txtemail.Text;
            email.subject = "solidworks deactivation form ";
            string body = "<span style='color:#1F497D'>Dear Sir,</span> \n<span style='color:#1F497D'>As per our discussion, please find the attached deactivation form.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'>Please sign and stamp and revert it asap.<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'>It will take 24-48 hours to process the request.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><o:p>&nbsp;</o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='color:#1F497D'>In case of any query, feel free to contact us.</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='color:#1F497D'>&nbsp;</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='color:#1F497D'>Technical Support Team</span></b><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'>IRIS HIGHTECH PRIVATE LIMITED</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#1F497D'>Contact: </span><a href=\"mailto:swsupport @irishightech.com\" target=\"_blank\"><span style='color:#6666FF'>[email protected]</span></a><span style='color:#1F497D'> || 011-48175001, 011- 47005616</span><o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p></div> " + "\n\n\n\n\n";

            email.body       = body;
            email.name       = companydeact;
            email.attachment = templ;
            bool sucess = em.senddeactivationform(email);

            if (sucess == true)
            {
                MessageBox.Show("email sent sucessfully");
            }
            else
            {
                MessageBox.Show("email not sent");
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            companysBLL dc = new companysBLL();

            dc.id = Convert.ToInt32(cidtxt.Text);

            dc.c_name        = txtcname.Text;
            dc.c_email       = txtcemail.Text;
            dc.c_mobile      = txtcmobile.Text;
            dc.c_location    = txtclocation.Text;
            dc.c_category    = txtccatogary.Text;
            dc.subend_date   = txtcsubend.Text;
            dc.substart_date = "vaibhav";


            bool success = pDAL.Delete(dc);

            if (success == true)
            {
                MessageBox.Show("company deleted sucessfully");
                clear();
                DataTable dt = new DataTable();
                dt = pDAL.Select();
                dvgcinfo.DataSource = dt;
            }
            else
            {
                MessageBox.Show("company can not be deleted");
            }
        }
Exemplo n.º 5
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;
        }
        public bool Update(companysBLL p)
        {
            //create a boolean variable and set its initial value to false
            bool isSuccess = false;

            //Create SQL Connection for DAtabase
            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                //SQL Query to Update Data in dAtabase
                String sql = "UPDATE tbl_companys SET c_name=@c_name, c_category=@c_category, c_location=@c_location, c_mobile=@c_mobile, substart_date=@substart_date, subend_date=@subend_date WHERE id=@id";

                //Create SQL Cmmand to pass the value to query
                SqlCommand cmd = new SqlCommand(sql, conn);
                //Passing the values using parameters and cmd
                cmd.Parameters.AddWithValue("@c_name", p.c_name);
                cmd.Parameters.AddWithValue("@c_category", p.c_category);
                cmd.Parameters.AddWithValue("@c_location", p.c_location);
                cmd.Parameters.AddWithValue("@c_mobile", p.c_mobile);
                cmd.Parameters.AddWithValue("@c_email", p.c_email);
                cmd.Parameters.AddWithValue("@substart_date", p.substart_date);
                cmd.Parameters.AddWithValue("@subend_date", p.subend_date);
                cmd.Parameters.AddWithValue("@id", p.id);

                //Open the Database connection
                conn.Open();

                //Create Int Variable to check if the query is executed successfully or not
                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the value of rows will be greater than 0 else it will be less than zero
                if (rows > 0)
                {
                    //Query ExecutedSuccessfully
                    isSuccess = true;
                }
                else
                {
                    //Failed to Execute Query
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(isSuccess);
        }
        public bool Insert(companysBLL p)
        {
            //Creating Boolean Variable and set its default value to false
            bool isSuccess = false;

            //Sql Connection for DAtabase
            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                //SQL Query to insert company into database
                String sql = "INSERT INTO tbl_companys (c_name, c_category, c_location, c_mobile, c_email, substart_date, subend_date) VALUES (@c_name, @c_category, @c_location, @c_mobile, @c_email, @substart_date, @subend_date)";

                //Creating SQL Command to pass the values
                SqlCommand cmd = new SqlCommand(sql, conn);

                //Passign the values through parameters
                cmd.Parameters.AddWithValue("@c_name", p.c_name);
                cmd.Parameters.AddWithValue("@c_category", p.c_category);
                cmd.Parameters.AddWithValue("@c_location", p.c_location);
                cmd.Parameters.AddWithValue("@c_mobile", p.c_mobile);
                cmd.Parameters.AddWithValue("@c_email", p.c_email);
                cmd.Parameters.AddWithValue("@substart_date", p.substart_date);
                cmd.Parameters.AddWithValue("@subend_date", p.subend_date);

                //Opening the Database connection
                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //If the query is executed successfully then the value of rows will be greater than 0 else it will be less than 0
                if (rows > 0)
                {
                    //Query Executed Successfully
                    isSuccess = true;
                }
                else
                {
                    //FAiled to Execute Query
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(isSuccess);
        }
Exemplo n.º 8
0
        private void import_Click(object sender, EventArgs e)
        {
            queryBLL    q  = new queryBLL();
            companysBLL b  = new companysBLL();
            companysDAL dc = new companysDAL();
            int         i  = dataGridView1.Rows.Count;

            i--;
            string add = "";
            string name;
            string mobile;
            string sub;
            string email;
            string subend = "12/12/2009";
            string cat    = "na";

            for (int j = 1; j < i; j++)

            {
                name = dataGridView1.Rows[j].Cells[11].Value.ToString();
                bool sucess = dc.chkcompanybyname(name);
                if (sucess == false)

                {
                    add = dataGridView1.Rows[j].Cells[6].Value.ToString();
                    add = add + dataGridView1.Rows[j].Cells[7].Value.ToString();
                    add = add + dataGridView1.Rows[j].Cells[3].Value.ToString();
                    add = add + dataGridView1.Rows[j].Cells[8].Value.ToString();

                    b.c_location    = add;
                    name            = dataGridView1.Rows[j].Cells[11].Value.ToString();
                    mobile          = dataGridView1.Rows[j].Cells[1].Value.ToString();
                    sub             = dataGridView1.Rows[j].Cells[2].Value.ToString();
                    email           = dataGridView1.Rows[j].Cells[0].Value.ToString();
                    sub             = dataGridView1.Rows[j].Cells[2].Value.ToString();
                    b.c_name        = name;
                    b.c_mobile      = mobile;
                    b.c_email       = email;
                    b.subend_date   = sub;
                    b.substart_date = subend;
                    b.c_category    = cat;

                    bool suck = dc.Insert(b);
                    add = " ";
                    if (suck != true)
                    {
                        MessageBox.Show("nhi add hui");
                    }
                }
            }
        }
        public bool Delete(companysBLL p)
        {
            //Create Boolean Variable and Set its default value to false
            bool isSuccess = false;

            //SQL Connection for DB connection
            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                //Write Query company from DAtabase
                String sql = "DELETE FROM tbl_companys WHERE id=@id";

                //Sql Command to Pass the Value
                SqlCommand cmd = new SqlCommand(sql, conn);

                //Passing the values using cmd
                cmd.Parameters.AddWithValue("@id", p.id);

                //Open Database Connection
                conn.Open();

                int rows = cmd.ExecuteNonQuery();
                //If the query is executed successfullly then the value of rows will be greated than 0 else it will be less than 0
                if (rows > 0)
                {
                    //Query Executed Successfully
                    isSuccess = true;
                }
                else
                {
                    //Failed to Execute Query
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(isSuccess);
        }
        public companysBLL Searchfromid(int keywords)

        {
            //SQL Connection fro DB Connection
            SqlConnection conn = new SqlConnection(myconnstrng);
            //Creating DAtaTable to hold value from dAtabase
            companysBLL p  = new companysBLL();
            DataTable   dt = new DataTable();

            try
            {
                //SQL query to search company
                string sql = "SELECT * FROM tbl_companys WHERE id LIKE '%" + keywords + "%' ";
                //Sql Command to execute Query
                SqlCommand cmd = new SqlCommand(sql, conn);

                //SQL Data Adapter to hold the data from database temporarily
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);

                //Open Database Connection
                conn.Open();
                adapter.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    p.c_name     = dt.Rows[0]["c_name"].ToString();
                    p.c_mobile   = dt.Rows[0]["c_mobile"].ToString();
                    p.id         = int.Parse(dt.Rows[0]["id"].ToString());
                    p.c_email    = dt.Rows[0]["c_email"].ToString();
                    p.c_category = dt.Rows[0]["c_category"].ToString();
                    p.c_location = (dt.Rows[0]["c_location"].ToString());
                    p.id         = int.Parse(dt.Rows[0]["id"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(p);
        }
Exemplo n.º 11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            locationsBLL l  = new locationsBLL();
            locationDAL  ld = new locationDAL();



            c = dc.Search(companydeact);
            emailsBLL email = new emailsBLL();

            txtemail.Text   = c.c_email;
            txtcompany.Text = c.c_name;
            l = ld.search("template");
            lbltemplate.Text = l.location;
            filePath         = lbltemplate.Text;
            l             = ld.search("save deactivation");
            lblsave.Text  = l.location;
            filepathemail = lblsave.Text;
            savepath      = lblsave.Text;
        }
        public bool chkcompanybyname(string keyword)
        {
            bool sucess = false;
            //Create an object of companysBLL and return it
            companysBLL p = new companysBLL();
            //SqlConnection
            SqlConnection conn = new SqlConnection(myconnstrng);
            //Datatable to store data temporarily
            DataTable dt = new DataTable();

            try
            {
                //Write the Query to Get the detaisl
                string sql = "SELECT c_name, c_mobile, c_email FROM tbl_companys WHERE c_name LIKE '%" + keyword + "%' OR c_mobile LIKE '%" + keyword + "%'";
                //Create Sql Data Adapter to Execute the query
                SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

                //Open DAtabase Connection
                conn.Open();

                //Pass the value from adapter to dt
                adapter.Fill(dt);

                //If we have any values on dt then set the values to companysBLL
                if (dt.Rows.Count > 0)
                {
                    sucess = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //Close Database Connection
                conn.Close();
            }

            return(sucess);
        }
        public companysBLL GetcompanysForTransaction(string keyword)
        {
            //Create an object of companysBLL and return it
            companysBLL p = new companysBLL();
            //SqlConnection
            SqlConnection conn = new SqlConnection(myconnstrng);
            //Datatable to store data temporarily
            DataTable dt = new DataTable();

            try
            {
                //Write the Query to Get the detaisl
                string sql = "SELECT id FROM tbl_companys WHERE c_name LIKE '%" + keyword + "%' OR c_mobile LIKE '%" + keyword + "%'";
                //Create Sql Data Adapter to Execute the query
                SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

                //Open DAtabase Connection
                conn.Open();

                //Pass the value from adapter to dt
                adapter.Fill(dt);

                //If we have any values on dt then set the values to companysBLL
                if (dt.Rows.Count > 0)
                {
                    p.id = int.Parse(dt.Rows[0]["id"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //Close Database Connection
                conn.Close();
            }

            return(p);
        }
Exemplo n.º 14
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");
            }
        }
Exemplo n.º 15
0
        public DataTable Select(string user, string company)
        {
            //Create Sql Connection to connect Databaes
            SqlConnection conn = new SqlConnection(myconnstrng);
            companysBLL   qb   = new companysBLL();
            companysDAL   qd   = new companysDAL();

            qb = qd.Search(company);
            //DAtaTable to hold the data from database
            DataTable dt = new DataTable();

            try
            {
                //Writing the Query to Select all the companys from database
                String sql = "SELECT q_id,u_name,u_mobile,ques,soln FROM tbl_query WHERE c_id =" + qb.id + "AND  u_name LIKE '%" + user + "%'";

                //Creating SQL Command to Execute Query
                SqlCommand cmd = new SqlCommand(sql, conn);

                //SQL Data Adapter to hold the value from database temporarily
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);

                //Open DAtabase Connection
                conn.Open();

                adapter.Fill(dt);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(dt);
        }
        public companysBLL GetcompanyIDFromc_name(int c_id)
        {
            //First Create an Object of DeaCust BLL and REturn it
            companysBLL p = new companysBLL();

            //SQL Conection here
            SqlConnection conn = new SqlConnection(myconnstrng);
            //Data TAble to Holdthe data temporarily
            DataTable dt = new DataTable();

            try
            {
                //SQL Query to Get id based on c_name
                string sql = "SELECT id FROM tbl_companys WHERE id='" + c_id + "'";
                //Create the SQL Data Adapter to Execute the Query
                SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

                conn.Open();

                //Passing the CAlue from Adapter to DAtatable
                adapter.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    //Pass the value from dt to DeaCustBLL dc
                    p.id = int.Parse(dt.Rows[0]["id"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(p);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            companysBLL dc = new companysBLL();

            dc.id = Convert.ToInt32(cidtxt.Text);


            pDAL.Update(dc);
            bool success = pDAL.Update(dc);

            if (success == true)
            {
                MessageBox.Show("company updated sucessfully");
                clear();
                DataTable dt = new DataTable();
                dt = pDAL.Select();
                dvgcinfo.DataSource = dt;
            }
            else
            {
                MessageBox.Show("company can not be updated");
            }
        }
        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();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            //Get the Values from PurchaseSales Form First
            transactionsBLL transaction = new transactionsBLL();

            transaction.type = lblTop.Text;

            //Get the ID of Dealer or Customer Here
            //Lets get name of the dealer or customer first
            string     deaCustName = txtName.Text;
            DeaCustBLL dc          = dcDAL.GetDeaCustIDFromName(deaCustName);

            transaction.dea_cust_id      = dc.id;
            transaction.grandTotal       = Math.Round(decimal.Parse(txtGrandTotal.Text), 2);
            transaction.transaction_date = DateTime.Now;
            transaction.tax      = decimal.Parse(txtVat.Text);
            transaction.discount = decimal.Parse(txtDiscount.Text);

            //Get the Username of Logged in user
            string  username = frmLogin.loggedIn;
            userBLL u        = uDAL.GetIDFromUsername(username);

            transaction.added_by           = u.id;
            transaction.transactionDetails = transactionDT;

            //Lets Create a Boolean Variable and set its value to false
            bool success = false;

            //Actual Code to Insert Transaction And Transaction Details
            using (TransactionScope scope = new TransactionScope())
            {
                int transactionID = -1;
                //Create aboolean value and insert transaction
                bool w = tDAL.Insert_Transaction(transaction, out transactionID);

                //Use for loop to insert Transaction Details
                for (int i = 0; i < transactionDT.Rows.Count; i++)
                {
                    //Get all the details of the product
                    transactionDetailBLL transactionDetail = new transactionDetailBLL();
                    //Get the Product name and convert it to id
                    string      ProductName = transactionDT.Rows[i][0].ToString();
                    companysBLL p           = pDAL.GetcompanyIDFromc_name(1);

                    transactionDetail.product_id  = p.id;
                    transactionDetail.rate        = decimal.Parse(transactionDT.Rows[i][1].ToString());
                    transactionDetail.qty         = decimal.Parse(transactionDT.Rows[i][2].ToString());
                    transactionDetail.total       = Math.Round(decimal.Parse(transactionDT.Rows[i][3].ToString()), 2);
                    transactionDetail.dea_cust_id = dc.id;
                    transactionDetail.added_date  = DateTime.Now;
                    transactionDetail.added_by    = u.id;

                    //Here Increase or Decrease Product Quantity based on Purchase or sales
                    string transactionType = lblTop.Text;

                    //Lets check whether we are on Purchase or Sales
                    bool x = false;
                    if (transactionType == "Purchase")
                    {
                        //Increase the Product
                        x = pDAL.Increasecompany(transactionDetail.product_id, transactionDetail.qty);
                    }
                    else if (transactionType == "Sales")
                    {
                        //Decrease the Product Quntiyt
                        x = pDAL.Decreasecompany(transactionDetail.product_id, transactionDetail.qty);
                    }

                    //Insert Transaction Details inside the database
                    bool y = tdDAL.InsertTransactionDetail(transactionDetail);
                    success = w && x && y;
                }

                if (success == true)
                {
                    //Transaction Complete
                    scope.Complete();

                    //Code to Print Bill
                    DGVPrinter printer = new DGVPrinter();

                    printer.Title               = "\r\n\r\n\r\n ANYSTORE PVT. LTD. \r\n\r\n";
                    printer.SubTitle            = "Kathmandu, Nepal \r\n Phone: 01-045XXXX \r\n\r\n";
                    printer.SubTitleFormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoClip;
                    printer.PageNumbers         = true;
                    printer.PageNumberInHeader  = false;
                    printer.PorportionalColumns = true;
                    printer.HeaderCellAlignment = StringAlignment.Near;
                    printer.Footer              = "Discount: " + txtDiscount.Text + "% \r\n" + "VAT: " + txtVat.Text + "% \r\n" + "Grand Total: " + txtGrandTotal.Text + "\r\n\r\n" + "Thank you for doing business with us.";
                    printer.FooterSpacing       = 15;
                    printer.PrintDataGridView(dgvAddedProducts);

                    MessageBox.Show("Transaction Completed Sucessfully");
                    //Celar the Data Grid View and Clear all the TExtboxes
                    dgvAddedProducts.DataSource = null;
                    dgvAddedProducts.Rows.Clear();

                    txtSearch.Text        = "";
                    txtName.Text          = "";
                    txtEmail.Text         = "";
                    txtContact.Text       = "";
                    txtAddress.Text       = "";
                    txtSearchProduct.Text = "";
                    txtProductName.Text   = "";
                    txtInventory.Text     = "0";
                    txtRate.Text          = "0";
                    TxtQty.Text           = "0";
                    txtSubTotal.Text      = "0";
                    txtDiscount.Text      = "0";
                    txtVat.Text           = "0";
                    txtGrandTotal.Text    = "0";
                    txtPaidAmount.Text    = "0";
                    txtReturnAmount.Text  = "0";
                }
                else
                {
                    //Transaction Failed
                    MessageBox.Show("Transaction Failed");
                }
            }
        }
Exemplo n.º 20
0
        private void button3_Click(object sender, EventArgs e)
        {
            string   keyword = txtu_Name.Text;
            queryBLL q       = new queryBLL();

            bool    qsucess = tDAL.chkcustumer(keyword);
            custBLL dc      = tDAL.searchcustumer(keyword);

            if (qsucess == true)
            {
                keyword = txtcompany.Text;
                companysBLL c = pDAL.Search(keyword);
                q.ques     = textqry.Text;
                q.soln     = textsoln.Text;
                q.cu_id    = dc.id;
                q.c_id     = dc.cid;
                q.u_name   = dc.name;
                emailname  = q.u_name;
                q.u_mobile = dc.mobile;
                dc.nquery  = dc.nquery++;
                bool incquery = tDAL.Increasenoofquery(dc); if (incquery == true)
                {
                    MessageBox.Show("user and query updated");
                }
                else
                {
                    MessageBox.Show("user and query not updated");
                }
                q.status = 1;
                bool success = dcDAL.Insert(q);
                q    = dcDAL.Getqueryforsearch(q);
                qid  = q.q_id;
                qid1 = q.q_id;
            }

            if (qsucess == false)
            {
                keyword = txtcompany.Text;
                bool csucess = pDAL.chkcompanybyname(keyword);
                if (csucess == true)
                {
                    keyword = txtcompany.Text;
                    companysBLL c = pDAL.Search(keyword);

                    custBLL ca = new custBLL();
                    ca.name   = txtu_Name.Text;
                    emailname = q.u_name;
                    ca.mobile = txtu_Contact.Text;
                    string type = "user";
                    ca.type  = type;
                    ca.email = txtemail.Text;
                    bool isadded = false;
                    int  id      = c.id;
                    ca.cid    = id;
                    ca.nquery = 0;
                    isadded   = tDAL.Insert(ca);
                    if (isadded == true)
                    {
                        MessageBox.Show("new user added");
                    }
                    else
                    {
                        MessageBox.Show("new user can not be added");
                    }
                }

                else
                {
                    MessageBox.Show("plz add new company");
                    addcompanys ca = new addcompanys();
                    ca.Show();
                }

                //space to add new user(custumer)
                //addnewcostumer costumer = new addnewcostumer();
                //costumer.Show();
                //this.Hide();
                //MessageBox.Show("plz add new costumer");
                //Failed to Add New product
                //MessageBox.Show("new user added");
            }


            //if the product is added successfully then the value of success will be true else it will be false
            if (qsucess == true)
            {
                //Product Inserted Successfully
                MessageBox.Show("query Added Successfully");


                emailsBLL email = new emailsBLL();
                email.to      = txtemail.Text;
                email.subject = "solidworks support query " + qid;
                string body = "<h3>" + "query- \n " + "</h3>" + "<b>" + textqry.Text + "</b>" + "<h3>" + " \n\n solution- \n" + "</h3>" + "<b>" + textsoln.Text + "</b>" + "\n\n\n\n\n";
                email.body = body;
                email.name = txtu_Name.Text;
                bool sucess = eDAL.sendemail(email);
                if (sucess == true)
                {
                    MessageBox.Show("email sent sucessfully");
                }
                else
                {
                    MessageBox.Show("email not sent");
                }
                //Calling the Clear Method
            }
        }
Exemplo n.º 21
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
            }
        }
Exemplo n.º 22
0
        private void button4_Click(object sender, EventArgs e)
        {
            string   keyword = txtu_Name.Text;
            queryBLL q       = new queryBLL();

            bool    qsucess = tDAL.chkcustumer(keyword);//chking costumer
            custBLL dc      = tDAL.searchcustumer(keyword);

            if (qsucess == true)// if costumer is found
            {
                keyword = txtcompany.Text;
                companysBLL c = pDAL.Search(keyword);
                q.ques     = textqry.Text;
                q.soln     = textsoln.Text;
                q.cu_id    = dc.id;
                q.c_id     = dc.cid;
                q.u_name   = dc.name;
                emailname  = q.u_name;
                q.u_mobile = dc.mobile;
                dc.nquery  = dc.nquery++;
                q.status   = 0;
                q.datetime = DateTime.Now;
                bool success  = dcDAL.Insert(q);
                bool incquery = tDAL.Increasenoofquery(dc); if (incquery == true)
                {
                    MessageBox.Show("user and query updated");
                }
                else
                {
                    MessageBox.Show("user and query not updated");
                }
                emailname = q.u_name;
                q         = dcDAL.Getqueryforsearch(q);
                qid       = q.q_id;
                if (success == true)
                {
                    //Product Inserted Successfully
                    MessageBox.Show("query Added Successfully");
                    emailsBLL email = new emailsBLL();
                    email.to      = txtemail.Text;
                    email.subject = "solidworks support query " + qid;
                    string body = "<h3>" + "SR NO." + DateTime.Today + "  " + qid + "query- \n " + "</h3>" + "<b>" + textqry.Text + "</b>" + "<h3>" + " \n\n solution- \n" + "</h3>" + "<b>" + textsoln.Text + "</b>" + "\n\n\n\n\n";
                    email.body = body;
                    email.name = txtu_Name.Text;
                    bool sucess = eDAL.sendemail(email);
                    if (sucess == true)
                    {
                        MessageBox.Show("email sent sucessfully");
                    }
                    else
                    {
                        MessageBox.Show("email not sent");
                    }
                    //Calling the Clear Method
                }
            }

            if (qsucess == false)
            {
                keyword = txtcompany.Text;
                bool csucess = pDAL.chkcompanybyname(keyword);
                if (csucess == true)
                {
                    keyword = txtcompany.Text;
                    companysBLL c = pDAL.Search(keyword);

                    custBLL ca = new custBLL();
                    ca.name   = txtu_Name.Text;
                    ca.mobile = txtu_Contact.Text;
                    string type = "user";
                    ca.type  = type;
                    ca.email = txtemail.Text;
                    bool isadded = false;
                    int  id      = c.id;
                    ca.cid    = id;
                    ca.nquery = 0;

                    isadded = tDAL.Insert(ca);
                    if (isadded == true)
                    {
                        MessageBox.Show("new user added");
                    }
                    else
                    {
                        MessageBox.Show("new user can not be added");
                    }
                }

                else
                {
                    MessageBox.Show("plz add new company");
                    addcompanys ca = new addcompanys();
                    ca.Show();
                }
            }
        }
Exemplo n.º 23
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
                }
            }
        }