예제 #1
0
        public void FillExpense(string filter)
        {
            expenseTableAdapter daEx = new expenseTableAdapter();

            if (filter != "")
            {
                DS.expense.Clear();
                daEx.Adapter.SelectCommand = new MySqlCommand("select * from expense where " + filter, daEx.Connection);

                daEx.Adapter.Fill(DS.expense);
            }
            else
            {
                daEx.Fill(DS.expense);
            }
            //DS.expense
        }
예제 #2
0
파일: Kassa.cs 프로젝트: umidjonv/Dilering
        public Kassa(int expId)
        {
            InitializeComponent();

            db = new DBclass();
            expenseTableAdapter prVda = new expenseTableAdapter();

            prVda.Fill(DBclass.DS.expense);
            table = DBclass.DS.expense;
            DataTable chTable = DBclass.DS.changesel;

            chs.Fill(DBclass.DS.changesel);
            DataRow[] temp     = DBclass.DS.changesel.Select("");
            DataView  dataView = new DataView(chTable);

            dataView.RowFilter = "userId = " + UserValues.CurrentUserID;
            dataView.Sort      = "changSelId DESC";
            chTable            = dataView.ToTable();
            DBclass.DS.changesel.DefaultView.Sort = "changSelId desc";
            dt        = DBclass.DS.expense.Select("userId = " + UserValues.CurrentUserID);
            expenseId = Convert.ToInt32(chTable.Rows[1]["expenseId"].ToString());

            Smena.Text = chTable.Rows[0]["startTime"].ToString();
            DataSetTpos.expenseRow row = (DataSetTpos.expenseRow)dt[0];
            if (chTable.Rows[1]["expenseId"].ToString() == "")
            {
                expenseId = row.expenseId;
            }
            sumTerm = table.Compute("Sum(terminal)", "userId = " + UserValues.CurrentUserID + " and expenseId > " + expenseId + " and debt = 0 and expType = 0");
            sumExp  = table.Compute("Sum(expSum)", "userId = " + UserValues.CurrentUserID + " and expenseId > " + expenseId + " and debt = 0 and expType = 0");
            sumBack = table.Compute("Sum(expSum)", "userId = " + UserValues.CurrentUserID + " and expenseId > " + expenseId + " and debt = 0 and expType = 1");
            sumDebt = table.Compute("Sum(expSum)", "userId = " + UserValues.CurrentUserID + " and expenseId > " + expenseId + " and debt = 1 and expType = 0");
            int sumE;
            int sumT;
            int sumB;
            int sumD;

            if (sumExp.ToString() == String.Empty)
            {
                sumE = 0;
            }
            else
            {
                sumE = Convert.ToInt32(sumExp);
            }

            if (sumTerm.ToString() == String.Empty)
            {
                sumT = 0;
            }
            else
            {
                sumT = Convert.ToInt32(sumTerm);
            }

            if (sumBack.ToString() == String.Empty)
            {
                sumB = 0;
            }
            else
            {
                sumB = Convert.ToInt32(sumBack);
            }

            if (sumDebt.ToString() == String.Empty)
            {
                sumD = 0;
            }
            else
            {
                sumD = Convert.ToInt32(sumDebt);
            }

            nal.Text      = (sumE - sumT).ToString();
            terminal.Text = sumT.ToString();
            debt.Text     = sumD.ToString();
            back.Text     = sumB.ToString();
            all.Text      = Convert.ToInt32(sumE).ToString();
            expenseId     = expId;
        }