Beispiel #1
0
        public List <Expensess> GetAllExpensess(string date1, string date2)
        {
            List <Expensess> all = new List <Expensess>();

            SqlParameter[] param   = new SqlParameter[2];
            string         command = "Select * from T_Epenses where Date between @date and @date2 ";

            try
            {
                DBAdapter.OPen();
                param[0]       = new SqlParameter("@date", SqlDbType.Date, 50);
                param[0].Value = date1;

                param[1]       = new SqlParameter("@date2", SqlDbType.Date, 50);
                param[1].Value = date2;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            DBAdapter.Close();
            DataTable table = _do.getQuery(command, param);

            Expensess expensess = new Expensess();

            if (table.Rows.Count > 0)
            {
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    expensess.Employee_Name = table.Rows[i]["Emp_ID"].ToString();
                    expensess.Cost          = table.Rows[i]["Expenses"].ToString();
                    expensess.Date          = table.Rows[i]["Date"].ToString();
                    expensess.DESC          = table.Rows[i]["Descreption"].ToString();

                    all.Add(expensess);
                }
            }


            return(all);
        }
Beispiel #2
0
        public void RemoveScale(Scale scale)
        {
            string command = "Delete From DailyWork where F_Date=@date And Car_ID=@carid And Car_char=@carchar And Emp_ID=@emp And F_Tiem=@time";

            try
            {
                DBAdapter.OPen();

                SqlParameter[] param = new SqlParameter[5];
                param[0]       = new SqlParameter("@date", SqlDbType.Date, 50);
                param[0].Value = scale.F_Date;

                param[1]       = new SqlParameter("@carid", SqlDbType.NVarChar, 50);
                param[1].Value = scale.Carid;

                param[2]       = new SqlParameter("@carchar", SqlDbType.NVarChar, 50);
                param[2].Value = scale.Caridchar;

                param[3]       = new SqlParameter("@emp", SqlDbType.NVarChar, 50);
                param[3].Value = scale.Emp_Id;

                param[4]       = new SqlParameter("@time", SqlDbType.NVarChar, 50);
                param[4].Value = scale.F_Time;

                _do.Execute_Query(command, param);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DBAdapter.Close();
                Alert.Show("Scale Deleted Successfuly");
            }
        }