示例#1
0
        //metod load record to edition pass id
        public PlaneAccountModel LoadRecords(int?Id)
        {
            PlaneAccountModel item = new PlaneAccountModel();
            string            sql  = $"SELECT ID, DESCRIPTION, TYPE, USER_ID FROM PLANEACCOUNT WHERE USER_ID = {id_User_Logged()} AND ID = {Id}";
            DAL       objectDAL    = new DAL();
            DataTable datatable    = objectDAL.ReturnDataTable(sql);

            item.Id          = int.Parse(datatable.Rows[0]["ID"].ToString());
            item.Description = datatable.Rows[0]["Description"].ToString();
            item.Type        = datatable.Rows[0]["Type"].ToString();
            item.User_Id     = int.Parse(datatable.Rows[0]["User_Id"].ToString());

            return(item);
        }
示例#2
0
        public List <PlaneAccountModel> ListPlaneAccount()
        {
            List <PlaneAccountModel> List = new List <PlaneAccountModel>();
            PlaneAccountModel        item;
            string    sql       = $"SELECT ID, DESCRIPTION, TYPE, USER_ID FROM PLANEACCOUNT WHERE USER_ID = {id_User_Logged()}";
            DAL       objectDAL = new DAL();
            DataTable datatable = objectDAL.ReturnDataTable(sql);

            for (int i = 0; i < datatable.Rows.Count; i++)
            {
                item             = new PlaneAccountModel();
                item.Id          = int.Parse(datatable.Rows[i]["ID"].ToString());
                item.Description = datatable.Rows[i]["Description"].ToString();
                item.Type        = datatable.Rows[i]["Type"].ToString();
                item.User_Id     = int.Parse(datatable.Rows[i]["User_Id"].ToString());
                List.Add(item);
            }

            return(List);
        }