private void frmReportViewer_Load(object sender, EventArgs e)
        {
            try
            {
                string que = "SELECT * FROM Customer_Order where Customer_Id = " + customer_id;
                Order ord = new OrderManager().GetAllData(que);

                string que1 = "SELECT * FROM Customer_Details where customer_Id = " + customer_id;
                Customer cus = new CustomerManager().GetAllCustData(que1);

                DataSet ds = new DataSet();
                ds.Tables.Add("Customer_Details");
                ds.Tables["Customer_Details"].Columns.Add("customer_id");
                ds.Tables["Customer_Details"].Columns.Add("first_name");
                ds.Tables["Customer_Details"].Columns.Add("last_name");
                ds.Tables["Customer_Details"].Columns.Add("address");
                ds.Tables["Customer_Details"].Columns.Add("name_of_com");
                ds.Tables["Customer_Details"].Columns.Add("contact_no");
                ds.Tables["Customer_Details"].Columns.Add("mobile");
                ds.Tables["Customer_Details"].Columns.Add("email_id");

                ds.Tables["Customer_Details"].Rows.Add();
                ds.Tables["Customer_Details"].Rows[0]["customer_id"] = customer_id;
                ds.Tables["Customer_Details"].Rows[0]["first_name"] = cus.Name.ToString();
                ds.Tables["Customer_Details"].Rows[0]["last_name"] = cus.Surname.ToString();
                ds.Tables["Customer_Details"].Rows[0]["address"] = "---";
                ds.Tables["Customer_Details"].Rows[0]["name_of_com"] = cus.NameOfCom.ToString();
                ds.Tables["Customer_Details"].Rows[0]["contact_no"] = "---";
                ds.Tables["Customer_Details"].Rows[0]["mobile"] = cus.Mobile.ToString();
                ds.Tables["Customer_Details"].Rows[0]["email_id"] = "--";

                ds.Tables.Add("Customer_Order");
                ds.Tables["Customer_Order"].Columns.Add("User_id");
                ds.Tables["Customer_Order"].Columns.Add("order_no");
                ds.Tables["Customer_Order"].Columns.Add("date");
                ds.Tables["Customer_Order"].Columns.Add("type_of_work");
                ds.Tables["Customer_Order"].Columns.Add("no_of_copies");
                ds.Tables["Customer_Order"].Columns.Add("rate");
                ds.Tables["Customer_Order"].Columns.Add("total");
                ds.Tables["Customer_Order"].Columns.Add("Customer_Id");

                ds.Tables["Customer_Order"].Rows.Add();
                ds.Tables["Customer_Order"].Rows[0]["User_id"] = ord.ID;
                ds.Tables["Customer_Order"].Rows[0]["order_no"] = ord.OrderNo;
                ds.Tables["Customer_Order"].Rows[0]["date"] = ord.Date;
                ds.Tables["Customer_Order"].Rows[0]["type_of_work"] = ord.TypeOfWork.ToString();
                ds.Tables["Customer_Order"].Rows[0]["no_of_copies"] = ord.NOC.ToString();
                ds.Tables["Customer_Order"].Rows[0]["rate"] = ord.Rate.ToString();
                ds.Tables["Customer_Order"].Rows[0]["total"] = ord.Total.ToString();
                ds.Tables["Customer_Order"].Rows[0]["Customer_Id"] = customer_id;

                rptMyReport rpt = new rptMyReport();
                rpt.SetDataSource(ds);

                crystalReportViewer1.ReportSource = rpt;
            }
            catch
            {
            }
        }
Exemple #2
0
        private void btn_searchorder_Click(object sender, EventArgs e)
        {
            if (txt_searchfield.Tag != null)
            {
                //OrderManager om;
                //new OrderManager().GenerateOrderNo(dtp_startdate.Value.Month, dtp_startdate.Value.Year);
                string txtvalue = txt_searchfield.Text;
                if (order == null)
                    order = new Order();
                order.CustomerId = int.Parse(txt_searchfield.Tag.ToString()); //new OrderManager().GetCustId(cb_search.SelectedItem.ToString(), txtvalue);

                DataTable dt = new OrderManager().GetData(dtp_startdate.Value.Date, dtp_enddate.Value.Date, cb_search.Text, txt_searchfield.Text, order.CustomerId);

                dgv_order.DataSource = dt;
                dgv_order.Columns[0].ReadOnly = true;
            }
        }
        internal void UpdateOrder(int custo_id)
        {
            if (order == null)
                order = new Order();
            if (customer == null)
                customer = new Customer();

            string query = "SELECT * FROM Customer_Order where Customer_Id = " + custo_id;
            Order ord = new OrderManager().GetAllData(query);
            string query1 = "SELECT * FROM Customer_Details where customer_id = " + customer.Id;
            Customer cust = new CustomerManager().GetAllCustData(query1);

            order.CustomerId = customer.Id;
            if (ord.CustomerId > 0)
            {
                //Customer Order form
                ResetForm1_Update(true, false);
                txt_firstname.Text = customer.Name.ToString();
                txt_lastname.Text = customer.Surname.ToString();
                txt_contactno.Text = customer.Contact.ToString();
                txt_company.Text = customer.NameOfCom.ToString();

                txt_ordernum.Text = ord.OrderNo.ToString();
                cmb_tow.SelectedItem = ord.TypeOfWork.ToString();
                txt_noofcopy.Text = ord.NOC.ToString();
                txt_rate.Text = ord.Rate.ToString();
                txt_total.Text = ord.Total.ToString();
            }
            else
            {
                MessageBox.Show("Please provide the essential details!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }