예제 #1
0
        private void QuestionSetEditor_Load(object sender, EventArgs e)
        {
            ds = new Dataset();
            ds = (Dataset)dbObject.FullDataset.Copy();
            for (int i = 0; i < ds.QuestionsEx.Count; i++)
            {
                if (ds.QuestionsEx[i].RowState == DataRowState.Deleted)
                {
                    continue;
                }
                if (ds.QuestionsEx[i].SetId != Id)
                {
                    ds.QuestionsEx[i].Delete();
                    continue;
                }
                if (ds.QuestionsEx[i].SubtypeId == 3)
                {
                    ds.QuestionsEx[i].Delete();
                    continue;
                }
            }

            pasId = new int[ds.PassagesToQuestionsEx.Count];

            questionSetsDataGrid.DataSource = ds;
            Idpas.DataSource = ds;
            questionSetsDataGrid.Update();
            RefreshSetInfo();
            ListSortDirection direction;

            direction = ListSortDirection.Ascending;
            questionSetsDataGrid.Sort(questionSetsDataGrid.Columns[questionOrderDataGridViewTextBoxColumn.Index], direction);
        }
예제 #2
0
        public override void mostrarInventario(DataGridView dtgrdvw)
        {
            dtgrdvw.DataSource = null;
            dtgrdvw.Update();

            BencalethDataSet dtset = new BencalethDataSet();
            BencalethDataSetTableAdapters.SelectDonacionesTableAdapter tblAdptEmp = new SelectDonacionesTableAdapter();

            tblAdptEmp.Fill(dtset.SelectDonaciones);

            dtgrdvw.DataSource = dtset.SelectDonaciones.DefaultView;
            dtgrdvw.Columns[0].HeaderText = "ID";
            dtgrdvw.Columns[1].HeaderText = "Descripción";
            dtgrdvw.Columns[2].HeaderText = "Cantidad";
            dtgrdvw.Columns[3].HeaderText = "Donante";
            dtgrdvw.Update();
        }
예제 #3
0
        public Form_NumberFormat(WooTable _ribbon, double _selection)
        {
            InitializeComponent();
            _grid = Form_NumberFormat_grid_Formats;

            try
            {
                ThisRibbon    = _ribbon;
                ThisSelection = _selection;

                for (int i = 0; i < 4; i++)
                {
                    _grid.Rows.Add();
                }
                //_grid[0, 0].Value = "Currency";
                _grid[0, 0].Value = Resources.Labels.ResourceManager.GetString(_grid.Name + "_val1");
                _grid[1, 0].Value = "$#,##0.00;[Red]$#,##0.00";
                //_grid[0, 1].Value = "Accounting";
                _grid[0, 1].Value = Resources.Labels.ResourceManager.GetString(_grid.Name + "_val2");
                _grid[1, 1].Value = "_($* #,##0.00_);_($* (#,##0.00);_($* \" - \"??_);_(@_)";
                //_grid[0, 2].Value = "Scientific";
                _grid[0, 2].Value = Resources.Labels.ResourceManager.GetString(_grid.Name + "_val3");
                _grid[1, 2].Value = "0.00E+00";
                //_grid[0, 3].Value = "Custom..";
                _grid[0, 3].Value = Resources.Labels.ResourceManager.GetString(_grid.Name + "_val4");

                // try to get the examples
                _grid[2, 0].Value = ThisSelection.ToString(_grid[1, 0].Value.ToString());
                _grid[2, 1].Value = ThisSelection.ToString(_grid[1, 1].Value.ToString());
                _grid[2, 2].Value = ThisSelection.ToString(_grid[1, 2].Value.ToString());

                _grid.Update();
            }
            catch (Exception E)
            {
                System.Windows.Forms.MessageBox.Show("Could not generate data grid: " + E.Message, "WooTable .::. Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }
예제 #4
0
        public void mostrarDatos(DataGridView dtgrdvw, TextBox txtbBuscado)
        {
            dtgrdvw.DataSource = null;
            dtgrdvw.Update();

            BencalethDataSet dtset = new BencalethDataSet();
            BencalethDataSetTableAdapters.BuscarSelect_AlcanciasTableAdapter tblAdptEmp = new BuscarSelect_AlcanciasTableAdapter();

            if (!(string.IsNullOrEmpty(txtbBuscado.Text)))
            {
                if (((RadioButton)txtbBuscado.Parent.Controls["rdbtnID"]).Checked)
                {
                    tblAdptEmp.Fill(dtset.BuscarSelect_Alcancias, txtbBuscado.Text, null);
                }
                else
                {
                    tblAdptEmp.Fill(dtset.BuscarSelect_Alcancias, null, txtbBuscado.Text);
                }
            }
            else
            {
                tblAdptEmp.Fill(dtset.BuscarSelect_Alcancias, null, null);
            }

            dtgrdvw.DataSource = dtset.BuscarSelect_Alcancias.DefaultView;
            dtgrdvw.Columns[0].HeaderText = "ID";
            dtgrdvw.Columns[1].HeaderText = "Dirección";
            dtgrdvw.Columns[2].HeaderText = "Local";
            dtgrdvw.Columns[3].HeaderText = "Teléfono";
            dtgrdvw.Columns[4].HeaderText = "Fecha";
            dtgrdvw.Columns[5].HeaderText = "Recurrencia";
            dtgrdvw.Update();
        }
예제 #5
0
        private void Category3Button_Click(object sender, EventArgs e)
        {
            //get item qty

            CCategoryButton tempCategory3Button = (CCategoryButton)sender;
            RMSGlobal.m_sellinginvalue = tempCategory3Button.SellingQuantityorWeight; //Used to identify the product whether sold in quantity or weight

            int tempCategory3ID = tempCategory3Button.CategoryID;
            if (m_bItemDescriptionClicked)
            {
                string tempItemDescription = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0]["description"].ToString();
                if (!tempItemDescription.Equals(""))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Item Description", tempItemDescription);
                    tempMessageBox.ShowDialog();
                }
                else
                {
                    CMessageBox tempMessageBox = new CMessageBox("Item Description", "No information available.");
                    tempMessageBox.ShowDialog();
                }
                m_bItemDescriptionClicked = false;
                return;
            }

            int tempFoodType = int.Parse(Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0].GetParentRow(Program.initDataSet.Relations["category2_to_category3"])["cat2_type"].ToString());
            DataGridView tempDataGridView = new DataGridView();
            if (tempFoodType == 0)
            {
                tempDataGridView = g_BeverageDataGridView;
            }
            else
            {
                tempDataGridView = g_FoodDataGridView;
            }

            DataRow[] tempDataRowArray = Program.initDataSet.Tables["Category4"].Select("cat3_id = " + tempCategory3ID.ToString());

            category4ButtonList.Clear();

            COrderInfoDAO aOrderInfoDao = new COrderInfoDAO();
            COrderInfo aCOrderInfo = aOrderInfoDao.GetOrderInfoByOrderID(orderID);

            if (tempDataRowArray.Length != 0)
            {

                foreach (DataRow tempDataRow in tempDataRowArray)
                {
                    if (Int32.Parse(tempDataRow["status"].ToString()) == 0)
                    {
                        continue;
                    }
                    CCategoryButton tempCategoryButton = new CCategoryButton();
                    tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat4_id"].ToString());
                    tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat4_order"].ToString());
                    tempCategoryButton.CategoryLevel = 4;
                    tempCategoryButton.Text = tempDataRow["cat4_name"].ToString();
                    tempCategoryButton.BackColor = tempCategory3Button.BackColor;
                    category4ButtonList.Add(tempCategoryButton);
                }

                keyboardForm.Hide();
                CCategory4Form tempCategory4Form = new CCategory4Form(tempCategory3ID, category4ButtonList, tempCategory3Button.Text);
                tempCategory4Form.ShowDialog();

                CCategoryButton tempCategory4Button = CCategory4Form.m_cbResult;
                m_iSavedOrderedQty = CCategory4Form.ItemQTY;
                if (tempCategory4Button == null)
                {
                    return;
                }
                else   //insert into table and datagridview
                {
                    DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempCategory4Button.CategoryID.ToString());
                    if (temp2DataRowArray.Length != 0)
                    {
                        //category4 + categpry3
                        string ItemName = temp2DataRowArray[0]["cat4_name"].ToString() + " " + tempCategory3Button.Text;
                        string tableTypePrice = string.Empty;
                        if (m_iType == m_cCommonConstants.TableType)
                        {
                            tableTypePrice = temp2DataRowArray[0]["table_price"].ToString();
                        }
                        else if (m_iType == m_cCommonConstants.TakeAwayType)
                        {
                            tableTypePrice = temp2DataRowArray[0]["tw_price"].ToString();
                        }

                        int tempSearchResult = FindExistingItem(tempDataGridView, ItemName);

                        // vat_included
                        double vatRate = 0;
                        bool vat_included = false;
                        double vatAmountRate = 0;
                        try
                        {
                            vatRate = Convert.ToDouble(temp2DataRowArray[0]["vat_Rate"].ToString());
                            vat_included = Convert.ToBoolean(temp2DataRowArray[0]["vat_included"].ToString());

                            if (vat_included)
                            {
                                vatAmountRate = (Double.Parse(tableTypePrice) * vatRate) / 100;

                                // tableTypePrice = (Double.Parse(tableTypePrice) - vatAmountRate).ToString();
                                tableTypePrice = Convert.ToDouble(tableTypePrice).ToString();
                            }
                            else
                            {
                                vatAmountRate = 0.00;
                            }

                        }
                        catch (Exception ex) { }

                        COrderManager tempOrderManager = new COrderManager();
                        COrderDetails tempOrderDetails = new COrderDetails();

                        if (tempSearchResult != -1)
                        {
                            int tempRowIndex = tempSearchResult;
                            int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                            tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                            tempDataGridView.Rows[tempRowIndex].Cells[3].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                            //update Order_details table
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[7].Value.ToString());
                            tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = qty;
                            tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderDetails.OnlineItemSequenceNumber = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                            tempOrderDetails.PrintedQuantity = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[8].Value.ToString());

                            if (aCOrderInfo.VatComplementory) vatRate =vatAmountRate= 0;
                            if (vat_included)
                            {
                                // tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
                                tempOrderDetails.VatTotal = qty * vatAmountRate;
                                tempDataGridView.Rows[tempRowIndex].Cells[2].Value = qty * vatAmountRate;
                            }
                            else
                            {
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                            }

                            if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                            {
                                tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                            }
                            else
                            {
                                tempOrderManager.UpdateOnlineOrderDetails(tempOrderDetails);//for online orders
                            }
                        }
                        else
                        {
                            //Insert into Order_details table
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                            tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                          //  tempOrderDetails.Product_Name = temp2DataRowArray[0]["cat3_name"].ToString();
                            if (aCOrderInfo.VatComplementory) vatRate = 0;
                            if (vat_included)
                            {
                                tempOrderDetails.VatTotal = 0;
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                                // tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
                            }
                            else
                            {
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                            }

                            tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;

                            string category1ID = this.GetCategory1ID(tempOrderDetails.ProductID, tempOrderDetails.CategoryLevel);
                            //Int32 cat1Order = this.GetCategory1OrderNumber(Convert.ToInt32(category1ID)); // Change by Mithu

                            if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                            {
                                tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;
                                string[] tempDataGridViewRow = new string[]
                                { ItemName,
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)tempOrderDetails.VatTotal).ToString("F02"),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory4Button.CategoryID.ToString(),
                                  "4",
                                  temp2DataRowArray[0]["cat4_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),
                                  "0",
                                  tempOrderDetails.UnitPrice.ToString("F2")
                                };

                                tempDataGridView.Rows.Add(tempDataGridViewRow);
                            }
                            else //For online orders
                            {
                                tempOrderDetails.ItemName = ItemName;
                                tempOrderDetails = (COrderDetails)tempOrderManager.InsertOnlineOrderDetails(tempOrderDetails).Data;
                                string[] tempDataGridViewRow = new string[]
                                { ItemName,
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)tempOrderDetails.VatTotal).ToString("F02"),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory4Button.CategoryID.ToString(),
                                  "4",
                                  tempOrderDetails.OnlineItemSequenceNumber.ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),"0",
                                  tempOrderDetails.UnitPrice.ToString("F2")
                                };

                                tempDataGridView.Rows.Add(tempDataGridViewRow);
                            }
                        }

                        if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper()) //If local orders are considered
                        {
                            this.ConvertRank();
                        }

                        tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);

                        tempDataGridView.Update();
                        TotalAmountCalculation();
                    }
                }
            }
            else //There is no category4
            {
                keyboardForm.Hide();
                try
                {
                    CCalculatorForm tempCalculatorForm = new CCalculatorForm("Order Quantity", "Item Quantity");
                    tempCalculatorForm.ShowDialog();

                    if (CCalculatorForm.inputResult.Equals("Cancel"))
                        return;

                    string str = CCalculatorForm.inputResult;
                    str = (str == "") ? "1" : str;

                    if (Int32.Parse(str) == 0)
                    {
                        CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!");
                        tempMessageBox.ShowDialog();
                        return;
                    }

                    int tempOrderedQty = Int32.Parse(str);
                    m_iSavedOrderedQty = tempOrderedQty;

                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                DataGridViewRow tempDataGridViewRow = new DataGridViewRow();
                tempDataGridViewRow.CreateCells(tempDataGridView);

                DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3Button.CategoryID.ToString());
                if (temp2DataRowArray.Length != 0)
                {
                    string tableTypePrice = string.Empty;
                    if (m_iType == m_cCommonConstants.TableType)
                    {
                        tableTypePrice = temp2DataRowArray[0]["table_price"].ToString();
                    }
                    else if (m_iType == m_cCommonConstants.TakeAwayType)
                    {
                        tableTypePrice = temp2DataRowArray[0]["tw_price"].ToString();
                    }

                    // vat_included
                    double vatRate = 0;
                    bool vat_included = false;
                    double vatAmountRate = 0;

                    try
                    {
                        vatRate = Convert.ToDouble(temp2DataRowArray[0]["vat_Rate"].ToString());
                        vat_included = Convert.ToBoolean(temp2DataRowArray[0]["vat_included"].ToString());

                        if (vat_included)
                        {
                            vatAmountRate = (Double.Parse(tableTypePrice) * vatRate) / 100;

                            // tableTypePrice = (Double.Parse(tableTypePrice) - vatAmountRate).ToString();
                            tableTypePrice = Convert.ToDouble(tableTypePrice).ToString();
                        }
                        else
                        {
                            vatAmountRate = 0.00;
                        }

                    }
                    catch (Exception ex) { }

                    COrderManager tempOrderManager = new COrderManager();
                    COrderDetails tempOrderDetails = new COrderDetails();

                    int tempResult = FindExistingItem(tempDataGridView, temp2DataRowArray[0]["cat3_name"].ToString());
                    if (tempResult != -1)
                    {
                        //update Order_details table
                        int tempRowIndex = tempResult;
                        int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                        tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                        tempDataGridView.Rows[tempRowIndex].Cells[3].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                        tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[7].Value.ToString());
                        tempOrderDetails.OrderID = orderID;
                        tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                        tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                        tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                        tempOrderDetails.OrderQuantity = qty;
                        tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                        tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                        tempOrderDetails.OnlineItemSequenceNumber = Convert.ToInt64("0" + tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                        tempOrderDetails.PrintedQuantity = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[8].Value.ToString());
                        if (aCOrderInfo.VatComplementory) vatAmountRate = 0;
                        if (vat_included)
                        {
                            tempOrderDetails.VatTotal = qty * vatAmountRate;
                            tempDataGridView.Rows[tempRowIndex].Cells[2].Value = tempOrderDetails.VatTotal;
                        }
                        else
                        {
                            tempOrderDetails.VatTotal = 0.00;
                        }

                        if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                        {
                            tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                        }
                        else
                        {
                            tempOrderManager.UpdateOnlineOrderDetails(tempOrderDetails);
                        }

                    }
                    else
                    {
                        //Insert into Order_details table
                        tempOrderDetails.OrderID = orderID;
                        tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                        tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                        tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                        tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                        tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                        tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                        tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                        tempOrderDetails.Product_Name = temp2DataRowArray[0]["cat3_name"].ToString();
                        tempOrderDetails.UOM = temp2DataRowArray[0]["uom"].ToString();
                        tempOrderDetails.Product_Type = temp2DataRowArray[0]["productType"].ToString();
                        if (aCOrderInfo.VatComplementory) vatRate = vatAmountRate = 0;
                        try
                        {
                            if (vat_included)
                            {
                                tempOrderDetails.VatTotal = 0;
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                                // tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
                            }
                            else
                            {
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                            }
                        }
                        catch { }

                        try
                        {
                            tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;

                        }
                        catch { }

                        string category1ID = this.GetCategory1ID(tempOrderDetails.ProductID, tempOrderDetails.CategoryLevel);
                        Int32 cat1Order = this.GetCategory1OrderNumber(Convert.ToInt32(category1ID));

                        if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                        {
                            tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;
                            string[] temp2DataGridViewRow = new string[]
                                { temp2DataRowArray[0]["cat3_name"].ToString(),
                                  m_iSavedOrderedQty.ToString(),
                                  tempOrderDetails.VatTotal.ToString("F2"),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory3Button.CategoryID.ToString(),
                                  "3",
                                  temp2DataRowArray[0]["cat3_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),"0",
                                    tempOrderDetails.UnitPrice.ToString("F2")
                                };
                            tempDataGridView.Rows.Add(temp2DataGridViewRow);
                        }
                        else
                        {
                            tempOrderDetails.ItemName = temp2DataRowArray[0]["cat3_name"].ToString();
                            tempOrderDetails = (COrderDetails)tempOrderManager.InsertOnlineOrderDetails(tempOrderDetails).Data;
                            string[] temp2DataGridViewRow = new string[]
                                {temp2DataRowArray[0]["cat3_name"].ToString(),
                                  m_iSavedOrderedQty.ToString(),
                                    tempOrderDetails.VatTotal.ToString(),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory3Button.CategoryID.ToString(),
                                  "3",
                                  tempOrderDetails.OnlineItemSequenceNumber.ToString(),//For online order sequence number is category rank.
                                  tempOrderDetails.OrderDetailsID.ToString(),"0", //0 For first time.
                                  tempOrderDetails.UnitPrice.ToString("F2")
                                };
                            tempDataGridView.Rows.Add(temp2DataGridViewRow);
                        }
                    }

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        this.ConvertRank();
                    }
                    tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                    try
                    {
                        tempDataGridView.Update();
                    }
                    catch { }
                        TotalAmountCalculation();

                }
            }
            g_FoodDataGridView.ClearSelection();
            g_BeverageDataGridView.ClearSelection();
            m_iSavedOrderedQty = 1;

            keyboardForm.Hide();

            this.SetPrintedItemBackColor();
        }
예제 #6
0
 //para mostrar los datos en los datagridview del mantenimiento
 //recibimos los parametros dtgrdvw que seria el del formulario de mantenimiento
 //y txtbBuscado que seria un valor buscado
 public void mostrarDatos(DataGridView dtgrdvw, TextBox txtbBuscado)
 {
     //despejamos el datagridview
     dtgrdvw.DataSource = null;
     dtgrdvw.Update();
     //accedemos al dataset
     BencalethDataSet dtset = new BencalethDataSet();
     //accedemos a una funcion que devuelve un select de tipo de empresas
     BencalethDataSetTableAdapters.BuscarSelect_TipoEmpresaTableAdapter tblAdptEmp = new BuscarSelect_TipoEmpresaTableAdapter();
     //identificamos si esta buscando
     if (!(string.IsNullOrEmpty(txtbBuscado.Text)))
     {
         //revisamos que esta buscando, el if es para si es el ID
         if (((RadioButton)txtbBuscado.Parent.Controls["rdbtnID"]).Checked)
         {
             tblAdptEmp.Fill(dtset.BuscarSelect_TipoEmpresa, txtbBuscado.Text, null);
         }
         else
         {
             tblAdptEmp.Fill(dtset.BuscarSelect_TipoEmpresa, null, txtbBuscado.Text);
         }
     }
     else
     {
         tblAdptEmp.Fill(dtset.BuscarSelect_TipoEmpresa, null, null);
     }
     //se lo mandamos y estilisamos las columnas a mostrar
     dtgrdvw.DataSource = dtset.BuscarSelect_TipoEmpresa.DefaultView;
     dtgrdvw.Columns[0].HeaderText = "Código Identificador";
     dtgrdvw.Columns[1].HeaderText = "Descripción";
     dtgrdvw.Update();
 }
예제 #7
0
        private void Category3Button_Click(object sender, EventArgs e)
        {
            try
            {
                CCategoryButton tempCategory3Button = (CCategoryButton)sender;
                int tempCategory3ID = tempCategory3Button.CategoryID;

                if (m_bItemDescriptionClicked)
                {
                    string tempItemDescription = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0]["description"].ToString();
                    CMessageBox tempMessageBox = new CMessageBox("Item Description", tempItemDescription);
                    tempMessageBox.ShowDialog();
                    m_bItemDescriptionClicked = false;
                    return;
                }

                int tempFoodType = int.Parse(Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0].GetParentRow(Program.initDataSet.Relations["category2_to_category3"])["cat2_type"].ToString());
                DataGridView tempDataGridView = new DataGridView();
                tempDataGridView = g_FoodDataGridView;

                DataRow[] tempDataRowArray = Program.initDataSet.Tables["Category4"].Select("cat3_id = " + tempCategory3ID.ToString());
                category4ButtonList.Clear();
                if (tempDataRowArray.Length != 0)
                {
                    foreach (DataRow tempDataRow in tempDataRowArray)
                    {
                        CCategoryButton tempCategoryButton = new CCategoryButton();
                        tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat4_id"].ToString());
                        tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat4_order"].ToString());
                        tempCategoryButton.CategoryLevel = 4;
                        tempCategoryButton.Text = tempDataRow["cat4_name"].ToString();
                        tempCategoryButton.BackColor = tempCategory3Button.BackColor;
                        category4ButtonList.Add(tempCategoryButton);
                    }

                    CCategory4Form tempCategory4Form = new CCategory4Form(tempCategory3ID, category4ButtonList, tempCategory3Button.Text);
                    tempCategory4Form.ShowDialog();
                    CCategoryButton tempCategory4Button = CCategory4Form.m_cbResult;
                    if (tempCategory4Button == null)
                        return;
                    else   //insert into table and datagridview
                    {
                        NewOrder();

                        DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempCategory4Button.CategoryID.ToString());
                        if (temp2DataRowArray.Length != 0)
                        {
                            //category4 + categpry3
                            string ItemName = temp2DataRowArray[0]["cat4_name"].ToString() + " " + tempCategory3Button.Text;
                            string tableTypePrice = string.Empty;
                            tableTypePrice = temp2DataRowArray[0]["bar_price"].ToString();
                            int tempSearchResult = DataGridViewSearch(tempDataGridView, ItemName);

                            COrderManager tempOrderManager = new COrderManager();
                            COrderDetails tempOrderDetails = new COrderDetails();

                            if (tempSearchResult != -1)
                            {
                                int tempRowIndex = tempSearchResult;
                                int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                                tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                                tempDataGridView.Rows[tempRowIndex].Cells[2].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                                //update Order_details table
                                tempOrderDetails.OrderID = orderID;
                                tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                                tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                                tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                                tempOrderDetails.OrderQuantity = qty;
                                tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                                tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                                tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                                tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                            }
                            else
                            {
                                //Insert into Order_details table
                                tempOrderDetails.OrderID = orderID;
                                tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                                tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                                tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                                tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                                tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                                tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                                CResult oResult = tempOrderManager.InsertOrderDetails(tempOrderDetails);
                                if (oResult.IsSuccess && oResult.Data != null)
                                {
                                    tempOrderDetails = (COrderDetails)oResult.Data;
                                }

                                string[] tempDataGridViewRow = new string[]
                                { ItemName,
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory4Button.CategoryID.ToString(),
                                  "4",
                                  temp2DataRowArray[0]["cat4_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString()
                                };

                                tempDataGridView.Rows.Add(tempDataGridViewRow);
                            }
                            ConvertRank();
                            tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                            tempDataGridView.Update();
                            TotalAmountCalculation();
                        }
                    }
                }
                else //There is no category4
                {
                    NewOrder();
                    DataGridViewRow tempDataGridViewRow = new DataGridViewRow();
                    tempDataGridViewRow.CreateCells(tempDataGridView);

                    DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3Button.CategoryID.ToString());

                    if (temp2DataRowArray.Length != 0)
                    {
                        string tableTypePrice = string.Empty;
                        tableTypePrice = temp2DataRowArray[0]["bar_price"].ToString();

                        COrderManager tempOrderManager = new COrderManager();
                        COrderDetails tempOrderDetails = new COrderDetails();

                        int tempResult = DataGridViewSearch(tempDataGridView, temp2DataRowArray[0]["cat3_name"].ToString());
                        if (tempResult != -1)
                        {
                            //update Order_details table
                            int tempRowIndex = tempResult;
                            int qty=int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                            tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                            tempDataGridView.Rows[tempRowIndex].Cells[2].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                            tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = qty;
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                        }
                        else
                        {
                            //Insert into Order_details table
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                            CResult oResult = tempOrderManager.InsertOrderDetails(tempOrderDetails);
                            if (oResult.IsSuccess && oResult.Data != null)
                            {
                                tempOrderDetails = (COrderDetails)oResult.Data;
                            }

                            string[] temp2DataGridViewRow = new string[]
                                { temp2DataRowArray[0]["cat3_name"].ToString(),
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory3Button.CategoryID.ToString(),
                                  "3",
                                  temp2DataRowArray[0]["cat3_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString()
                                };

                            tempDataGridView.Rows.Add(temp2DataGridViewRow);
                        }
                        ConvertRank();
                        tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                        tempDataGridView.Update();
                        TotalAmountCalculation();
                    }
                }
                m_iSavedOrderedQty = 1;
                g_FoodDataGridView.ClearSelection();
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
예제 #8
0
        private void ActualizaGridIncisos(DataGridView dataGridView1, IQueryable<incisos> incisos)
        {
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Clear();

            dataGridView1.Columns.Add("ID_", "ID");
            dataGridView1.Columns[0].Visible = false;

            dataGridView1.Columns.Add("Inciso_", "Inciso");
            dataGridView1.Columns[1].Visible = true;
            dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            dataGridView1.Columns.Add("Tipo_", "Tipo");
            dataGridView1.Columns[2].Visible = true;

            dataGridView1.Columns.Add("Pregunta_", "Pregunta");
            dataGridView1.Columns[3].Visible = true;

            dataGridView1.Columns.Add("Catalogo_", "Catálogo");
            dataGridView1.Columns[4].Visible = true;

            dataGridView1.Columns.Add("Numeral_", "Numeral");
            dataGridView1.Columns[5].Visible = true;

            foreach (var encuesta in incisos)
            {
                DataGridViewRow fila = new DataGridViewRow();
                fila.CreateCells(dataGridView1, "", "", "", "", "", "");
                fila.Cells[0].Value = encuesta.id_inciso;
                fila.Cells[1].Value = encuesta.inciso.Trim();
                fila.Cells[2].Value = encuesta.tipo_inciso.tipo_inciso1;
                fila.Cells[3].Value = encuesta.preguntas.pregunta;
                fila.Cells[4].Value = encuesta.catalogo.catalogo1;
                fila.Cells[5].Value = encuesta.numeral;

                dataGridView1.Rows.Add(fila);
            }
            dataGridView1.Update();
        }
예제 #9
0
        private void ActualizaGridResultados(DataGridView dataGridView1, IQueryable<resultados_encuesta> resenc)
        {
            dataGridView1.Rows.Clear();

            foreach (var encuesta in resenc)
            {
                DataGridViewRow fila = new DataGridViewRow();
                fila.CreateCells(dataGridView1, "", "", "", "");
                fila.Cells[0].Value = encuesta.id_aplicacion_encuesta;
                fila.Cells[1].Value = encuesta.resultado;
                fila.Cells[2].Value = encuesta.resultado_texto;

                dataGridView1.Rows.Add(fila);
            }
            dataGridView1.Update();
        }
예제 #10
0
        private void ActualizaGridDetalleCatalogo(DataGridView dataGridView1, IQueryable<detalle_catalogo> detcatalogos)
        {
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Clear();

            dataGridView1.Columns.Add("ID_", "ID");
            dataGridView1.Columns[0].Visible = false;

            dataGridView1.Columns.Add("Catalogo_", "Catálogo");
            dataGridView1.Columns[1].Visible = true;
            dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            dataGridView1.Columns.Add("Nombre_", "Nombre");
            dataGridView1.Columns[2].Visible = true;

            dataGridView1.Columns.Add("Peso_", "Peso");
            dataGridView1.Columns[3].Visible = true;

            dataGridView1.Columns.Add("Numeral_", "Numeral");
            dataGridView1.Columns[4].Visible = true;

            foreach (var encuesta in detcatalogos)
            {
                DataGridViewRow fila = new DataGridViewRow();
                fila.CreateCells(dataGridView1, "", "", "");
                fila.Cells[0].Value = encuesta.id;
                fila.Cells[1].Value = encuesta.catalogo.catalogo1;
                fila.Cells[2].Value = encuesta.nombre;
                fila.Cells[3].Value = encuesta.peso;
                fila.Cells[4].Value = encuesta.numeral;

                dataGridView1.Rows.Add(fila);
            }
            dataGridView1.Update();
        }
예제 #11
0
        private void ActualizaGridEncuesta(DataGridView dataGridView1, IQueryable<encuesta> encuestas)
        {
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Clear();

            dataGridView1.Columns.Add("ID_", "ID");
            dataGridView1.Columns[0].Visible = false;

            dataGridView1.Columns.Add("Encuesta_", "Encuesta");
            dataGridView1.Columns[1].Visible = true;
            dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            dataGridView1.Columns.Add("Descripcion_", "Descripción");
            dataGridView1.Columns[2].Visible = true;

            foreach (var encuesta in encuestas)
            {
                DataGridViewRow fila = new DataGridViewRow();
                fila.CreateCells(dataGridView1, "", "", "");
                fila.Cells[0].Value = encuesta.id;
                fila.Cells[1].Value = encuesta.encuesta1;
                fila.Cells[2].Value = encuesta.descripción;

                dataGridView1.Rows.Add(fila);
            }
            dataGridView1.Update();
        }
예제 #12
0
        private void ActualizaGridCatalogos(DataGridView dataGridView1, catalogo catalogo)
        {
            int i = 0;
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Clear();

            dataGridView1.Columns.Add("ID_", "ID");
            dataGridView1.Columns[i++].Visible = false;

            //dataGridView1.Columns.Add("Catalogo_", "Catálogo");
            //dataGridView1.Columns[1].Visible = true;
            //dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            dataGridView1.Columns.Add("Nombre_", "Nombre");
            dataGridView1.Columns[i++].Visible = true;

            dataGridView1.Columns.Add("Peso_", "Peso");
            dataGridView1.Columns[i++].Visible = true;

            //dataGridView1.Columns.Add("Numeral_", "Numeral");
            //dataGridView1.Columns[i++].Visible = true;

            foreach (var detalle in catalogo.detalle_catalogo.OrderBy(item => item.numeral))
            {
                DataGridViewRow fila = new DataGridViewRow();
                fila.CreateCells(dataGridView1, "", "", "");
                fila.Cells[0].Value = detalle.id;
                fila.Cells[1].Value = detalle.nombre;
                fila.Cells[2].Value = detalle.peso;
                //fila.Cells[4].Value = encuesta.numeral;

                dataGridView1.Rows.Add(fila);
            }
            dataGridView1.Update();
        }
예제 #13
0
        private void ActualizaGridAplicaciones(DataGridView dataGridView1, IQueryable<aplicacion_encuesta> aplicaciones)
        {
            int i = 0;
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Clear();

            dataGridView1.Columns.Add("ID_", "ID");
            dataGridView1.Columns[i++].Visible = false;

            dataGridView1.Columns.Add("Descripcion_", "Descripción");
            dataGridView1.Columns[i].Visible = true;
            //dataGridView1.Columns[i++].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            dataGridView1.Columns.Add("Fecha_", "Fecha");
            dataGridView1.Columns[i++].Visible = true;

            dataGridView1.Columns.Add("Centro_", "Centro");
            dataGridView1.Columns[i++].Visible = true;

            dataGridView1.Columns.Add("Curso_", "Curso");
            dataGridView1.Columns[i++].Visible = true;

            dataGridView1.Columns.Add("Encuesta_", "Encuesta");
            dataGridView1.Columns[i++].Visible = true;

            dataGridView1.Columns.Add("Sujeto_", "Sujetos");
            dataGridView1.Columns[i++].Visible = true;

            foreach (var aplicacion in aplicaciones)
            {
                int j = 0;
                DataGridViewRow fila = new DataGridViewRow();
                fila.CreateCells(dataGridView1, "", "", "", "","","");
                fila.Cells[j++].Value = aplicacion.id;
                fila.Cells[j++].Value = aplicacion.descripcion;
                fila.Cells[j++].Value = aplicacion.fecha.ToShortDateString();
                if (aplicacion.id_centro != null)
                {
                    fila.Cells[j++].Value = DataEmprendeconextion.centro.Where(item => item.id == aplicacion.id_centro).First().nombre;
                }
                else
                    fila.Cells[j++].Value = "";
                if (aplicacion.curso != null)
                {
                    fila.Cells[j++].Value = aplicacion.curso.descripcion;
                }
                else
                    fila.Cells[j++].Value = "";
                fila.Cells[j++].Value = aplicacion.encuesta.encuesta1;
                string sujetos = "";
                //foreach (var resultado in aplicacion.resultados_encuesta.OrderBy(item=>item.id_sujeto).Distinct(item=>item.id_sujeto))
                if (aplicacion.resultados_encuesta.Count > 0)
                {
                    foreach (var resultado in aplicacion.resultados_encuesta.GroupBy(item=>item.id_sujeto).Select(item=>item.FirstOrDefault()))
                    {
                        if (sujetos == "")
                        {
                            sujetos += resultado.id_sujeto;
                        }
                        else
                        {
                            sujetos += " ," + resultado.id_sujeto;
                        }
                    }
                    fila.Cells[j++].Value = sujetos;
                }

                dataGridView1.Rows.Add(fila);
            }
            dataGridView1.Update();
        }
예제 #14
0
        private void FillNonFoods()
        {
            g_FoodDataGridView.RowCount = 0;
            COrderManager tempOrderManager = new COrderManager();
            List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
            CResult oResult = tempOrderManager.OrderDetailsByOrderID(orderID);

            if (oResult.IsSuccess && oResult.Data != null)
            {
                tempOrderDetailsList = (List<COrderDetails>)oResult.Data;
            }

            for (int detailsCounter = 0; detailsCounter < tempOrderDetailsList.Count; detailsCounter++)
            {
                Int64 tempProductID = tempOrderDetailsList[detailsCounter].ProductID;
                int tempCategoryLevel = tempOrderDetailsList[detailsCounter].CategoryLevel;

                string tempProductName = "";
                if (tempCategoryLevel == 3)
                {
                    DataRow[] tempDataRowArr = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempProductID);
                    tempProductName = tempDataRowArr[0]["cat3_name"].ToString();
                }
                else if (tempCategoryLevel == 4)
                {
                    //Latest name is at first
                    int tempCat3_id = int.Parse(Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempProductID)[0].GetParentRow(Program.initDataSet.Relations["category3_to_category4"])["cat3_id"].ToString());
                    tempProductName += Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempProductID)[0]["cat4_name"].ToString();
                    tempProductName += " " + Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCat3_id)[0]["cat3_name"].ToString();

                }
                else if (tempCategoryLevel == 0)
                    tempProductName = tempOrderDetailsList[detailsCounter].OrderRemarks;

                int tempFoodType = 0;

                DataGridView tempDataGridView = new DataGridView();
                tempDataGridView = g_FoodDataGridView;

                string[] tempDataGridViewRow = {
                    tempProductName,
                    tempOrderDetailsList[detailsCounter].OrderQuantity.ToString(),
                    ((double)tempOrderDetailsList[detailsCounter].OrderAmount).ToString("F02"),
                    tempOrderDetailsList[detailsCounter].ProductID.ToString(),
                    tempOrderDetailsList[detailsCounter].CategoryLevel.ToString(),
                    (Int64.MaxValue-1)+"",//max rank
                    tempOrderDetailsList[detailsCounter].OrderDetailsID.ToString()
                    };

                //not misc item... rank is specified
                if (tempCategoryLevel != 0)
                    tempDataGridViewRow[5] = Program.initDataSet.Tables["Category" + tempCategoryLevel].Select("cat" + tempCategoryLevel + "_id = " + tempProductID)[0]["cat" + tempCategoryLevel + "_rank"].ToString();

                tempDataGridView.Rows.Add(tempDataGridViewRow);
                ConvertRank();
                tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                tempDataGridView.Update();
                g_FoodDataGridView.ClearSelection();
            }

            //get discount
            COrderDiscount tempOrderDiscount = new COrderDiscount();
            oResult = tempOrderManager.OrderDiscountGetByOrderID(orderID);
            if (oResult.IsSuccess && oResult.Data != null)
            {
                tempOrderDiscount = (COrderDiscount)oResult.Data;
                m_dDiscountAmount = tempOrderDiscount.Discount;
            }

            if (category2ButtonList.Count > CATEGORY2PANEL_CAPACITY)
                g_NextButton.Enabled = true;
            else
                g_NextButton.Enabled = false;

            g_PreviousButton.Enabled = false;

            TotalAmountCalculation();
            LoadStatusBar();
        }
예제 #15
0
 // =================================================================================
 // Forcing a DataGridview display update
 // Ugly hack if you ask me, but MS didn't give us any other reliable way...
 private void Update_GridView(DataGridView Grid) {
     Grid.Invalidate();
     Grid.Update();
 }
예제 #16
0
        private void ActualizaGridTematicas(DataGridView dataGridView1, IQueryable<tematica> tematicas)
        {
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Clear();

            dataGridView1.Columns.Add("ID_", "ID");
            dataGridView1.Columns[0].Visible = false;

            dataGridView1.Columns.Add("Tematica_", "Temática");
            dataGridView1.Columns[1].Visible = true;
            dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            dataGridView1.Columns.Add("Encuesta_", "Encuesta");
            dataGridView1.Columns[2].Visible = true;

            foreach (var encuesta in tematicas)
            {
                DataGridViewRow fila = new DataGridViewRow();
                fila.CreateCells(dataGridView1, "", "", "");
                fila.Cells[0].Value = encuesta.id;
                fila.Cells[1].Value = encuesta.tematica1;
                fila.Cells[2].Value = encuesta.encuesta.encuesta1;

                dataGridView1.Rows.Add(fila);
            }
            dataGridView1.Update();
        }
예제 #17
0
        /*
         * Deleting a specific record from a selected row in a datagridview
         */
        public void cancelBooking(DataGridView grd_Booking_Details, TextBox txt_Booking_Id)
        {
            string query_String = "DELETE FROM Bookings WHERE Booking_Id = " + txt_Booking_Id.Text;
                try
                {
                    connection.Open();
                    cmd = connection.CreateCommand();
                    cmd.CommandText = query_String;
                    cmd.ExecuteNonQuery();

                    foreach (DataGridViewRow row in grd_Booking_Details.SelectedRows)
                    {

                        if (!row.IsNewRow)
                            grd_Booking_Details.Rows.Remove(row);
                        grd_Booking_Details.Update();

                    }

                    MessageBox.Show("Booking Canceled");

                }
                catch (Exception ex)
                {
                    MessageBox.Show("" + ex);
                }
                finally
                {
                    connection.Close();
                }
        }
예제 #18
0
        /// <summary>
        /// This function loads the items details information.
        /// </summary>
        private void LoadOrderDetails()
        {
            g_FoodDataGridView.Rows.Clear();
               g_BeverageDataGridView.Rows.Clear();
            FillRMSDataGridView();
            g_FoodDataGridView.ClearSelection();
            g_BeverageDataGridView.ClearSelection();

            if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
            {
                COrderManager tempOrderManager = new COrderManager();
                List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
                CResult oResult = tempOrderManager.OrderDetailsByOrderID(orderID);
                if (oResult.IsSuccess && oResult.Data != null)
                    tempOrderDetailsList = (List<COrderDetails>)oResult.Data;

                for (int itemIndex = 0; itemIndex < tempOrderDetailsList.Count; itemIndex++)
                {
                    Int64 tempProductID = tempOrderDetailsList[itemIndex].ProductID;
                    int tempCategoryLevel = tempOrderDetailsList[itemIndex].CategoryLevel;

                    string tempProductName = "";
                    if (tempCategoryLevel == 3)
                    {
                        DataRow[] tempDataRowArr = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempProductID);

                        if (tempDataRowArr.Length > 0)  //Added by Baruri .This was a bug previously when no row found.
                        {
                            tempProductName = tempDataRowArr[0]["cat3_name"].ToString();
                        }
                    }
                    else if (tempCategoryLevel == 4)
                    {
                        DataRow[] tempDataRowArr = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempProductID);
                        int tempCat3_id = 0;
                        if (tempDataRowArr.Length > 0)
                        {
                            tempCat3_id = Convert.ToInt32("0" + tempDataRowArr[0]["cat3_id"]);
                        }

                        tempProductName = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempProductID)[0]["cat4_name"].ToString();

                        tempDataRowArr = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCat3_id);

                        if (tempDataRowArr.Length > 0)//If rows found
                        {
                            tempProductName += " " + tempDataRowArr[0]["cat3_name"].ToString();
                        }
                    }
                    else if (tempCategoryLevel == 0)
                    {
                        tempProductName = tempOrderDetailsList[itemIndex].OrderRemarks;
                    }

                    int tempFoodType = 1;
                    if (tempCategoryLevel == 3)
                    {
                        tempFoodType = int.Parse(Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempProductID)[0].GetParentRow(Program.initDataSet.Relations["category2_to_category3"])["cat2_type"].ToString());
                    }
                    else if (tempCategoryLevel == 4)
                    {
                        int tempCat3_id = int.Parse(Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempProductID)[0].GetParentRow(Program.initDataSet.Relations["category3_to_category4"])["cat3_id"].ToString());
                        tempFoodType = int.Parse(Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCat3_id)[0].GetParentRow(Program.initDataSet.Relations["category2_to_category3"])["cat2_type"].ToString());
                    }
                    else
                    {
                        tempFoodType = -1;
                    }

                    DataGridView tempDataGridView = new DataGridView();
                    if (tempFoodType == 1)//Food Type
                    {
                        tempDataGridView = g_FoodDataGridView;
                    }
                    else if (tempFoodType == 0)//Nonfood Type
                    {
                        tempDataGridView = g_BeverageDataGridView;
                    }
                    else if (tempFoodType == -1)
                    {
                        if (tempOrderDetailsList[itemIndex].OrderFoodType == "Food")
                        {
                            tempDataGridView = g_FoodDataGridView;
                        }
                        else
                        {
                            tempDataGridView = g_BeverageDataGridView;
                        }
                    }

                    //if remarks exists append it... otherwise append nothing...
                    bool sele = false;
                    string appendString = "";
                    if (tempCategoryLevel != 0)
                        appendString = (tempOrderDetailsList[itemIndex].OrderRemarks.Equals("")) ? ("") : (" (" + tempOrderDetailsList[itemIndex].OrderRemarks + ")");

                    string[] tempDataGridViewRow = {
                    tempProductName+appendString,
                    tempOrderDetailsList[itemIndex].OrderQuantity.ToString(),
                     ((double)tempOrderDetailsList[itemIndex].VatTotal).ToString("F02"),
                    ((double)tempOrderDetailsList[itemIndex].OrderAmount).ToString("F02"),
                    tempOrderDetailsList[itemIndex].ProductID.ToString(),
                    tempOrderDetailsList[itemIndex].CategoryLevel.ToString(),
                    (Int64.MaxValue-1)+"",//max rank
                    tempOrderDetailsList[itemIndex].OrderDetailsID.ToString(),
                    tempOrderDetailsList[itemIndex].PrintedQuantity.ToString(),
                     tempOrderDetailsList[itemIndex].UnitPrice.ToString("F2"),

                    };

                    //not misc item... rank is specified
                    if (tempCategoryLevel != 0)
                    {
                        try
                        {
                            tempDataGridViewRow[6] = Program.initDataSet.Tables["Category" + tempCategoryLevel].Select("cat" + tempCategoryLevel + "_id = " + tempProductID)[0]["cat" + tempCategoryLevel + "_rank"].ToString();
                        }
                        catch { }
                    }
                    try
                    {
                        tempDataGridView.Rows.Add(tempDataGridViewRow);
                    }
                    catch (Exception ex)
                    {
                       // MessageBox.Show(ex.ToString());
                    }

                    ConvertRank();
                    if (tempDataGridView.Columns["Order_details_id"] !=null)
                    tempDataGridView.Sort(tempDataGridView.Columns["Order_details_id"], ListSortDirection.Descending);

                    if (tempDataGridView.Columns["dataGridViewTextBoxColumn5"] != null)
                        tempDataGridView.Sort(tempDataGridView.Columns["dataGridViewTextBoxColumn5"], ListSortDirection.Descending);

                    //this.FillCategory1OrderNumber();//New
                    //tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                    tempDataGridView.Update();
                }

                //get discount
                COrderDiscount tempOrderDiscount = new COrderDiscount();
                oResult = tempOrderManager.OrderDiscountGetByOrderID(orderID);
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempOrderDiscount = (COrderDiscount)oResult.Data;
                    m_dDiscountAmount = Convert.ToDecimal(tempOrderDiscount.Discount.ToString("F02"));
                }
            }
            else
            {
                //Loading the online orders information
                //g_FoodDataGridView.RowCount = 0;
                COrderManager tempOrderManager = new COrderManager();
                string remarks = "";
                string itemName = "";
                List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
                CResult oResult = tempOrderManager.GetOnlineOrderDetailsByOrderID(orderID);
                if (oResult.IsSuccess && oResult.Data != null)
                    tempOrderDetailsList = (List<COrderDetails>)oResult.Data;
                for (int counter = 0; counter < tempOrderDetailsList.Count; counter++)
                {
                    remarks = tempOrderDetailsList[counter].OrderRemarks.ToString();
                    itemName = tempOrderDetailsList[counter].ItemName.ToString();

                    if (remarks.Length > 0)
                    {
                        itemName = itemName + "(" + remarks + ")";
                    }
                    string[] tempDataGridViewRow = {
                    itemName,
                    tempOrderDetailsList[counter].OrderQuantity.ToString(),
                    tempOrderDetailsList[counter].OrderAmount.ToString("F02"),
                    tempOrderDetailsList[counter].CategoryID.ToString(),
                    tempOrderDetailsList[counter].CategoryLevel.ToString(),
                    tempOrderDetailsList[counter].Rank.ToString(),
                    tempOrderDetailsList[counter].OrderDetailsID.ToString(),
                    tempOrderDetailsList[counter].PrintedQuantity.ToString(),
                    tempOrderDetailsList[counter].UnitPrice.ToString("F2"),
                    };

                    if (tempOrderDetailsList[counter].OrderFoodType.Replace(" ", "").ToUpper() == "Food".Replace(" ", "").ToUpper())
                    {
                        g_FoodDataGridView.Rows.Add(tempDataGridViewRow);
                        g_FoodDataGridView.Sort(g_FoodDataGridView.Columns[5], ListSortDirection.Ascending);
                    }
                    else
                    {
                        g_BeverageDataGridView.Rows.Add(tempDataGridViewRow); //If drinks
                        g_BeverageDataGridView.Sort(g_BeverageDataGridView.Columns[5], ListSortDirection.Ascending);
                    }
                }

                //get discount
                COrderDiscount tempOrderDiscount = new COrderDiscount();
                oResult = tempOrderManager.OrderDiscountGetByOrderID(orderID);
                if (oResult.IsSuccess && oResult.Data != null)
                {
                    tempOrderDiscount = (COrderDiscount)oResult.Data;
                    m_dDiscountAmount = Convert.ToDecimal(tempOrderDiscount.Discount.ToString("F02"));
                }
            }
            this.TotalAmountCalculation();

              g_FoodDataGridView.ClearSelection();
               g_BeverageDataGridView.ClearSelection();
            try
            {
                this.SetPrintedItemBackColor(); //set the back color
            }
            catch { }
        }
예제 #19
0
        public override void mostrarDatos(DataGridView dtgrdvw, TextBox txtbBuscado)
        {
            dtgrdvw.DataSource = null;
            dtgrdvw.Update();

            BencalethDataSet dtset = new BencalethDataSet();
            BencalethDataSetTableAdapters.BuscarSelect_VoluntariosTableAdapter tblAdptEmp = new BuscarSelect_VoluntariosTableAdapter();

            if (!(string.IsNullOrEmpty(txtbBuscado.Text)))
            {
                if (((RadioButton)txtbBuscado.Parent.Controls["rdbtnID"]).Checked)
                {
                    tblAdptEmp.Fill(dtset.BuscarSelect_Voluntarios, txtbBuscado.Text, null);
                }
                else
                {
                    tblAdptEmp.Fill(dtset.BuscarSelect_Voluntarios, null, txtbBuscado.Text);
                }
            }
            else
            {
                tblAdptEmp.Fill(dtset.BuscarSelect_Voluntarios, null, null);
            }

            dtgrdvw.DataSource = dtset.BuscarSelect_Voluntarios.DefaultView;
            dtgrdvw.Columns[0].HeaderText = "ID";
            dtgrdvw.Columns[1].HeaderText = "Nombre";
            dtgrdvw.Columns[2].HeaderText = "Apellidos";
            dtgrdvw.Columns[3].HeaderText = "Género";
            dtgrdvw.Columns[4].HeaderText = "Fecha de Nacimiento";
            dtgrdvw.Columns[5].HeaderText = "Fecha de Inicio";
            dtgrdvw.Columns[6].HeaderText = "Teléfono";
            dtgrdvw.Columns[7].HeaderText = "Correo Electrónico";
            dtgrdvw.Columns[8].HeaderText = "Horas";
            dtgrdvw.Columns[9].HeaderText = "Información";
            dtgrdvw.Update();
        }
예제 #20
0
        public void mostrarDatos(DataGridView dtgrdvw, TextBox txtbBuscado)
        {
            dtgrdvw.DataSource = null;
            dtgrdvw.Update();

            BencalethDataSet dtset = new BencalethDataSet();
            BencalethDataSetTableAdapters.BuscarSelect_EmpresasTableAdapter tblAdptEmp = new BuscarSelect_EmpresasTableAdapter();

            if (!(string.IsNullOrEmpty(txtbBuscado.Text)))
            {
                if (((RadioButton)txtbBuscado.Parent.Controls["rdbtnID"]).Checked)
                {
                    tblAdptEmp.Fill(dtset.BuscarSelect_Empresas, txtbBuscado.Text, null);
                }
                else
                {
                    tblAdptEmp.Fill(dtset.BuscarSelect_Empresas, null, txtbBuscado.Text);
                }
            }
            else
            {
                tblAdptEmp.Fill(dtset.BuscarSelect_Empresas, null, null);
            }

            dtgrdvw.DataSource = dtset.BuscarSelect_Empresas.DefaultView;
            dtgrdvw.Columns[0].HeaderText = "ID";
            dtgrdvw.Columns[1].HeaderText = "Nombre";
            dtgrdvw.Columns[2].HeaderText = "Tipo de Empresa";
            dtgrdvw.Columns[3].HeaderText = "Dirección";
            dtgrdvw.Columns[4].HeaderText = "Contacto";
            dtgrdvw.Columns[5].HeaderText = "Teléfono 1";
            dtgrdvw.Columns[6].HeaderText = "Teléfono 2";
            dtgrdvw.Columns[7].HeaderText = "País";
            dtgrdvw.Columns[8].HeaderText = "Correo Electrónico";
            dtgrdvw.Update();
        }